summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io-module/mts_io.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index dd3a9ae..8794785 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -883,6 +883,7 @@ mts_id_eeprom_load(void)
} else if (((tmp=HW_VERSION_MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) ||
((tmp=HW_VERSION_MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) {
current_blength = attr_blength = sizeof mtcdt_0_1_platform_attributes;
+ current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */
/* See if we have no radio, and if so, prune out the stuff that follows */
if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDT, sizeof PRODUCT_ID_MTCDT - 1) == 0) &&
@@ -910,15 +911,17 @@ mts_id_eeprom_load(void)
if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
attr_blength += sizeof mtcdt_0_1_gnss_attributes;
}
- if (current_blength != attr_blength) {
+ if (current_blength+(sizeof(struct attribute *)) != attr_blength) {
freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL);
current_count = current_blength/(sizeof (struct attribute *));
memcpy(all_attrs,mtcdt_0_1_platform_attributes,current_blength);
if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
+ log_info("Adding WiFi/BT to mts-io driver");
memcpy(all_attrs + current_count,mtcdt_0_1_wifi_bt_attributes,sizeof mtcdt_0_1_wifi_bt_attributes);
current_count += sizeof mtcdt_0_1_wifi_bt_attributes / (sizeof (struct attribute *));
}
if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
+ log_info("Adding GPS to mts-io driver");
attr_blength += sizeof mtcdt_0_1_gnss_attributes;
memcpy(all_attrs + current_count,mtcdt_0_1_gnss_attributes,sizeof mtcdt_0_1_gnss_attributes);
current_count += sizeof mtcdt_0_1_gnss_attributes / (sizeof (struct attribute *));
@@ -932,6 +935,7 @@ mts_id_eeprom_load(void)
log_info("detected board %s", tmp);
} else if ((tmp=HW_VERSION_MTCDTIPHP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) {
current_blength = attr_blength = sizeof mtcdt_0_1_platform_attributes;
+ current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */
/* See if we have no radio, and if so, prune out the stuff that follows */
if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCDTIPHP, sizeof PRODUCT_ID_MTCDTIPHP - 1) == 0) &&
@@ -958,15 +962,17 @@ mts_id_eeprom_load(void)
if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
attr_blength += sizeof mtcdt_0_1_gnss_attributes;
}
- if (current_blength != attr_blength) {
+ if (current_blength+(sizeof(struct attribute *)) != attr_blength) {
freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL);
current_count = current_blength/(sizeof (struct attribute *));
memcpy(all_attrs,mtcdt_0_1_platform_attributes,current_blength);
if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
+ log_info("Adding WiFi/BT to mts-io driver");
memcpy(all_attrs + current_count,mtcdt_0_1_wifi_bt_attributes,sizeof mtcdt_0_1_wifi_bt_attributes);
current_count += sizeof mtcdt_0_1_wifi_bt_attributes / (sizeof (struct attribute *));
}
if(DEVICE_CAPA(id_eeprom.capa, CAPA_GPS)) {
+ log_info("Adding GPS to mts-io driver");
attr_blength += sizeof mtcdt_0_1_gnss_attributes;
memcpy(all_attrs + current_count,mtcdt_0_1_gnss_attributes,sizeof mtcdt_0_1_gnss_attributes);
current_count += sizeof mtcdt_0_1_gnss_attributes / (sizeof (struct attribute *));