Skip to contentSkip to conversation

ne2000: fix unused function warning

PATCH Superseded Arnd Bergmann 2 participants 3 messages Sep 7, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ne2000: fix unused function warning

From: Arnd Bergmann <[email protected]>

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")
---
 drivers/net/ethernet/8390/ne.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/net/ethernet/8390/ne.c +16 -16
index 53660bc8d6ff..1f7525f55994 100644
@@ -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;
Signature · 1 line
2.29.2
#1 lore raw

Hi Arnd,

Thanks for your patch!

Quoted 5 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

Quoted 3 lines

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

What about the second caller inside #ifdef MODULE?

Quoted 52 lines
Fixes 4228c3942821 ("make legacy ISA probe optional")
drivers/net/ethernet/8390/ne.c +16 -17
@@ -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;
--
Quoted 2 lines

2.29.2

--
Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#2 lore raw
Quoted 5 lines · Geert Uytterhoeven
Quoted 3 lines

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