Browse Source

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>
Jean Delvare 14 years ago
parent
commit
ec693fe528
3 changed files with 2 additions and 18 deletions
  1. 2 2
      drivers/hwmon/Kconfig
  2. 0 3
      drivers/hwmon/abituguru.c
  3. 0 13
      drivers/hwmon/abituguru3.c

+ 2 - 2
drivers/hwmon/Kconfig

@@ -41,7 +41,7 @@ comment "Native drivers"
 
 
 config SENSORS_ABITUGURU
 config SENSORS_ABITUGURU
 	tristate "Abit uGuru (rev 1 & 2)"
 	tristate "Abit uGuru (rev 1 & 2)"
-	depends on X86 && EXPERIMENTAL
+	depends on X86 && DMI && EXPERIMENTAL
 	help
 	help
 	  If you say yes here you get support for the sensor part of the first
 	  If you say yes here you get support for the sensor part of the first
 	  and second revision of the Abit uGuru chip. The voltage and frequency
 	  and second revision of the Abit uGuru chip. The voltage and frequency
@@ -56,7 +56,7 @@ config SENSORS_ABITUGURU
 
 
 config SENSORS_ABITUGURU3
 config SENSORS_ABITUGURU3
 	tristate "Abit uGuru (rev 3)"
 	tristate "Abit uGuru (rev 3)"
-	depends on X86 && EXPERIMENTAL
+	depends on X86 && DMI && EXPERIMENTAL
 	help
 	help
 	  If you say yes here you get support for the sensor part of the
 	  If you say yes here you get support for the sensor part of the
 	  third revision of the Abit uGuru chip. Only reading the sensors
 	  third revision of the Abit uGuru chip. Only reading the sensors

+ 0 - 3
drivers/hwmon/abituguru.c

@@ -1448,15 +1448,12 @@ static int __init abituguru_init(void)
 {
 {
 	int address, err;
 	int address, err;
 	struct resource res = { .flags = IORESOURCE_IO };
 	struct resource res = { .flags = IORESOURCE_IO };
-
-#ifdef CONFIG_DMI
 	const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
 	const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
 
 
 	/* safety check, refuse to load on non Abit motherboards */
 	/* safety check, refuse to load on non Abit motherboards */
 	if (!force && (!board_vendor ||
 	if (!force && (!board_vendor ||
 			strcmp(board_vendor, "http://www.abit.com.tw/")))
 			strcmp(board_vendor, "http://www.abit.com.tw/")))
 		return -ENODEV;
 		return -ENODEV;
-#endif
 
 
 	address = abituguru_detect();
 	address = abituguru_detect();
 	if (address < 0)
 	if (address < 0)

+ 0 - 13
drivers/hwmon/abituguru3.c

@@ -1119,8 +1119,6 @@ static struct platform_driver abituguru3_driver = {
 	.resume = abituguru3_resume
 	.resume = abituguru3_resume
 };
 };
 
 
-#ifdef CONFIG_DMI
-
 static int __init abituguru3_dmi_detect(void)
 static int __init abituguru3_dmi_detect(void)
 {
 {
 	const char *board_vendor, *board_name;
 	const char *board_vendor, *board_name;
@@ -1159,15 +1157,6 @@ static int __init abituguru3_dmi_detect(void)
 	return 1;
 	return 1;
 }
 }
 
 
-#else /* !CONFIG_DMI */
-
-static inline int abituguru3_dmi_detect(void)
-{
-	return 1;
-}
-
-#endif /* CONFIG_DMI */
-
 /* FIXME: Manual detection should die eventually; we need to collect stable
 /* FIXME: Manual detection should die eventually; we need to collect stable
  *        DMI model names first before we can rely entirely on CONFIG_DMI.
  *        DMI model names first before we can rely entirely on CONFIG_DMI.
  */
  */
@@ -1216,10 +1205,8 @@ static int __init abituguru3_init(void)
 		if (err)
 		if (err)
 			return err;
 			return err;
 
 
-#ifdef CONFIG_DMI
 		pr_warn("this motherboard was not detected using DMI. "
 		pr_warn("this motherboard was not detected using DMI. "
 			"Please send the output of \"dmidecode\" to the abituguru3 maintainer (see MAINTAINERS)\n");
 			"Please send the output of \"dmidecode\" to the abituguru3 maintainer (see MAINTAINERS)\n");
-#endif
 	}
 	}
 
 
 	err = platform_driver_register(&abituguru3_driver);
 	err = platform_driver_register(&abituguru3_driver);