public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: imx: add NVMEM dependency
@ 2017-09-18 20:48 Arnd Bergmann
  2017-09-19 10:53 ` Leonard Crestez
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-09-18 20:48 UTC (permalink / raw)
  To: Zhang Rui, Eduardo Valentin
  Cc: Leonard Crestez, Shawn Guo, Arnd Bergmann, linux-pm, linux-kernel

The driver now fails to link into vmlinux when CONFIG_NVMEM is a loadable
module:

drivers/thermal/imx_thermal.o: In function `imx_thermal_probe':
imx_thermal.c:(.text+0x360): undefined reference to `nvmem_cell_read_u32'
imx_thermal.c:(.text+0x360): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `nvmem_cell_read_u32'
imx_thermal.c:(.text+0x388): undefined reference to `nvmem_cell_read_u32'
imx_thermal.c:(.text+0x388): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `nvmem_cell_read_u32'

This adds a Kconfig dependency to force it to be a module as well
when its dependency is loadable.

Fixes: 7fe5ba04fcdc ("thermal: imx: Add support for reading OCOTP through nvmem")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/thermal/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 07002df4f83a..cb14f1ec5953 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -206,6 +206,7 @@ config HISI_THERMAL
 config IMX_THERMAL
 	tristate "Temperature sensor driver for Freescale i.MX SoCs"
 	depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
+	depends on NVMEM || !NVMEM
 	depends on MFD_SYSCON
 	depends on OF
 	help
-- 
2.9.0

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

* Re: [PATCH] thermal: imx: add NVMEM dependency
  2017-09-18 20:48 [PATCH] thermal: imx: add NVMEM dependency Arnd Bergmann
@ 2017-09-19 10:53 ` Leonard Crestez
  2017-09-19 12:22   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Leonard Crestez @ 2017-09-19 10:53 UTC (permalink / raw)
  To: Arnd Bergmann, Zhang Rui, Eduardo Valentin
  Cc: Shawn Guo, linux-pm, linux-kernel

On Mon, 2017-09-18 at 22:48 +0200, Arnd Bergmann wrote:
> The driver now fails to link into vmlinux when CONFIG_NVMEM is a loadable
> module:
> 
> drivers/thermal/imx_thermal.o: In function `imx_thermal_probe':
> imx_thermal.c:(.text+0x360): undefined reference to
> `nvmem_cell_read_u32'
> imx_thermal.c:(.text+0x360): relocation truncated to fit:
> R_AARCH64_CALL26 against undefined symbol `nvmem_cell_read_u32'
> imx_thermal.c:(.text+0x388): undefined reference to
> `nvmem_cell_read_u32'
> imx_thermal.c:(.text+0x388): relocation truncated to fit:
> R_AARCH64_CALL26 against undefined symbol `nvmem_cell_read_u32'
> 
> This adds a Kconfig dependency to force it to be a module as well
> when its dependency is loadable.

This must be a very strange config with NVMEM=m and IMX_THERMAL=y on
arm64. Still, it makes sense that it should work at least at the
Kconfig level.

> Fixes: 7fe5ba04fcdc ("thermal: imx: Add support for reading OCOTP through nvmem")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>

> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 07002df4f83a..cb14f1ec5953 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -206,6 +206,7 @@ config HISI_THERMAL
>  config IMX_THERMAL
>  	tristate "Temperature sensor driver for Freescale i.MX SoCs"
>  	depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
> +	depends on NVMEM || !NVMEM

The || !NVMEM part is so that it also works when NVMEM=n, right?

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

* Re: [PATCH] thermal: imx: add NVMEM dependency
  2017-09-19 10:53 ` Leonard Crestez
@ 2017-09-19 12:22   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-09-19 12:22 UTC (permalink / raw)
  To: Leonard Crestez
  Cc: Zhang Rui, Eduardo Valentin, Shawn Guo, linux-pm,
	Linux Kernel Mailing List

On Tue, Sep 19, 2017 at 12:53 PM, Leonard Crestez
<leonard.crestez@nxp.com> wrote:
> On Mon, 2017-09-18 at 22:48 +0200, Arnd Bergmann wrote:
>> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
>> index 07002df4f83a..cb14f1ec5953 100644
>> --- a/drivers/thermal/Kconfig
>> +++ b/drivers/thermal/Kconfig
>> @@ -206,6 +206,7 @@ config HISI_THERMAL
>>  config IMX_THERMAL
>>       tristate "Temperature sensor driver for Freescale i.MX SoCs"
>>       depends on (ARCH_MXC && CPU_THERMAL) || COMPILE_TEST
>> +     depends on NVMEM || !NVMEM
>
> The || !NVMEM part is so that it also works when NVMEM=n, right?

Correct, this is a very strange Kconfig expression when you see it the
first time, but we do the same thing in a lot of places that can either
use another subsystem when it is enabled (but have a link-time
dependency), or can work fine without it.

      Arnd

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

end of thread, other threads:[~2017-09-19 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18 20:48 [PATCH] thermal: imx: add NVMEM dependency Arnd Bergmann
2017-09-19 10:53 ` Leonard Crestez
2017-09-19 12:22   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox