Skip to contentSkip to conversation

hwmon: (abituguru) Depend on DMI

PATCH In review Jean Delvare 4 participants 4 messages May 16, 2011 – May 17, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Alistair John Strachan <[email protected]>
Cc Hans de Goede <[email protected]>
---
 drivers/hwmon/Kconfig      |    4 ++--
 drivers/hwmon/abituguru.c  |    3 ---
 drivers/hwmon/abituguru3.c |   13 -------------
 3 files changed, 2 insertions(+), 18 deletions(-)
drivers/hwmon/Kconfig +2 -2
@@ -41,7 +41,7 @@ comment "Native drivers"
 
 config SENSORS_ABITUGURU
 	tristate "Abit uGuru (rev 1 & 2)"
-	depends on X86 && EXPERIMENTAL
+	depends on X86 && DMI && EXPERIMENTAL
 	help
 	  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
@@ -56,7 +56,7 @@ config SENSORS_ABITUGURU
 
 config SENSORS_ABITUGURU3
 	tristate "Abit uGuru (rev 3)"
-	depends on X86 && EXPERIMENTAL
+	depends on X86 && DMI && EXPERIMENTAL
 	help
 	  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
drivers/hwmon/abituguru.c +0 -3
@@ -1448,15 +1448,12 @@ static int __init abituguru_init(void)
 {
 	int address, err;
 	struct resource res = { .flags = IORESOURCE_IO };
-
-#ifdef CONFIG_DMI
 	const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
 
 	/* safety check, refuse to load on non Abit motherboards */
 	if (!force && (!board_vendor ||
 			strcmp(board_vendor, "http://www.abit.com.tw/")))
 		return -ENODEV;
-#endif
 
 	address = abituguru_detect();
 	if (address < 0)
drivers/hwmon/abituguru3.c +0 -13
@@ -1119,8 +1119,6 @@ static struct platform_driver abituguru3
 	.resume = abituguru3_resume
 };
 
-#ifdef CONFIG_DMI
-
 static int __init abituguru3_dmi_detect(void)
 {
 	const char *board_vendor, *board_name;
@@ -1159,15 +1157,6 @@ static int __init abituguru3_dmi_detect(
 	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
  *        DMI model names first before we can rely entirely on CONFIG_DMI.
  */
@@ -1216,10 +1205,8 @@ static int __init abituguru3_init(void)
 		if (err)
 			return err;
 
-#ifdef CONFIG_DMI
 		pr_warn("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);
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jean Delvare

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.

Quoted 3 lines
Cc Alistair John Strachan <[email protected]>
Cc Hans de Goede <[email protected]>

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Jean Delvare
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Jean Delvare

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.

Quoted 5 lines
Quoted 3 lines
Cc Alistair John Strachan <[email protected]>
Cc Hans de Goede <[email protected]>

It's nice to see this actually happen.

Signature · 7 lines
Cheers,
Alistair.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#3 lore raw
In reply to Jean Delvare

Hi,

Seems like a good idea to me:

Regards,

Hans

Quoted 87 lines · Jean Delvare

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.

Cc Alistair John Strachan<[email protected]>
Cc Hans de Goede<[email protected]>
---
  drivers/hwmon/Kconfig      |    4 ++--
  drivers/hwmon/abituguru.c  |    3 ---
  drivers/hwmon/abituguru3.c |   13 -------------
  3 files changed, 2 insertions(+), 18 deletions(-)
drivers/hwmon/Kconfig +2 -2
@@ -41,7 +41,7 @@ comment "Native drivers"
 
  config SENSORS_ABITUGURU
  	tristate "Abit uGuru (rev 1&  2)"
-	depends on X86&&  EXPERIMENTAL
+	depends on X86&&  DMI&&  EXPERIMENTAL
  	help
  	  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
@@ -56,7 +56,7 @@ config SENSORS_ABITUGURU
 
  config SENSORS_ABITUGURU3
  	tristate "Abit uGuru (rev 3)"
-	depends on X86&&  EXPERIMENTAL
+	depends on X86&&  DMI&&  EXPERIMENTAL
  	help
  	  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
drivers/hwmon/abituguru.c +0 -3
@@ -1448,15 +1448,12 @@ static int __init abituguru_init(void)
  {
  	int address, err;
  	struct resource res = { .flags = IORESOURCE_IO };
-
-#ifdef CONFIG_DMI
  	const char *board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
 
  	/* safety check, refuse to load on non Abit motherboards */
  	if (!force&&  (!board_vendor ||
  			strcmp(board_vendor, "http://www.abit.com.tw/")))
  		return -ENODEV;
-#endif
 
  	address = abituguru_detect();
  	if (address<  0)
drivers/hwmon/abituguru3.c +0 -11
@@ -1119,8 +1119,6 @@ static struct platform_driver abituguru3
  	.resume = abituguru3_resume
  };
 
-#ifdef CONFIG_DMI
-
  static int __init abituguru3_dmi_detect(void)
  {
  	const char *board_vendor, *board_name;
@@ -1159,15 +1157,6 @@ static int __init abituguru3_dmi_detect(
  	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
   *        DMI model names first before we can rely entirely on CONFIG_DMI.
   */

drivers/hwmon/abituguru3.c static int __init abituguru3_init(void) · line 1212

Quoted 10 lines
drivers/hwmon/abituguru3.c +0 -2
@@ -1216,10 +1205,8 @@ static int __init abituguru3_init(void)
  		if (err)
  			return err;
 
-#ifdef CONFIG_DMI
  		pr_warn("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