hwmon: (abituguru3) Support multiple DMI
Subsystems (2)
Alistair John Strachan
maintainerPATCH 1/1 hwmon: (abituguru3) Support multiple DMI
Most known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load.
The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs.
This patch replaces the dmi_name string with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune).
References: https://bugs.launchpad.net/bugs/298798
--- drivers/hwmon/abituguru3.c | 63 +++++++++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 29 deletions(-)
drivers/hwmon/abituguru3.c +34 -29
@@ -117,9 +117,12 @@ struct abituguru3_sensor_info {int offset; }; +/* Avoid use of flexible array members */ +#define ABIT_UGURU3_MAX_DMI_NAMES 2 +struct abituguru3_motherboard_info {u16 id; -const char *dmi_name; +const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES +1 ];/* + 1 -> end of sensors indicated by a sensor with name = NULL */ struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS +1 ]; };
@@ -164,7 +167,7 @@ struct abituguru3_data {/* Constants */ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { - {0x000C ,NULL /* Unknown, need DMI string */ , { + {0x000C , {NULL }/* Unknown, need DMI string */ , { {"CPU Core" ,0 ,0 ,10 ,1 ,0 }, {"DDR" ,1 ,0 ,10 ,1 ,0 }, {"DDR VTT" ,2 ,0 ,10 ,1 ,0 },
@@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 35, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000D, NULL /* Abit AW8, need DMI string */, { + { 0x000D, { NULL } /* Abit AW8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000E, NULL /* AL-8, need DMI string */, { + { 0x000E, { NULL } /* AL-8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000F, NULL /* Unknown, need DMI string */, { + { 0x000F, { NULL } /* Unknown, need DMI string */, { + { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { + { 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0011, "AT8 32X", { + { 0x0011, { "AT8 32X", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { + { 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0013, NULL /* Abit AW8D, need DMI string */, { + { 0x0013, { NULL } /* Abit AW8D, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0014, "AB9", /* + AB9 Pro */ { + { 0x0014, { "AB9", "AB9 Pro", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0015, NULL /* Unknown, need DMI string */, { + { 0x0015, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0016, "AW9D-MAX", { + { 0x0016, { "AW9D-MAX", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 38, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0017, NULL /* Unknown, need DMI string */, { + { 0x0017, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0018, "AB9 QuadGT", { + { 0x0018, { "AB9 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0019, "IN9 32X MAX", { + { 0x0019, { "IN9 32X MAX", NULL }, { { "CPU Core", 7, 0, 10, 1, 0 }, { "DDR2", 13, 0, 20, 1, 0 }, { "DDR2 VTT", 14, 0, 10, 1, 0 },
@@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001A, "IP35 Pro", { + { 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX4 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001B, NULL /* Unknown, need DMI string */, { + { 0x001B, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR3", 1, 0, 20, 1, 0 }, { "DDR3 VTT", 2, 0, 10, 1, 0 },
@@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001C, "IX38 QuadGT", { + { 0x001C, { "IX38 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } + { 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } } };
@@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) "ID: %04X\n", (unsigned int)id);#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { +if (!*abituguru3_motherboards[i].dmi_name) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer "
@@ -1131,6 +1135,7 @@ static int __init abituguru3_dmi_detect(void) {const char *board_vendor, *board_name;int i, err = (force) ?1 : -ENODEV ; +const char *const *dmi_name;size_t sublen; board_vendor =dmi_get_system_info (DMI_BOARD_VENDOR );
@@ -1151,17 +1156,17 @@ static int __init abituguru3_dmi_detect(void) sublen--;for (i =0 ; abituguru3_motherboards[i].id; i++) { -const char *dmi_name = abituguru3_motherboards[i].dmi_name; -if (!dmi_name ||strlen (dmi_name) != sublen) -continue ; -if (!strncasecmp (board_name, dmi_name, sublen)) -break ; + dmi_name = abituguru3_motherboards[i].dmi_name; +for ( ; *dmi_name; dmi_name++) { +if (strlen (*dmi_name) != sublen) +continue ; +if (!strncasecmp (board_name, *dmi_name, sublen)) +return 0 ; + } } -if (!abituguru3_motherboards[i].id) -return 1 ; - - return 0; +/* No match found */ + return 1; }#else /* !CONFIG_DMI */
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi,
Quoted 31 lines · Alistair John Strachan
Most known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load.
The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs.
This patch replaces the
dmi_namestring with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune).References: https://bugs.launchpad.net/bugs/298798
Signed-off-by Alistair John Strachan<[email protected]>Tested-by Rune Svendsen<[email protected]>Cc Rune Svendsen<[email protected]>Cc Hans de Goede<[email protected]>--- drivers/hwmon/abituguru3.c | 63 +++++++++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 29 deletions(-)drivers/hwmon/abituguru3.c +0
-0
<snip>
drivers/hwmon/abituguru3.c static int __devinit abituguru3_probe(struct platform_device *pdev) · line 957
Quoted 9 lines
drivers/hwmon/abituguru3.c +1
-1@@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) "ID: %04X\n", (unsigned int)id);#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { +if (!*abituguru3_motherboards[i].dmi_name) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer "
I would prefer to see you write this as:
+ if (!abituguru3_motherboards[i].dmi_name[0]) {
This is better readable IMHO (I always dislike people using the singleton * operator when they want to get the first member of an array. The singleton
* operator is for getting the content of a pointer).
Note this is in no way a blocker for this patch, just my preference.
Quoted 25 lines
drivers/hwmon/abituguru3.c +8
-5@@ -1131,6 +1135,7 @@ static int __init abituguru3_dmi_detect(void) {const char *board_vendor, *board_name;int i, err = (force) ?1 : -ENODEV ; +const char *const *dmi_name;size_t sublen; board_vendor =dmi_get_system_info (DMI_BOARD_VENDOR );@@ -1151,17 +1156,17 @@ static int __init abituguru3_dmi_detect(void) sublen--;for (i =0 ; abituguru3_motherboards[i].id; i++) { -const char *dmi_name = abituguru3_motherboards[i].dmi_name; -if (!dmi_name ||strlen (dmi_name) != sublen) -continue ; -if (!strncasecmp (board_name, dmi_name, sublen)) -break ; + dmi_name = abituguru3_motherboards[i].dmi_name; +for ( ; *dmi_name; dmi_name++) { +if (strlen (*dmi_name) != sublen) +continue ; +if (!strncasecmp (board_name, *dmi_name, sublen)) +return 0 ; + } }
drivers/hwmon/abituguru3.c static int __init abituguru3_dmi_detect(void) · line 1172
Quoted 10 lines
drivers/hwmon/abituguru3.c +2
-4-if (!abituguru3_motherboards[i].id) -return 1 ; - - return 0; +/* No match found */ + return 1; }#else /* !CONFIG_DMI */
Other then that the patch looks good to me.
Regards,
Hans
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Alistair John Strachan
maintainerPATCH 1/1 hwmon: (abituguru3) Support multiple DMI
In reply to Alistair John StrachanMost known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load.
The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs.
This patch replaces the dmi_name string with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune).
References: https://bugs.launchpad.net/bugs/298798
--- drivers/hwmon/abituguru3.c | 63 +++++++++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 29 deletions(-)
drivers/hwmon/abituguru3.c +34 -29
@@ -117,9 +117,12 @@ struct abituguru3_sensor_info {int offset; }; +/* Avoid use of flexible array members */ +#define ABIT_UGURU3_MAX_DMI_NAMES 2 +struct abituguru3_motherboard_info {u16 id; -const char *dmi_name; +const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES +1 ];/* + 1 -> end of sensors indicated by a sensor with name = NULL */ struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS +1 ]; };
@@ -164,7 +167,7 @@ struct abituguru3_data {/* Constants */ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { - {0x000C ,NULL /* Unknown, need DMI string */ , { + {0x000C , {NULL }/* Unknown, need DMI string */ , { {"CPU Core" ,0 ,0 ,10 ,1 ,0 }, {"DDR" ,1 ,0 ,10 ,1 ,0 }, {"DDR VTT" ,2 ,0 ,10 ,1 ,0 },
@@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 35, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000D, NULL /* Abit AW8, need DMI string */, { + { 0x000D, { NULL } /* Abit AW8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000E, NULL /* AL-8, need DMI string */, { + { 0x000E, { NULL } /* AL-8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000F, NULL /* Unknown, need DMI string */, { + { 0x000F, { NULL } /* Unknown, need DMI string */, { + { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { + { 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0011, "AT8 32X", { + { 0x0011, { "AT8 32X", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { + { 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0013, NULL /* Abit AW8D, need DMI string */, { + { 0x0013, { NULL } /* Abit AW8D, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0014, "AB9", /* + AB9 Pro */ { + { 0x0014, { "AB9", "AB9 Pro", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0015, NULL /* Unknown, need DMI string */, { + { 0x0015, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0016, "AW9D-MAX", { + { 0x0016, { "AW9D-MAX", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 38, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0017, NULL /* Unknown, need DMI string */, { + { 0x0017, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0018, "AB9 QuadGT", { + { 0x0018, { "AB9 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0019, "IN9 32X MAX", { + { 0x0019, { "IN9 32X MAX", NULL }, { { "CPU Core", 7, 0, 10, 1, 0 }, { "DDR2", 13, 0, 20, 1, 0 }, { "DDR2 VTT", 14, 0, 10, 1, 0 },
@@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001A, "IP35 Pro", { + { 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX4 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001B, NULL /* Unknown, need DMI string */, { + { 0x001B, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR3", 1, 0, 20, 1, 0 }, { "DDR3 VTT", 2, 0, 10, 1, 0 },
@@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001C, "IX38 QuadGT", { + { 0x001C, { "IX38 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } + { 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } } };
@@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) "ID: %04X\n", (unsigned int)id);#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { +if (!abituguru3_motherboards[i].dmi_name[0 ]) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer "
@@ -1131,6 +1135,7 @@ static int __init abituguru3_dmi_detect(void) {const char *board_vendor, *board_name;int i, err = (force) ?1 : -ENODEV ; +const char *const *dmi_name;size_t sublen; board_vendor =dmi_get_system_info (DMI_BOARD_VENDOR );
@@ -1151,17 +1156,17 @@ static int __init abituguru3_dmi_detect(void) sublen--;for (i =0 ; abituguru3_motherboards[i].id; i++) { -const char *dmi_name = abituguru3_motherboards[i].dmi_name; -if (!dmi_name ||strlen (dmi_name) != sublen) -continue ; -if (!strncasecmp (board_name, dmi_name, sublen)) -break ; + dmi_name = abituguru3_motherboards[i].dmi_name; +for ( ; *dmi_name; dmi_name++) { +if (strlen (*dmi_name) != sublen) +continue ; +if (!strncasecmp (board_name, *dmi_name, sublen)) +return 0 ; + } } -if (!abituguru3_motherboards[i].id) -return 1 ; - - return 0; +/* No match found */ + return 1; }#else /* !CONFIG_DMI */
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi,
Looks perfect now.
Regards,
Hans
Quoted 242 lines · Alistair John Strachan
Most known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load.
The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs.
This patch replaces the
dmi_namestring with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune).References: https://bugs.launchpad.net/bugs/298798
Signed-off-by Alistair John Strachan<[email protected]>Tested-by Rune Svendsen<[email protected]>Cc Rune Svendsen<[email protected]>Cc Hans de Goede<[email protected]>--- drivers/hwmon/abituguru3.c | 63 +++++++++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 29 deletions(-)drivers/hwmon/abituguru3.c +32
-25@@ -117,9 +117,12 @@ struct abituguru3_sensor_info {int offset; }; +/* Avoid use of flexible array members */ +#define ABIT_UGURU3_MAX_DMI_NAMES 2 +struct abituguru3_motherboard_info {u16 id; -const char *dmi_name; +const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES +1 ];/* + 1 -> end of sensors indicated by a sensor with name = NULL */ struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS +1 ]; };@@ -164,7 +167,7 @@ struct abituguru3_data {/* Constants */ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { - {0x000C ,NULL /* Unknown, need DMI string */ , { + {0x000C , {NULL }/* Unknown, need DMI string */ , { {"CPU Core" ,0 ,0 ,10 ,1 ,0 }, {"DDR" ,1 ,0 ,10 ,1 ,0 }, {"DDR VTT" ,2 ,0 ,10 ,1 ,0 },@@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 35, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000D, NULL /* Abit AW8, need DMI string */, { + { 0x000D, { NULL } /* Abit AW8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000E, NULL /* AL-8, need DMI string */, { + { 0x000E, { NULL } /* AL-8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000F, NULL /* Unknown, need DMI string */, { + { 0x000F, { NULL } /* Unknown, need DMI string */, { + { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { + { 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0011, "AT8 32X", { + { 0x0011, { "AT8 32X", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { + { 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0013, NULL /* Abit AW8D, need DMI string */, { + { 0x0013, { NULL } /* Abit AW8D, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0014, "AB9", /* + AB9 Pro */ { + { 0x0014, { "AB9", "AB9 Pro", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0015, NULL /* Unknown, need DMI string */, { + { 0x0015, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0016, "AW9D-MAX", { + { 0x0016, { "AW9D-MAX", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 38, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0017, NULL /* Unknown, need DMI string */, { + { 0x0017, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0018, "AB9 QuadGT", { + { 0x0018, { "AB9 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0019, "IN9 32X MAX", { + { 0x0019, { "IN9 32X MAX", NULL }, { { "CPU Core", 7, 0, 10, 1, 0 }, { "DDR2", 13, 0, 20, 1, 0 }, { "DDR2 VTT", 14, 0, 10, 1, 0 },@@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001A, "IP35 Pro", { + { 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX4 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001B, NULL /* Unknown, need DMI string */, { + { 0x001B, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR3", 1, 0, 20, 1, 0 }, { "DDR3 VTT", 2, 0, 10, 1, 0 },@@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001C, "IX38 QuadGT", { + { 0x001C, { "IX38 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } + { 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } } };@@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) "ID: %04X\n", (unsigned int)id);#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { +if (!abituguru3_motherboards[i].dmi_name[0 ]) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer " @@ -1131,6 +1135,7 @@ static int __init abituguru3_dmi_detect(void) {const char *board_vendor, *board_name;int i, err = (force) ?1 : -ENODEV ; +const char *const *dmi_name;size_t sublen; board_vendor =dmi_get_system_info (DMI_BOARD_VENDOR );@@ -1151,17 +1156,17 @@ static int __init abituguru3_dmi_detect(void) sublen--;for (i =0 ; abituguru3_motherboards[i].id; i++) { -const char *dmi_name = abituguru3_motherboards[i].dmi_name; -if (!dmi_name ||strlen (dmi_name) != sublen) -continue ; -if (!strncasecmp (board_name, dmi_name, sublen)) -break ; + dmi_name = abituguru3_motherboards[i].dmi_name; +for ( ; *dmi_name; dmi_name++) { +if (strlen (*dmi_name) != sublen) +continue ; +if (!strncasecmp (board_name, *dmi_name, sublen)) +return 0 ; + } }
drivers/hwmon/abituguru3.c static int __init abituguru3_dmi_detect(void) · line 1172
Quoted 10 lines
drivers/hwmon/abituguru3.c +2
-4-if (!abituguru3_motherboards[i].id) -return 1 ; - - return 0; +/* No match found */ + return 1; }#else /* !CONFIG_DMI */
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Alistair,
Quoted 11 lines · Alistair John Strachan
Most known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load.
The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs.
Quoted 5 lines
This patch replaces the
dmi_namestring with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune).References: https://bugs.launchpad.net/bugs/298798
Looks overall good, with a suggestion for improvement below:
Quoted 193 lines
Signed-off-by Alistair John Strachan <[email protected]>Tested-by Rune Svendsen <[email protected]>Cc Rune Svendsen <[email protected]>Cc Hans de Goede <[email protected]>--- drivers/hwmon/abituguru3.c | 63 +++++++++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 29 deletions(-)drivers/hwmon/abituguru3.c +23
-19@@ -117,9 +117,12 @@ struct abituguru3_sensor_info {int offset; }; +/* Avoid use of flexible array members */ +#define ABIT_UGURU3_MAX_DMI_NAMES 2 +struct abituguru3_motherboard_info {u16 id; -const char *dmi_name; +const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES +1 ];/* + 1 -> end of sensors indicated by a sensor with name = NULL */ struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS +1 ]; };@@ -164,7 +167,7 @@ struct abituguru3_data {/* Constants */ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { - {0x000C ,NULL /* Unknown, need DMI string */ , { + {0x000C , {NULL }/* Unknown, need DMI string */ , { {"CPU Core" ,0 ,0 ,10 ,1 ,0 }, {"DDR" ,1 ,0 ,10 ,1 ,0 }, {"DDR VTT" ,2 ,0 ,10 ,1 ,0 },@@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 35, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000D, NULL /* Abit AW8, need DMI string */, { + { 0x000D, { NULL } /* Abit AW8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000E, NULL /* AL-8, need DMI string */, { + { 0x000E, { NULL } /* AL-8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000F, NULL /* Unknown, need DMI string */, { + { 0x000F, { NULL } /* Unknown, need DMI string */, { + { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { + { 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0011, "AT8 32X", { + { 0x0011, { "AT8 32X", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { + { 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0013, NULL /* Abit AW8D, need DMI string */, { + { 0x0013, { NULL } /* Abit AW8D, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0014, "AB9", /* + AB9 Pro */ { + { 0x0014, { "AB9", "AB9 Pro", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0015, NULL /* Unknown, need DMI string */, { + { 0x0015, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },@@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0016, "AW9D-MAX", { + { 0x0016, { "AW9D-MAX", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 38, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0017, NULL /* Unknown, need DMI string */, { + { 0x0017, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0018, "AB9 QuadGT", { + { 0x0018, { "AB9 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0019, "IN9 32X MAX", { + { 0x0019, { "IN9 32X MAX", NULL }, { { "CPU Core", 7, 0, 10, 1, 0 }, { "DDR2", 13, 0, 20, 1, 0 }, { "DDR2 VTT", 14, 0, 10, 1, 0 },@@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001A, "IP35 Pro", { + { 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX4 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001B, NULL /* Unknown, need DMI string */, { + { 0x001B, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR3", 1, 0, 20, 1, 0 }, { "DDR3 VTT", 2, 0, 10, 1, 0 },@@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001C, "IX38 QuadGT", { + { 0x001C, { "IX38 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },@@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } + { 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } } };
drivers/hwmon/abituguru3.c static int __devinit abituguru3_probe(struct platform_device *pdev) · line 957
Quoted 8 lines
drivers/hwmon/abituguru3.c +1
-1@@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) "ID: %04X\n", (unsigned int)id);#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { +if (!abituguru3_motherboards[i].dmi_name[0 ]) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer "
This test is no longer as perfect as it used to be. Now that you admit that each ID can correspond to more than one board model, it is possible that the board was _not_ detected using DMI but this message will not show (because another board with this ID is already known.) While this is not a blocker, I still think it would be worth improving.
Maybe I am missing something obvious, but why isn't this message printed in abituguru3_dmi_detect() directly? This would be more efficient and more elegant too IMHO.
Quoted 35 lines
drivers/hwmon/abituguru3.c +10
-9@@ -1131,6 +1135,7 @@ static int __init abituguru3_dmi_detect(void) {const char *board_vendor, *board_name;int i, err = (force) ?1 : -ENODEV ; +const char *const *dmi_name;size_t sublen; board_vendor =dmi_get_system_info (DMI_BOARD_VENDOR );@@ -1151,17 +1156,17 @@ static int __init abituguru3_dmi_detect(void) sublen--;for (i =0 ; abituguru3_motherboards[i].id; i++) { -const char *dmi_name = abituguru3_motherboards[i].dmi_name; -if (!dmi_name ||strlen (dmi_name) != sublen) -continue ; -if (!strncasecmp (board_name, dmi_name, sublen)) -break ; + dmi_name = abituguru3_motherboards[i].dmi_name; +for ( ; *dmi_name; dmi_name++) { +if (strlen (*dmi_name) != sublen) +continue ; +if (!strncasecmp (board_name, *dmi_name, sublen)) +return 0 ; + } } -if (!abituguru3_motherboards[i].id) -return 1 ; - - return 0; +/* No match found */ + return 1; }#else /* !CONFIG_DMI */
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Alistair John Strachan
maintainerHi Jean,
Quoted 13 lines · On Sunday 06 September 2009 13:03:51 Jean Delvare wrote:
drivers/hwmon/abituguru3.c static int __devinit abituguru3_probe(struct platform_device *pdev) · line 957
Quoted 6 lines · Alistair John Strachan
#ifdef
CONFIG_DMIdrivers/hwmon/abituguru3.c +1
-1-if (!abituguru3_motherboards[i].dmi_name) { +if (!abituguru3_motherboards[i].dmi_name[0 ]) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer " This test is no longer as perfect as it used to be. Now that you admit that each ID can correspond to more than one board model, it is possible that the board was _not_ detected using DMI but this message will not show (because another board with this ID is already known.) While this is not a blocker, I still think it would be worth improving.
You're right. I think the message should go in abituguru3_init() after abituguru3_detect() (legacy probing) succeeds. Because..
Quoted 3 lines
Maybe I am missing something obvious, but why isn't this message printed in
abituguru3_dmi_detect()directly? This would be more efficient and more elegant too IMHO.
I don't think it would be correct though. I assume we don't want to print anything out if somebody loads the driver on truly unsupported hardware. In this case abituguru3_dmi_detect() will fail (rightfully) and then the legacy probe method will also fail (hopefully) and modprobe will fail. Nothing would be printed.
There's the unfortunate case where DMI match can fail (due to incomplete cataloguing of strings) and the legacy probe can also fail (due to it being rubbish) and this can also result in no messages being printed for supported hardware. However, I don't think there's much we can do about that.
Signature · 7 lines
Cheers, Alistair. _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 24 lines · Alistair John Strachan
Hi Jean,
Quoted 13 lines · On Sunday 06 September 2009 13:03:51 Jean Delvare wrote:
drivers/hwmon/abituguru3.c static int __devinit abituguru3_probe(struct platform_device *pdev) · line 957
Quoted 6 lines · Alistair John Strachan
#ifdef
CONFIG_DMIdrivers/hwmon/abituguru3.c +1
-1-if (!abituguru3_motherboards[i].dmi_name) { +if (!abituguru3_motherboards[i].dmi_name[0 ]) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer " This test is no longer as perfect as it used to be. Now that you admit that each ID can correspond to more than one board model, it is possible that the board was _not_ detected using DMI but this message will not show (because another board with this ID is already known.) While this is not a blocker, I still think it would be worth improving.
You're right. I think the message should go in
abituguru3_init()afterabituguru3_detect()(legacy probing) succeeds. Because..Quoted 3 lines
Maybe I am missing something obvious, but why isn't this message printed in
abituguru3_dmi_detect()directly? This would be more efficient and more elegant too IMHO.
Quoted 5 lines
I don't think it would be correct though. I assume we don't want to print anything out if somebody loads the driver on truly unsupported hardware. In this case
abituguru3_dmi_detect()will fail (rightfully) and then the legacy probe method will also fail (hopefully) and modprobe will fail. Nothing would be printed.
You are perfectly correct :) I knew I was overlooking something!
Can you please either update your patch, or send a second, incremental one fixing the problem?
Quoted 4 lines
There's the unfortunate case where DMI match can fail (due to incomplete cataloguing of strings) and the legacy probe can also fail (due to it being rubbish) and this can also result in no messages being printed for supported hardware. However, I don't think there's much we can do about that.
That's right. But that should be rare enough that it doesn't matter, especially when hopefully the affected user would report the lack of functionality so we finally know about the problem.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
(resending because my mail application apparently removed the CC'd addresses.)
On Sun, 2009-09-06 at 14:03 +0200, Jean Delvare wrote:
[snip]
Quoted 18 lines
drivers/hwmon/abituguru3.c static int __devinit abituguru3_probe(struct platform_device *pdev) · line 957
Quoted 11 lines
drivers/hwmon/abituguru3.c +1
-1@@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) "ID: %04X\n", (unsigned int)id);#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { +if (!abituguru3_motherboards[i].dmi_name[0 ]) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer " This test is no longer as perfect as it used to be. Now that you admit that each ID can correspond to more than one board model, it is possible that the board was _not_ detected using DMI but this message will not show (because another board with this ID is already known.) While this is not a blocker, I still think it would be worth improving.
Quoted 3 lines
Maybe I am missing something obvious, but why isn't this message printed in
abituguru3_dmi_detect()directly? This would be more efficient and more elegant too IMHO.
After speaking with Alistair I've been thinking about this as well. Right now, when I'm running a kernel that doesn't support inserting the abituguru3 module without using the "force=1" option (a kernel to which this patch has not been applied), I don't receive a message in my kernel log about sending the output of "dmidecode" - precisely because of what you mention here.
I'm thinking that that same rules that decide whether I get to insert the abituguru3 module into the kernel should decide whether the message about sending the output of "dmidecode" will appear.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Alistair John Strachan
maintainerPATCH 1/1 hwmon: (abituguru3) Support multiple DMI
In reply to Alistair John StrachanMost known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load.
The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs.
This patch replaces the dmi_name string with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune).
References: https://bugs.launchpad.net/bugs/298798
--- drivers/hwmon/abituguru3.c | 77 +++++++++++++++++++++++--------------------- 1 files changed, 40 insertions(+), 37 deletions(-)
drivers/hwmon/abituguru3.c +40 -37
@@ -117,9 +117,12 @@ struct abituguru3_sensor_info {int offset; }; +/* Avoid use of flexible array members */ +#define ABIT_UGURU3_MAX_DMI_NAMES 2 +struct abituguru3_motherboard_info {u16 id; -const char *dmi_name; +const char *dmi_name[ABIT_UGURU3_MAX_DMI_NAMES +1 ];/* + 1 -> end of sensors indicated by a sensor with name = NULL */ struct abituguru3_sensor_info sensors[ABIT_UGURU3_MAX_NO_SENSORS +1 ]; };
@@ -164,7 +167,7 @@ struct abituguru3_data {/* Constants */ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { - {0x000C ,NULL /* Unknown, need DMI string */ , { + {0x000C , {NULL }/* Unknown, need DMI string */ , { {"CPU Core" ,0 ,0 ,10 ,1 ,0 }, {"DDR" ,1 ,0 ,10 ,1 ,0 }, {"DDR VTT" ,2 ,0 ,10 ,1 ,0 },
@@ -186,7 +189,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 35, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000D, NULL /* Abit AW8, need DMI string */, { + { 0x000D, { NULL } /* Abit AW8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -215,7 +218,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000E, NULL /* AL-8, need DMI string */, { + { 0x000E, { NULL } /* AL-8, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -236,7 +239,8 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x000F, NULL /* Unknown, need DMI string */, { + { 0x000F, { NULL } /* Unknown, need DMI string */, { + { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -257,7 +261,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0010, NULL /* Abit NI8 SLI GR, need DMI string */, { + { 0x0010, { NULL } /* Abit NI8 SLI GR, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -279,7 +283,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0011, "AT8 32X", { + { 0x0011, { "AT8 32X", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -306,7 +310,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { + { 0x0012, { NULL } /* Abit AN8 32X, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -328,7 +332,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX1 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0013, NULL /* Abit AW8D, need DMI string */, { + { 0x0013, { NULL } /* Abit AW8D, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -357,7 +361,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX5 Fan", 39, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0014, "AB9", /* + AB9 Pro */ { + { 0x0014, { "AB9", "AB9 Pro", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 10, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -378,7 +382,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "SYS Fan", 34, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0015, NULL /* Unknown, need DMI string */, { + { 0x0015, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR", 1, 0, 20, 1, 0 }, { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -402,7 +406,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0016, "AW9D-MAX", { + { 0x0016, { "AW9D-MAX", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -430,7 +434,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "OTES1 Fan", 38, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0017, NULL /* Unknown, need DMI string */, { + { 0x0017, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -455,7 +459,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0018, "AB9 QuadGT", { + { 0x0018, { "AB9 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -482,7 +486,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0019, "IN9 32X MAX", { + { 0x0019, { "IN9 32X MAX", NULL }, { { "CPU Core", 7, 0, 10, 1, 0 }, { "DDR2", 13, 0, 20, 1, 0 }, { "DDR2 VTT", 14, 0, 10, 1, 0 },
@@ -509,7 +513,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 FAN", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001A, "IP35 Pro", { + { 0x001A, { "IP35 Pro", "IP35 Pro XE", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -537,7 +541,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX4 Fan", 37, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001B, NULL /* Unknown, need DMI string */, { + { 0x001B, { NULL } /* Unknown, need DMI string */, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR3", 1, 0, 20, 1, 0 }, { "DDR3 VTT", 2, 0, 10, 1, 0 },
@@ -564,7 +568,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x001C, "IX38 QuadGT", { + { 0x001C, { "IX38 QuadGT", NULL }, { { "CPU Core", 0, 0, 10, 1, 0 }, { "DDR2", 1, 0, 20, 1, 0 }, { "DDR2 VTT", 2, 0, 10, 1, 0 },
@@ -591,7 +595,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { { "AUX3 Fan", 36, 2, 60, 1, 0 }, { NULL, 0, 0, 0, 0, 0 } } }, - { 0x0000, NULL, { { NULL, 0, 0, 0, 0, 0 } } } + { 0x0000, { NULL }, { { NULL, 0, 0, 0, 0, 0 } } } };
@@ -946,15 +950,6 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) printk(KERN_INFO ABIT_UGURU3_NAME ": found Abit uGuru3, motherboard " "ID: %04X\n", (unsigned int)id); -#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { - printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was " -"not detected using DMI. Please send the output of " -"\"dmidecode\" to the abituguru3 maintainer " - "(see MAINTAINERS)\n"); - } -#endif -/* Fill the sysfs attr array */ sysfs_attr_i =0 ; sysfs_filename = data->sysfs_names;
@@ -1131,6 +1126,7 @@ static int __init abituguru3_dmi_detect(void) {const char *board_vendor, *board_name;int i, err = (force) ?1 : -ENODEV ; +const char *const *dmi_name;size_t sublen; board_vendor =dmi_get_system_info (DMI_BOARD_VENDOR );
@@ -1151,17 +1147,17 @@ static int __init abituguru3_dmi_detect(void) sublen--;for (i =0 ; abituguru3_motherboards[i].id; i++) { -const char *dmi_name = abituguru3_motherboards[i].dmi_name; -if (!dmi_name ||strlen (dmi_name) != sublen) -continue ; -if (!strncasecmp (board_name, dmi_name, sublen)) -break ; + dmi_name = abituguru3_motherboards[i].dmi_name; +for ( ; *dmi_name; dmi_name++) { +if (strlen (*dmi_name) != sublen) +continue ; +if (!strncasecmp (board_name, *dmi_name, sublen)) +return 0 ; + } } -if (!abituguru3_motherboards[i].id) -return 1 ; - - return 0; +/* No match found */ + return 1; }#else /* !CONFIG_DMI */
@@ -1221,6 +1217,13 @@ static int __init abituguru3_init(void) err =abituguru3_detect ();if (err)return err; + +#ifdef CONFIG_DMI + printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was " +"not detected using DMI. Please send the output of " +"\"dmidecode\" to the abituguru3 maintainer " + "(see MAINTAINERS)\n"); +#endif } err =platform_driver_register (&abituguru3_driver);
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Alistair John Strachan
maintainerHi Rune,
(Fixed CCs)
Quoted 23 lines · On Sunday 06 September 2009 15:15:58 Rune Svendsen wrote:
On Sun, 2009-09-06 at 14:03 +0200, Jean Delvare wrote:
[snip]Quoted 16 lines
drivers/hwmon/abituguru3.c static int __devinit abituguru3_probe(struct · line 957
Quoted 9 lines
drivers/hwmon/abituguru3.c +1
-1@@ -947,7 +951,7 @@ static int __devinit abituguru3_probe(struct platform_device *pdev) "ID: %04X\n", (unsigned int)id);#ifdef CONFIG_DMI -if (!abituguru3_motherboards[i].dmi_name) { +if (!abituguru3_motherboards[i].dmi_name[0 ]) { printk(KERN_WARNING ABIT_UGURU3_NAME ": this motherboard was ""not detected using DMI. Please send the output of " "\"dmidecode\" to the abituguru3 maintainer " This test is no longer as perfect as it used to be. Now that you admit that each ID can correspond to more than one board model, it is possible that the board was _not_ detected using DMI but this message will not show (because another board with this ID is already known.) While this is not a blocker, I still think it would be worth improving.
Quoted 3 lines
Maybe I am missing something obvious, but why isn't this message printed in
abituguru3_dmi_detect()directly? This would be more efficient and more elegant too IMHO.
Quoted 6 lines
After speaking with Alistair I've been thinking about this as well. Right now, when I'm running a kernel that doesn't support inserting the abituguru3 module without using the "force=1" option (a kernel to which this patch has not been applied), I don't receive a message in my kernel log about sending the output of "dmidecode" - precisely because of what you mention here.
There's a bit of history associated with the DMI message. Before I added DMI support to the driver the legacy probe method (which doesn't really work at all on IP35 Pro) was used to detect the other 20-or-so supported mainboards. On a lot of the boards in this list, this detection is reliable, and the message I added was a useful helper to get people to send in their DMI info.
Unfortunately your case has fallen through the cracks of obscurity where both DMI was broken (because of a bug) and legacy probing didn't work (because it doesn't work on IP35 Pro). You board appears to the driver to be just like any other unsupported hardware.
You're right that it's suboptimal there are no kernel messages displayed, but consider the distro/script case where driver loading may be attempted automatically on unsupported hardware. In this case it is customary for Linux drivers to reject the modprobe with -ENODEV but *not* print a message. Printing a verbose one about sending DMI info to the uguru maintainer would certainly not be desirable!
So yes, it's not perfect, and maybe we could improve it a la "if it's an Abit board, the message could be printed" but anything you do is really just a heuristic.
Signature · 7 lines
Cheers, Alistair. _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi,
[snip]
Quoted 19 lines
There's a bit of history associated with the DMI message. Before I added DMI support to the driver the legacy probe method (which doesn't really work at all on IP35 Pro) was used to detect the other 20-or-so supported mainboards. On a lot of the boards in this list, this detection is reliable, and the message I added was a useful helper to get people to send in their DMI info.
Unfortunately your case has fallen through the cracks of obscurity where both DMI was broken (because of a bug) and legacy probing didn't work (because it doesn't work on IP35 Pro). You board appears to the driver to be just like any other unsupported hardware.
You're right that it's suboptimal there are no kernel messages displayed, but consider the distro/script case where driver loading may be attempted automatically on unsupported hardware. In this case it is customary for Linux drivers to reject the modprobe with
-ENODEVbut *not* print a message. Printing a verbose one about sending DMI info to the uguru maintainer would certainly not be desirable!
Quoted 4 lines
So yes, it's not perfect, and maybe we could improve it a la "if it's an Abit board, the message could be printed" but anything you do is really just a heuristic.
Ah, ok, I see what the problem is now. I didn't get the message because for all abituguru3 knew, I didn't have an Abit motherboard. That makes sense.
Well the good news would then be that by adding the IP35 Pro XE to pass the DMI string test, there are no more IP35 Pro models left. So if the legacy probing method is only non-functional for IP35 Pro boards, then an Abit board should pass either of the two tests now. (There are still several non-"Pro" "IP35" Abit boards left though: IP35, IP35P, IP35V, IP35-E. But if it _is_ only the "Pro" models that are incompatible with the legacy probing method, this issue should be solved.)
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Jean Delvare
AppliedQuoted 23 lines · Alistair John Strachan
Most known Abit motherboards have unique uguru chip IDs. However, some "refresh" boards keep the same chip ID but have a different DMI string. As our DMI board string matching is (necessarily) strict, some boards were failing DMI detection, and as the old probe method was also failing, the driver would not load.
The only known boards affected by this problem are the IP35 Pro XE (vs IP35 Pro) and the AB9 Pro (vs AB9). Is it not sufficient to relax the match criteria, as some boards (e.g. the AB9 Quad GT) have different uguru chip IDs.
This patch replaces the
dmi_namestring with a NULL terminated array of strings to be matched per uguru chip ID. It has been compile and runtime tested (thanks Rune).References: https://bugs.launchpad.net/bugs/298798
Signed-off-by Alistair John Strachan <[email protected]>Tested-by Rune Svendsen <[email protected]>Cc Rune Svendsen <[email protected]>Cc Hans de Goede <[email protected]>
Quoted 3 lines
--- drivers/hwmon/abituguru3.c | 77 +++++++++++++++++++++++--------------------- 1 files changed, 40 insertions(+), 37 deletions(-)
Applied, thanks.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors