linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ahci: imx: fix building without hwmon or thermal
@ 2017-01-11 13:36 ` Arnd Bergmann
  2017-01-11 14:16   ` Bartlomiej Zolnierkiewicz
  2017-01-15 23:52   ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-01-11 13:36 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Arnd Bergmann, Bartlomiej Zolnierkiewicz, Fabien Lahoudere,
	linux-ide, linux-kernel

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/ata/Kconfig    | 1 +
 drivers/ata/ahci_imx.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 78c002021029..70b57d2229d6 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -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.
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 420f065978dc..787567e840bd 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -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;
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ahci: imx: fix building without hwmon or thermal
  2017-01-11 13:36 ` [PATCH] ahci: imx: fix building without hwmon or thermal Arnd Bergmann
@ 2017-01-11 14:16   ` Bartlomiej Zolnierkiewicz
  2017-01-15 23:52   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-01-11 14:16 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Tejun Heo, Fabien Lahoudere, linux-ide, linux-kernel


Hi,

On Wednesday, January 11, 2017 02:36:16 PM Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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.

Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

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

> ---
>  drivers/ata/Kconfig    | 1 +
>  drivers/ata/ahci_imx.c | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 78c002021029..70b57d2229d6 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -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.
> diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
> index 420f065978dc..787567e840bd 100644
> --- a/drivers/ata/ahci_imx.c
> +++ b/drivers/ata/ahci_imx.c
> @@ -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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ahci: imx: fix building without hwmon or thermal
  2017-01-11 13:36 ` [PATCH] ahci: imx: fix building without hwmon or thermal Arnd Bergmann
  2017-01-11 14:16   ` Bartlomiej Zolnierkiewicz
@ 2017-01-15 23:52   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2017-01-15 23:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bartlomiej Zolnierkiewicz, Fabien Lahoudere, linux-ide, linux-kernel

On Wed, Jan 11, 2017 at 02:36:16PM +0100, Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied to libata/for-4.11.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-15 23:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170111133703epcas4p39c0af66a9642a4904fbecbbac2367b7d@epcas4p3.samsung.com>
2017-01-11 13:36 ` [PATCH] ahci: imx: fix building without hwmon or thermal Arnd Bergmann
2017-01-11 14:16   ` Bartlomiej Zolnierkiewicz
2017-01-15 23:52   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).