]> git.baikalelectronics.ru Git - kernel.git/commit
nvmem: disallow modular CONFIG_NVMEM
authorArnd Bergmann <arnd@arndb.de>
Wed, 4 Apr 2018 10:38:40 +0000 (12:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Apr 2018 15:47:50 +0000 (11:47 -0400)
commit2ecfd879eaf49d05509e935968169bdec1aa787b
treea4b1bc0907afe2398d68f6a22db942dd8983e847
parent53ed62ea21a4697bd6147bf56ed6ddf1ac574357
nvmem: disallow modular CONFIG_NVMEM

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: 9751e6446031 ("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>
Acked-by: Mike Looijmans
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/nvmem/Kconfig