Skip to contentSkip to conversation

hwmon: Only include of_match_table with CONFIG_OF_GPIO

PATCH New Jamie Lentin 2 participants 2 messages Nov 1, 2012 – Nov 2, 2012 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: Only include of_match_table with CONFIG_OF_GPIO

The following fixes build errors on sparc. Without any DT support, of_match_ptr is NULL and the below is a no-op. However, if just CONFIG_OF is defined then so is of_match_ptr.

All useful parts of the gpio-fan DT support rely on CONFIG_OF_GPIO anyway, so of_match_table should too.

---
 drivers/hwmon/gpio-fan.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/gpio-fan.c +2 -0
index 36509ae..1381a2e 100644
@@ -630,7 +630,9 @@ static struct platform_driver gpio_fan_driver = {
 	.driver	= {
 		.name	= "gpio-fan",
 		.pm	= GPIO_FAN_PM,
+#ifdef CONFIG_OF_GPIO
 		.of_match_table = of_match_ptr(of_gpio_fan_match),
+#endif
 	},
 };
 
Signature · 1 line
1.7.10.4
maintainer Applied
#1 lore raw

PATCH 1/1 hwmon: Only include of_match_table with CONFIG_OF_GPIO

Quoted 17 lines · Jamie Lentin

The following fixes build errors on sparc. Without any DT support, of_match_ptr is NULL and the below is a no-op. However, if just CONFIG_OF is defined then so is of_match_ptr.

All useful parts of the gpio-fan DT support rely on CONFIG_OF_GPIO anyway, so of_match_table should too.

---
 drivers/hwmon/gpio-fan.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/gpio-fan.c +0 -0
index 36509ae..1381a2e 100644

drivers/hwmon/gpio-fan.c static struct platform_driver gpio_fan_driver = { · line 636

Quoted 7 lines
drivers/hwmon/gpio-fan.c +2 -0
@@ -630,7 +630,9 @@ static struct platform_driver gpio_fan_driver = {
 	.driver	= {
 		.name	= "gpio-fan",
 		.pm	= GPIO_FAN_PM,
+#ifdef CONFIG_OF_GPIO
 		.of_match_table = of_match_ptr(of_gpio_fan_match),
+#endif
 	},

Applied.

Thanks,
Guenter