diff mbox series

[v2] ne2000: fix unused function warning

Message ID 20210907134617.185601-1-arnd@kernel.org (mailing list archive)
State Accepted
Commit d7e203ffd3ba5965e88952e7364a42ab32064408
Delegated to: Netdev Maintainers
Headers show
Series [v2] ne2000: fix unused function warning | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 675 this patch: 678
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: 'presuambly' may be misspelled - perhaps 'presumably'? WARNING: drivers/net/ethernet/8390/ne.c is marked as 'obsolete' in the MAINTAINERS hierarchy. No unnecessary modifications please.
netdev/build_allmodconfig_warn fail Errors and warnings before: 425 this patch: 486
netdev/header_inline success Link

Commit Message

Arnd Bergmann Sept. 7, 2021, 1:46 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

Geert noticed a warning on MIPS TX49xx, Atari and presuambly other
platforms when the driver is built-in but NETDEV_LEGACY_INIT is
disabled:

drivers/net/ethernet/8390/ne.c:909:20: warning: ‘ne_add_devices’ defined but not used [-Wunused-function]

Merge the two module init functions into a single one with an
IS_ENABLED() check to replace the incorrect #ifdef.

Fixes: 4228c3942821 ("make legacy ISA probe optional")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: do a larger rework to avoid introducing a different build error
---
 drivers/net/ethernet/8390/ne.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

Comments

Geert Uytterhoeven Sept. 7, 2021, 2:15 p.m. UTC | #1
On Tue, Sep 7, 2021 at 3:46 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Geert noticed a warning on MIPS TX49xx, Atari and presuambly other
> platforms when the driver is built-in but NETDEV_LEGACY_INIT is
> disabled:
>
> drivers/net/ethernet/8390/ne.c:909:20: warning: ‘ne_add_devices’ defined but not used [-Wunused-function]
>
> Merge the two module init functions into a single one with an
> IS_ENABLED() check to replace the incorrect #ifdef.
>
> Fixes: 4228c3942821 ("make legacy ISA probe optional")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: do a larger rework to avoid introducing a different build error

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert
patchwork-bot+netdevbpf@kernel.org Sept. 8, 2021, 10:50 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue,  7 Sep 2021 15:46:10 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Geert noticed a warning on MIPS TX49xx, Atari and presuambly other
> platforms when the driver is built-in but NETDEV_LEGACY_INIT is
> disabled:
> 
> drivers/net/ethernet/8390/ne.c:909:20: warning: ‘ne_add_devices’ defined but not used [-Wunused-function]
> 
> [...]

Here is the summary with links:
  - [v2] ne2000: fix unused function warning
    https://git.kernel.org/netdev/net/c/d7e203ffd3ba

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
index 53660bc8d6ff..9afc712f5948 100644
--- a/drivers/net/ethernet/8390/ne.c
+++ b/drivers/net/ethernet/8390/ne.c
@@ -922,13 +922,16 @@  static void __init ne_add_devices(void)
 	}
 }
 
-#ifdef MODULE
 static int __init ne_init(void)
 {
 	int retval;
-	ne_add_devices();
+
+	if (IS_MODULE(CONFIG_NE2000))
+		ne_add_devices();
+
 	retval = platform_driver_probe(&ne_driver, ne_drv_probe);
-	if (retval) {
+
+	if (IS_MODULE(CONFIG_NE2000) && retval) {
 		if (io[0] == 0)
 			pr_notice("ne.c: You must supply \"io=0xNNN\""
 			       " value(s) for ISA cards.\n");
@@ -941,18 +944,8 @@  static int __init ne_init(void)
 	return retval;
 }
 module_init(ne_init);
-#else /* MODULE */
-static int __init ne_init(void)
-{
-	int retval = platform_driver_probe(&ne_driver, ne_drv_probe);
-
-	/* Unregister unused platform_devices. */
-	ne_loop_rm_unreg(0);
-	return retval;
-}
-module_init(ne_init);
 
-#ifdef CONFIG_NETDEV_LEGACY_INIT
+#if !defined(MODULE) && defined(CONFIG_NETDEV_LEGACY_INIT)
 struct net_device * __init ne_probe(int unit)
 {
 	int this_dev;
@@ -994,7 +987,6 @@  struct net_device * __init ne_probe(int unit)
 	return ERR_PTR(-ENODEV);
 }
 #endif
-#endif /* MODULE */
 
 static void __exit ne_exit(void)
 {