Skip to contentSkip to conversation

ahci: imx: fix building without hwmon or thermal

PATCH Applied Arnd Bergmann 3 participants 3 messages Jan 11, 2017 – Jan 15, 2017

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

PATCH 1/1 ahci: imx: fix building without hwmon or thermal

When CONFIG_HWMON is disabled, we now get a link failure:

ERROR: "devm_hwmon_device_register_with_groups" [drivers/ata/ahci_imx.ko] undefined! drivers/ata/ahci_imx.o: In function `imx_ahci_probe':
ahci_imx.c:(.text.imx_ahci_probe+0x304): undefined reference to `devm_thermal_zone_of_sensor_register'

This makes the code calling into the hwmon subsystem compile-time conditional, and adds a Kconfig dependency to avoid the corner case of having HWMON=m and AHCI_IMX=y, by forcing AHCI_IMX=m in this case. The thermal subsystem already has a check in its header, but that also doesn't cover the THERMAL=m case, so we need a somewhat complex Kconfig expression to handle all cases.

Fixes 54643a83b41a ("ahci: imx: Add imx53 SATA temperature sensor support")
---
 drivers/ata/Kconfig    | 1 +
 drivers/ata/ahci_imx.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/ata/Kconfig +1 -0
index 78c002021029..70b57d2229d6 100644
@@ -129,6 +129,7 @@ config AHCI_ST
 config AHCI_IMX
 	tristate "Freescale i.MX AHCI SATA support"
 	depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST)
+	depends on (HWMON && (THERMAL || !THERMAL_OF)) || !HWMON
 	help
 	  This option enables support for the Freescale i.MX SoC's
 	  onboard AHCI SATA.
drivers/ata/ahci_imx.c +2 -1
index 420f065978dc..787567e840bd 100644
@@ -774,7 +774,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (imxpriv->type == AHCI_IMX53) {
+	if (imxpriv->type == AHCI_IMX53 &&
+	    IS_ENABLED(CONFIG_HWMON)) {
 		/* Add the temperature monitor */
 		struct device *hwmon_dev;
 
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 13 lines · Arnd Bergmann

When CONFIG_HWMON is disabled, we now get a link failure:

ERROR: "devm_hwmon_device_register_with_groups" [drivers/ata/ahci_imx.ko] undefined! drivers/ata/ahci_imx.o: In function `imx_ahci_probe':
ahci_imx.c:(.text.imx_ahci_probe+0x304): undefined reference to `devm_thermal_zone_of_sensor_register'

This makes the code calling into the hwmon subsystem compile-time conditional, and adds a Kconfig dependency to avoid the corner case of having HWMON=m and AHCI_IMX=y, by forcing AHCI_IMX=m in this case. The thermal subsystem already has a check in its header, but that also doesn't cover the THERMAL=m case, so we need a somewhat complex Kconfig expression to handle all cases.

Quoted 2 lines
Fixes 54643a83b41a ("ahci: imx: Add imx53 SATA temperature sensor support")

Looks fine to me (I see that this is the same solution as for TOUCHSCREEN_SUN4I from commit 4a6155a46565 but without hard dependency on HWMON).

Thanks for fixing this.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Quoted 30 lines
---
 drivers/ata/Kconfig    | 1 +
 drivers/ata/ahci_imx.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/ata/Kconfig +1 -0
index 78c002021029..70b57d2229d6 100644
@@ -129,6 +129,7 @@ config AHCI_ST
 config AHCI_IMX
 	tristate "Freescale i.MX AHCI SATA support"
 	depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST)
+	depends on (HWMON && (THERMAL || !THERMAL_OF)) || !HWMON
 	help
 	  This option enables support for the Freescale i.MX SoC's
 	  onboard AHCI SATA.
drivers/ata/ahci_imx.c +2 -1
index 420f065978dc..787567e840bd 100644
@@ -774,7 +774,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	if (imxpriv->type == AHCI_IMX53) {
+	if (imxpriv->type == AHCI_IMX53 &&
+	    IS_ENABLED(CONFIG_HWMON)) {
 		/* Add the temperature monitor */
 		struct device *hwmon_dev;
Applied
#2 lore raw
In reply to Arnd Bergmann
Quoted 13 lines · Arnd Bergmann

When CONFIG_HWMON is disabled, we now get a link failure:

ERROR: "devm_hwmon_device_register_with_groups" [drivers/ata/ahci_imx.ko] undefined! drivers/ata/ahci_imx.o: In function `imx_ahci_probe':
ahci_imx.c:(.text.imx_ahci_probe+0x304): undefined reference to `devm_thermal_zone_of_sensor_register'

This makes the code calling into the hwmon subsystem compile-time conditional, and adds a Kconfig dependency to avoid the corner case of having HWMON=m and AHCI_IMX=y, by forcing AHCI_IMX=m in this case. The thermal subsystem already has a check in its header, but that also doesn't cover the THERMAL=m case, so we need a somewhat complex Kconfig expression to handle all cases.

Quoted 2 lines
Fixes 54643a83b41a ("ahci: imx: Add imx53 SATA temperature sensor support")

Applied to libata/for-4.11.

Thanks.

Signature · 1 line
tejun