Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: smc91x: improve neponset hack

The smc91x driver tries to support multiple platforms at compile
time, but they are mutually exclusive at runtime, and not clearly
defined.

Trying to build for CONFIG_SA1100_ASSABET without CONFIG_ASSABET_NEPONSET
results in this link error:

drivers/built-in.o: In function `smc_drv_probe':
:(.text+0x33310c): undefined reference to `neponset_ncr_frob'

since the neponset_ncr_set function is not defined otherwise.

Similarly, building for both CONFIG_SA1100_ASSABET and CONFIG_SA1100_PLEB
results in a different build error:

smsc/smc91x.c: In function 'smc_drv_probe':
smsc/smc91x.c:2299:2: error: implicit declaration of function 'neponset_ncr_set' [-Werror=implicit-function-declaration]
neponset_ncr_set(NCR_ENET_OSC_EN);
^
smsc/smc91x.c:2299:19: error: 'NCR_ENET_OSC_EN' undeclared (first use in this function)
neponset_ncr_set(NCR_ENET_OSC_EN);
^

This is an attempt to fix the call site responsible for both
errors, making sure we call the function exactly when the driver
is actually trying to run on the assabet/neponset machine. With
this patch, I no longer see randconfig build errors in this file.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
15added6 997d5c3f

+1 -1
+1 -1
drivers/net/ethernet/smsc/smc91x.c
··· 2355 2355 ret = smc_request_attrib(pdev, ndev); 2356 2356 if (ret) 2357 2357 goto out_release_io; 2358 - #if defined(CONFIG_SA1100_ASSABET) 2358 + #if defined(CONFIG_ASSABET_NEPONSET) && !defined(CONFIG_SA1100_PLEB) 2359 2359 neponset_ncr_set(NCR_ENET_OSC_EN); 2360 2360 #endif 2361 2361 platform_set_drvdata(pdev, ndev);