summaryrefslogtreecommitdiff
path: root/io-module/mts_io.c
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2014-10-03 15:09:42 -0500
committerMike Fiore <mfiore@multitech.com>2014-10-03 15:09:42 -0500
commitf9010f0863063e6836394469edf43e86c98d49fe (patch)
treeb7fde122fbc570786240836cfb057ba76dea84db /io-module/mts_io.c
parent0f0c9bb72a3be330512e60677c4e3693347bf66b (diff)
downloadmts-io-f9010f0863063e6836394469edf43e86c98d49fe.tar.gz
mts-io-f9010f0863063e6836394469edf43e86c98d49fe.tar.bz2
mts-io-f9010f0863063e6836394469edf43e86c98d49fe.zip
mts-io: reorganize accessory card attributes, move them into subdirs under mts-io
subdirs named ap1, ap2, etc create links to subdirs with name of card in port, e.g. gpiob, mfser, eth, etc if 2 of same type of card, still make links but use gpiob-2, mfser-2, etc
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r--io-module/mts_io.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 15a70a3..048f96d 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -78,14 +78,14 @@ static struct mts_id_eeprom_layout id_eeprom;
/* accessory card EEPROMs */
extern uint8_t mts_ap_eeprom[NUM_AP][512];
static struct mts_ap_eeprom_layout ap_eeprom[NUM_AP];
+/* kobject pointers for the apX subdirectories that correspond to the accessory ports */
+static struct kobject *ap_subdirs[NUM_AP];
+/* attribute groups for the accessory ports*/
+static struct attribute_group ap_attr_groups[NUM_AP];
#endif
static struct ap_info* port_info[NUM_AP];
-static struct attribute **device_attrs;
-static size_t device_attrs_size;
-static size_t device_attrs_max_size;
-
static uint8_t mts_product_id;
static uint8_t has_spi_sout;
static uint8_t has_spi_din;
@@ -546,12 +546,6 @@ static int mts_id_eeprom_load(void)
has_spi_temp = 0;
log_info("detected board %s", HW_VERSION_MTR_0_1);
} else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR2D2_0_0, strlen(HW_VERSION_MTR2D2_0_0)) == 0) {
- // need to put any accessory card attributes into this list so they show up in sysfs
- // the port_info->setup callback does this
- device_attrs = mtr2d2_platform_attributes;
- device_attrs_size = mtr2d2_platform_attributes_size;
- device_attrs_max_size = mtr2d2_platform_attributes_max_size;
-
attr_group = &mtr2d2_platform_attribute_group;
gpio_pins = gpio_pins_mtr2d2_0_0;
mts_product_id = MTR2D2_0_0;
@@ -628,13 +622,6 @@ static int __init mts_io_init(void)
goto error1;
}
- if (NUM_AP) {
- for (port = 0; port < NUM_AP; port++) {
- port_info[port] = NULL;
- }
- init_accessory_ports();
- }
-
mts_io_platform_device = platform_device_alloc(PLATFORM_NAME, -1);
if (!mts_io_platform_device) {
ret = -ENOMEM;
@@ -655,6 +642,13 @@ static int __init mts_io_init(void)
goto error3;
}
+ if (NUM_AP) {
+ for (port = 0; port < NUM_AP; port++) {
+ port_info[port] = NULL;
+ }
+ init_accessory_ports();
+ }
+
ret = sysfs_create_group(&mts_io_platform_device->dev.kobj, attr_group);
if (ret) {
goto error4;