Skip to content

Commit ec693fe

Browse files
Jean DelvareJean Delvare
authored andcommitted
hwmon: (abituguru) Depend on DMI
The abituguru drivers are only built on X86, where DMI support is now enabled by default. So let these drivers depend on DMI, for the following gains: * Robustness and safety. Detection of these devices is weak and uses non-standard methods, it should really be limited to Abit boards unless the user explicitly asks otherwise. * Code simplicity. The code is easier to read without ifdefs. * Better build testing coverage. Now there's only one way to build the drivers, so no risk of build failure on exotic systems. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Alistair John Strachan <alistair@devzero.co.uk> Acked-by: Hans de Goede <hdegoede@redhat.com>
1 parent 5b0380c commit ec693fe

3 files changed

Lines changed: 2 additions & 18 deletions

File tree

‎drivers/hwmon/Kconfig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ comment "Native drivers"
4141

4242
config SENSORS_ABITUGURU
4343
tristate "Abit uGuru (rev 1 & 2)"
44-
depends on X86 && EXPERIMENTAL
44+
depends on X86 && DMI && EXPERIMENTAL
4545
help
4646
If you say yes here you get support for the sensor part of the first
4747
and second revision of the Abit uGuru chip. The voltage and frequency
@@ -56,7 +56,7 @@ config SENSORS_ABITUGURU
5656

5757
config SENSORS_ABITUGURU3
5858
tristate "Abit uGuru (rev 3)"
59-
depends on X86 && EXPERIMENTAL
59+
depends on X86 && DMI && EXPERIMENTAL
6060
help
6161
If you say yes here you get support for the sensor part of the
6262
third revision of the Abit uGuru chip. Only reading the sensors

‎drivers/hwmon/abituguru.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,15 +1448,12 @@ static int __init abituguru_init(void)
14481448
{
14491449
int address, err;
14501450
struct resource res = { .flags = IORESOURCE_IO };
1451-
1452-
#ifdef CONFIG_DMI
14531451
const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
14541452

14551453
/* safety check, refuse to load on non Abit motherboards */
14561454
if (!force && (!board_vendor ||
14571455
strcmp(board_vendor, "http://www.abit.com.tw/")))
14581456
return -ENODEV;
1459-
#endif
14601457

14611458
address = abituguru_detect();
14621459
if (address < 0)

‎drivers/hwmon/abituguru3.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,6 @@ static struct platform_driver abituguru3_driver = {
11191119
.resume = abituguru3_resume
11201120
};
11211121

1122-
#ifdef CONFIG_DMI
1123-
11241122
static int __init abituguru3_dmi_detect(void)
11251123
{
11261124
const char *board_vendor, *board_name;
@@ -1159,15 +1157,6 @@ static int __init abituguru3_dmi_detect(void)
11591157
return 1;
11601158
}
11611159

1162-
#else /* !CONFIG_DMI */
1163-
1164-
static inline int abituguru3_dmi_detect(void)
1165-
{
1166-
return 1;
1167-
}
1168-
1169-
#endif /* CONFIG_DMI */
1170-
11711160
/* FIXME: Manual detection should die eventually; we need to collect stable
11721161
* DMI model names first before we can rely entirely on CONFIG_DMI.
11731162
*/
@@ -1216,10 +1205,8 @@ static int __init abituguru3_init(void)
12161205
if (err)
12171206
return err;
12181207

1219-
#ifdef CONFIG_DMI
12201208
pr_warn("this motherboard was not detected using DMI. "
12211209
"Please send the output of \"dmidecode\" to the abituguru3 maintainer (see MAINTAINERS)\n");
1222-
#endif
12231210
}
12241211

12251212
err = platform_driver_register(&abituguru3_driver);

0 commit comments

Comments
 (0)