Netdev List
 help / color / mirror / Atom feed
* [PATCH] [net] nvmem: disallow modular CONFIG_NVMEM
@ 2018-04-04 10:38 Arnd Bergmann
  2018-04-04 13:32 ` Mike Looijmans
  2018-04-04 15:48 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2018-04-04 10:38 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Arnd Bergmann, Mike Looijmans, Florian Fainelli, Andrew Lunn,
	David S . Miller, netdev, Greg Kroah-Hartman, Oleksij Rempel,
	Martin Blumenstingl, linux-kernel

The new of_get_nvmem_mac_address() helper function causes a link error
with CONFIG_NVMEM=m:

drivers/of/of_net.o: In function `of_get_nvmem_mac_address':
of_net.c:(.text+0x168): undefined reference to `of_nvmem_cell_get'
of_net.c:(.text+0x19c): undefined reference to `nvmem_cell_read'
of_net.c:(.text+0x1a8): undefined reference to `nvmem_cell_put'

I could not come up with a good solution for this, as the code is always
built-in. Using an #if IS_REACHABLE() check around it would solve the
link time issue but then stop it from working in that configuration.
Making of_nvmem_cell_get() an inline function could also solve that, but
seems a bit ugly since it's somewhat larger than most inline functions,
and it would just bring that problem into the callers.  Splitting the
function into a separate file might be an alternative.

This uses the big hammer by making CONFIG_NVMEM itself a 'bool' symbol,
which avoids the problem entirely but makes the vmlinux larger for anyone
that might use NVMEM support but doesn't need it built-in otherwise.

Fixes: 9217e566bdee ("of_net: Implement of_get_nvmem_mac_address helper")
Cc: Mike Looijmans <mike.looijmans@topic.nl>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
The problem arrived through the networking tree, but it's now in
mainline, so the fix could go through either tree
---
 drivers/nvmem/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index 5f9bc787d634..1090924efdb1 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -1,5 +1,5 @@
 menuconfig NVMEM
-	tristate "NVMEM Support"
+	bool "NVMEM Support"
 	help
 	  Support for NVMEM(Non Volatile Memory) devices like EEPROM, EFUSES...
 
-- 
2.9.0

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

end of thread, other threads:[~2018-04-04 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-04 10:38 [PATCH] [net] nvmem: disallow modular CONFIG_NVMEM Arnd Bergmann
2018-04-04 13:32 ` Mike Looijmans
2018-04-04 13:38   ` Arnd Bergmann
2018-04-04 15:48 ` David Miller

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