Skip to content

Commit

Permalink
ne2000: fix unused function warning
Browse files Browse the repository at this point in the history
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: 4228c39 ("make legacy ISA probe optional")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arnd Bergmann authored and David S. Miller committed Sep 8, 2021
1 parent c324f02 commit d7e203f
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions drivers/net/ethernet/8390/ne.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit d7e203f

Please sign in to comment.