diff mbox series

ne2000: fix unused function warning

Message ID 20210907131046.117800-1-arnd@kernel.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series 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: 404 this patch: 686
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning CHECK: Lines should not end with a '(' 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: 523 this patch: 472
netdev/header_inline success Link

Commit Message

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

Geert noticed a warning on MIPS TX49xx:

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

Move the function into the #ifdef section that contains its
only caller.

Fixes: 4228c3942821 ("make legacy ISA probe optional")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/8390/ne.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

Comments

Geert Uytterhoeven Sept. 7, 2021, 1:19 p.m. UTC | #1
Hi Arnd,

Thanks for your patch!

On Tue, Sep 7, 2021 at 3:10 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Geert noticed a warning on MIPS TX49xx:
>
> drivers/net/ethernet/8390/ne.c:909:20: warning: ‘ne_add_devices’ defined but not used [-Wunused-function]

And on Atari.

>
> Move the function into the #ifdef section that contains its
> only caller.

What about the second caller inside #ifdef MODULE?

> Fixes: 4228c3942821 ("make legacy ISA probe optional")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> --- a/drivers/net/ethernet/8390/ne.c
> +++ b/drivers/net/ethernet/8390/ne.c
> @@ -906,22 +906,6 @@ static struct platform_driver ne_driver = {
>         },
>  };
>
> -static void __init ne_add_devices(void)
> -{
> -       int this_dev;
> -       struct platform_device *pdev;
> -
> -       for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
> -               if (pdev_ne[this_dev])
> -                       continue;
> -               pdev = platform_device_register_simple(
> -                       DRV_NAME, this_dev, NULL, 0);
> -               if (IS_ERR(pdev))
> -                       continue;
> -               pdev_ne[this_dev] = pdev;
> -       }
> -}
> -
>  #ifdef MODULE
>  static int __init ne_init(void)
>  {
> @@ -953,6 +937,22 @@ static int __init ne_init(void)
>  module_init(ne_init);
>
>  #ifdef CONFIG_NETDEV_LEGACY_INIT
> +static void __init ne_add_devices(void)
> +{
> +       int this_dev;
> +       struct platform_device *pdev;
> +
> +       for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
> +               if (pdev_ne[this_dev])
> +                       continue;
> +               pdev = platform_device_register_simple(
> +                       DRV_NAME, this_dev, NULL, 0);
> +               if (IS_ERR(pdev))
> +                       continue;
> +               pdev_ne[this_dev] = pdev;
> +       }
> +}
> +
>  struct net_device * __init ne_probe(int unit)
>  {
>         int this_dev;
> --
> 2.29.2
>


--
Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Arnd Bergmann Sept. 7, 2021, 1:30 p.m. UTC | #2
On Tue, Sep 7, 2021 at 3:19 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> > Move the function into the #ifdef section that contains its
> > only caller.
>
> What about the second caller inside #ifdef MODULE?

Indeed, please disregard this patch, I'll send a v2.

        Arnd
diff mbox series

Patch

diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c
index 53660bc8d6ff..1f7525f55994 100644
--- a/drivers/net/ethernet/8390/ne.c
+++ b/drivers/net/ethernet/8390/ne.c
@@ -906,22 +906,6 @@  static struct platform_driver ne_driver = {
 	},
 };
 
-static void __init ne_add_devices(void)
-{
-	int this_dev;
-	struct platform_device *pdev;
-
-	for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
-		if (pdev_ne[this_dev])
-			continue;
-		pdev = platform_device_register_simple(
-			DRV_NAME, this_dev, NULL, 0);
-		if (IS_ERR(pdev))
-			continue;
-		pdev_ne[this_dev] = pdev;
-	}
-}
-
 #ifdef MODULE
 static int __init ne_init(void)
 {
@@ -953,6 +937,22 @@  static int __init ne_init(void)
 module_init(ne_init);
 
 #ifdef CONFIG_NETDEV_LEGACY_INIT
+static void __init ne_add_devices(void)
+{
+	int this_dev;
+	struct platform_device *pdev;
+
+	for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
+		if (pdev_ne[this_dev])
+			continue;
+		pdev = platform_device_register_simple(
+			DRV_NAME, this_dev, NULL, 0);
+		if (IS_ERR(pdev))
+			continue;
+		pdev_ne[this_dev] = pdev;
+	}
+}
+
 struct net_device * __init ne_probe(int unit)
 {
 	int this_dev;