]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ne2k: fold drivers/net/Space.c into ne.c
authorArnd Bergmann <arnd@arndb.de>
Wed, 29 Apr 2026 14:55:46 +0000 (16:55 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 1 May 2026 23:46:53 +0000 (16:46 -0700)
drivers/net/Space.c is the last remnant of the linux-2.4.x driver model
that required each subsystem and device driver init function to be called
from init/main.c explicitly, before the introduction of initcall levels.

In linux-7.0, this was only used for a handful of ISA network drivers,
with the ne2000 driver being the last one.

Fold the code into ne.c directly, with minimal changes to preserve
the existing command line parsing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260429145624.2948432-2-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/admin-guide/kernel-parameters.txt
Documentation/arch/m68k/kernel-options.rst
drivers/net/Kconfig
drivers/net/Makefile
drivers/net/Space.c [deleted file]
drivers/net/ethernet/8390/Kconfig
drivers/net/ethernet/8390/ne.c
include/linux/netdevice.h
include/net/Space.h [deleted file]

index 4d0f545fb3ec5a1750d9112a851deb8fd976d32d..7834ee927310ef1a1e064bb96dcd2e64a7874946 100644 (file)
@@ -4266,12 +4266,8 @@ Kernel parameters
 
        n2=             [NET] SDL Inc. RISCom/N2 synchronous serial card
 
-       netdev=         [NET] Network devices parameters
+       netdev=         [NET] NE2000 ISA network devices parameters
                        Format: <irq>,<io>,<mem_start>,<mem_end>,<name>
-                       Note that mem_start is often overloaded to mean
-                       something different and driver-specific.
-                       This usage is only documented in each driver source
-                       file if at all.
 
        netpoll.carrier_timeout=
                        [NET] Specifies amount of time (in seconds) that
index 2008a20b43295bd58eeaef5abaf595c19f99d824..c59e7aaed44ec5b3bd25049c9fc4abe561ea56f0 100644 (file)
@@ -244,23 +244,7 @@ drive (with "root=").
 3) General Device Options (Amiga and Atari)
 ===========================================
 
-3.1) ether=
------------
-
-:Syntax: ether=[<irq>[,<base_addr>[,<mem_start>[,<mem_end>]]]],<dev-name>
-
-<dev-name> is the name of a net driver, as specified in
-drivers/net/Space.c in the Linux source. Most prominent are eth0, ...
-eth3, sl0, ... sl3, ppp0, ..., ppp3, dummy, and lo.
-
-The non-ethernet drivers (sl, ppp, dummy, lo) obviously ignore the
-settings by this options. Also, the existing ethernet drivers for
-Linux/m68k (ariadne, a2065, hydra) don't use them because Zorro boards
-are really Plug-'n-Play, so the "ether=" option is useless altogether
-for Linux/m68k.
-
-
-3.2) hd=
+3.1) hd=
 --------
 
 :Syntax: hd=<cylinders>,<heads>,<sectors>
@@ -273,7 +257,7 @@ itself. It exists just for the case that this fails for one of your
 disks.
 
 
-3.3) max_scsi_luns=
+3.2) max_scsi_luns=
 -------------------
 
 :Syntax: max_scsi_luns=<n>
@@ -284,7 +268,7 @@ be scanned. Valid values for <n> are between 1 and 8. Default is 8 if
 configuration, else 1.
 
 
-3.4) st=
+3.3) st=
 --------
 
 :Syntax: st=<buffer_size>,[<write_thres>,[<max_buffers>]]
@@ -297,7 +281,7 @@ total number of buffers. <max_buffer> limits the total number of
 buffers allocated for all tape devices.
 
 
-3.5) dmasound=
+3.4) dmasound=
 --------------
 
 :Syntax: dmasound=[<buffers>,<buffer-size>[,<catch-radius>]]
index 8ec98f6dfef93e5e1221861f0edaadae2a3542eb..ff79c466712df78a5f4b0a2c1a9b388e2e7edc14 100644 (file)
@@ -630,11 +630,4 @@ config NET_FAILOVER
          a VM with direct attached VF by failing over to the paravirtual
          datapath when the VF is unplugged.
 
-config NETDEV_LEGACY_INIT
-       bool
-       depends on ISA
-       help
-         Drivers that call netdev_boot_setup_check() should select this
-         symbol, everything else no longer needs it.
-
 endif # NETDEVICES
index b87a741fc95213e1176a41b198a5886fd3ba6988..88e4c485d6b2ff6aba20617ad3b5d1a3be1ec9cc 100644 (file)
@@ -21,7 +21,6 @@ obj-$(CONFIG_MACVTAP) += macvtap.o
 obj-$(CONFIG_MII) += mii.o
 obj-$(CONFIG_MDIO) += mdio.o
 obj-$(CONFIG_NET) += loopback.o
-obj-$(CONFIG_NETDEV_LEGACY_INIT) += Space.o
 obj-$(CONFIG_NETCONSOLE) += netconsole.o
 obj-$(CONFIG_NETKIT) += netkit.o
 obj-y += phy/
diff --git a/drivers/net/Space.c b/drivers/net/Space.c
deleted file mode 100644 (file)
index c3ce960..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * INET                An implementation of the TCP/IP protocol suite for the LINUX
- *             operating system.  INET is implemented using the  BSD Socket
- *             interface as the means of communication with the user level.
- *
- *             Holds initial configuration information for devices.
- *
- * Version:    @(#)Space.c     1.0.7   08/12/93
- *
- * Authors:    Ross Biro
- *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
- *             Donald J. Becker, <becker@scyld.com>
- *
- * Changelog:
- *             Stephen Hemminger (09/2003)
- *             - get rid of pre-linked dev list, dynamic device allocation
- *             Paul Gortmaker (03/2002)
- *             - struct init cleanup, enable multiple ISA autoprobes.
- *             Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999
- *             - fix sbni: s/device/net_device/
- *             Paul Gortmaker (06/98):
- *              - sort probes in a sane way, make sure all (safe) probes
- *                get run once & failed autoprobes don't autoprobe again.
- */
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/netlink.h>
-#include <net/Space.h>
-
-/*
- * This structure holds boot-time configured netdevice settings. They
- * are then used in the device probing.
- */
-struct netdev_boot_setup {
-       char name[IFNAMSIZ];
-       struct ifmap map;
-};
-#define NETDEV_BOOT_SETUP_MAX 8
-
-
-/******************************************************************************
- *
- *                   Device Boot-time Settings Routines
- *
- ******************************************************************************/
-
-/* Boot time configuration table */
-static struct netdev_boot_setup dev_boot_setup[NETDEV_BOOT_SETUP_MAX];
-
-/**
- *     netdev_boot_setup_add   - add new setup entry
- *     @name: name of the device
- *     @map: configured settings for the device
- *
- *     Adds new setup entry to the dev_boot_setup list.  The function
- *     returns 0 on error and 1 on success.  This is a generic routine to
- *     all netdevices.
- */
-static int netdev_boot_setup_add(char *name, struct ifmap *map)
-{
-       struct netdev_boot_setup *s;
-       int i;
-
-       s = dev_boot_setup;
-       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
-               if (s[i].name[0] == '\0' || s[i].name[0] == ' ') {
-                       strscpy_pad(s[i].name, name);
-                       memcpy(&s[i].map, map, sizeof(s[i].map));
-                       break;
-               }
-       }
-
-       return i >= NETDEV_BOOT_SETUP_MAX ? 0 : 1;
-}
-
-/**
- * netdev_boot_setup_check     - check boot time settings
- * @dev: the netdevice
- *
- * Check boot time settings for the device.
- * The found settings are set for the device to be used
- * later in the device probing.
- * Returns 0 if no settings found, 1 if they are.
- */
-int netdev_boot_setup_check(struct net_device *dev)
-{
-       struct netdev_boot_setup *s = dev_boot_setup;
-       int i;
-
-       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
-               if (s[i].name[0] != '\0' && s[i].name[0] != ' ' &&
-                   !strcmp(dev->name, s[i].name)) {
-                       dev->irq = s[i].map.irq;
-                       dev->base_addr = s[i].map.base_addr;
-                       dev->mem_start = s[i].map.mem_start;
-                       dev->mem_end = s[i].map.mem_end;
-                       return 1;
-               }
-       }
-       return 0;
-}
-EXPORT_SYMBOL(netdev_boot_setup_check);
-
-/**
- * netdev_boot_base    - get address from boot time settings
- * @prefix: prefix for network device
- * @unit: id for network device
- *
- * Check boot time settings for the base address of device.
- * The found settings are set for the device to be used
- * later in the device probing.
- * Returns 0 if no settings found.
- */
-static unsigned long netdev_boot_base(const char *prefix, int unit)
-{
-       const struct netdev_boot_setup *s = dev_boot_setup;
-       char name[IFNAMSIZ];
-       int i;
-
-       sprintf(name, "%s%d", prefix, unit);
-
-       /*
-        * If device already registered then return base of 1
-        * to indicate not to probe for this interface
-        */
-       if (__dev_get_by_name(&init_net, name))
-               return 1;
-
-       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
-               if (!strcmp(name, s[i].name))
-                       return s[i].map.base_addr;
-       return 0;
-}
-
-/*
- * Saves at boot time configured settings for any netdevice.
- */
-static int __init netdev_boot_setup(char *str)
-{
-       int ints[5];
-       struct ifmap map;
-
-       str = get_options(str, ARRAY_SIZE(ints), ints);
-       if (!str || !*str)
-               return 0;
-
-       /* Save settings */
-       memset(&map, 0, sizeof(map));
-       if (ints[0] > 0)
-               map.irq = ints[1];
-       if (ints[0] > 1)
-               map.base_addr = ints[2];
-       if (ints[0] > 2)
-               map.mem_start = ints[3];
-       if (ints[0] > 3)
-               map.mem_end = ints[4];
-
-       /* Add new entry to the list */
-       return netdev_boot_setup_add(str, &map);
-}
-
-__setup("netdev=", netdev_boot_setup);
-
-static int __init ether_boot_setup(char *str)
-{
-       return netdev_boot_setup(str);
-}
-__setup("ether=", ether_boot_setup);
-
-
-/* A unified ethernet device probe.  This is the easiest way to have every
- * ethernet adaptor have the name "eth[0123...]".
- */
-
-struct devprobe2 {
-       struct net_device *(*probe)(int unit);
-       int status;     /* non-zero if autoprobe has failed */
-};
-
-static int __init probe_list2(int unit, struct devprobe2 *p, int autoprobe)
-{
-       struct net_device *dev;
-
-       for (; p->probe; p++) {
-               if (autoprobe && p->status)
-                       continue;
-               dev = p->probe(unit);
-               if (!IS_ERR(dev))
-                       return 0;
-               if (autoprobe)
-                       p->status = PTR_ERR(dev);
-       }
-       return -ENODEV;
-}
-
-/* ISA probes that touch addresses < 0x400 (including those that also
- * look for EISA/PCI cards in addition to ISA cards).
- */
-static struct devprobe2 isa_probes[] __initdata = {
-#if defined(CONFIG_NE2000) /* ISA (use ne2k-pci for PCI cards) */
-       {ne_probe, 0},
-#endif
-       {NULL, 0},
-};
-
-/* Unified ethernet device probe, segmented per architecture and
- * per bus interface. This drives the legacy devices only for now.
- */
-
-static void __init ethif_probe2(int unit)
-{
-       unsigned long base_addr = netdev_boot_base("eth", unit);
-
-       if (base_addr == 1)
-               return;
-
-       probe_list2(unit, isa_probes, base_addr == 0);
-}
-
-/*  Statically configured drivers -- order matters here. */
-static int __init net_olddevs_init(void)
-{
-       int num;
-
-       for (num = 0; num < 8; ++num)
-               ethif_probe2(num);
-
-       return 0;
-}
-
-device_initcall(net_olddevs_init);
index 5d12a595ab19be727b641d2609aa07c87d6d105f..57d73a7747ec49acc2c2cf9f4b6df9c74a488c9a 100644 (file)
@@ -90,7 +90,6 @@ config MCF8390
 config NE2000
        tristate "NE2000/NE1000 support"
        depends on (ISA || (Q40 && m) || MACH_TX49XX || ATARI_ETHERNEC)
-       select NETDEV_LEGACY_INIT if ISA
        select CRC32
        help
          If you have a network (Ethernet) card of this type, say Y here.
index 961019c32842111999e865fd64e16d31b0b41fa7..1cbd5a4977ceb474cc53028672255b0b6f538248 100644 (file)
@@ -50,7 +50,6 @@ static const char version2[] =
 #include <linux/etherdevice.h>
 #include <linux/jiffies.h>
 #include <linux/platform_device.h>
-#include <net/Space.h>
 
 #include <asm/io.h>
 
@@ -182,7 +181,6 @@ static void ne_block_input(struct net_device *dev, int count,
 static void ne_block_output(struct net_device *dev, const int count,
                const unsigned char *buf, const int start_page);
 
-
 /*  Probe for various non-shared-memory ethercards.
 
    NEx000-clone boards have a Station Address PROM (SAPROM) in the packet
@@ -918,31 +916,47 @@ static void __init ne_add_devices(void)
        }
 }
 
-static int __init ne_init(void)
+/*
+ * This structure holds boot-time configured netdevice settings. They
+ * are then used in the device probing.
+ */
+struct netdev_boot_setup {
+       char name[IFNAMSIZ];
+       struct ifmap map;
+};
+#define NETDEV_BOOT_SETUP_MAX 8
+
+/* Boot time configuration table */
+static struct netdev_boot_setup dev_boot_setup[NETDEV_BOOT_SETUP_MAX];
+
+/**
+ * netdev_boot_setup_check     - check boot time settings
+ * @dev: the netdevice
+ *
+ * Check boot time settings for the device.
+ * The found settings are set for the device to be used
+ * later in the device probing.
+ * Returns 0 if no settings found, 1 if they are.
+ */
+static int netdev_boot_setup_check(struct net_device *dev)
 {
-       int retval;
-
-       if (IS_MODULE(CONFIG_NE2000))
-               ne_add_devices();
-
-       retval = platform_driver_probe(&ne_driver, ne_drv_probe);
+       struct netdev_boot_setup *s = dev_boot_setup;
+       int i;
 
-       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");
-               ne_loop_rm_unreg(1);
-               return retval;
+       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
+               if (s[i].name[0] != '\0' && s[i].name[0] != ' ' &&
+                   !strcmp(dev->name, s[i].name)) {
+                       dev->irq = s[i].map.irq;
+                       dev->base_addr = s[i].map.base_addr;
+                       dev->mem_start = s[i].map.mem_start;
+                       dev->mem_end = s[i].map.mem_end;
+                       return 1;
+               }
        }
-
-       /* Unregister unused platform_devices. */
-       ne_loop_rm_unreg(0);
-       return retval;
+       return 0;
 }
-module_init(ne_init);
 
-#if !defined(MODULE) && defined(CONFIG_NETDEV_LEGACY_INIT)
-struct net_device * __init ne_probe(int unit)
+static struct net_device * __init ne_probe(int unit)
 {
        int this_dev;
        struct net_device *dev;
@@ -982,8 +996,187 @@ struct net_device * __init ne_probe(int unit)
 
        return ERR_PTR(-ENODEV);
 }
+
+/******************************************************************************
+ *
+ *                   Device Boot-time Settings Routines
+ *
+ ******************************************************************************/
+
+/**
+ * netdev_boot_base    - get address from boot time settings
+ * @prefix: prefix for network device
+ * @unit: id for network device
+ *
+ * Check boot time settings for the base address of device.
+ * The found settings are set for the device to be used
+ * later in the device probing.
+ * Returns 0 if no settings found.
+ */
+static unsigned long netdev_boot_base(const char *prefix, int unit)
+{
+       const struct netdev_boot_setup *s = dev_boot_setup;
+       char name[IFNAMSIZ];
+       int i;
+
+       sprintf(name, "%s%d", prefix, unit);
+
+       /*
+        * If device already registered then return base of 1
+        * to indicate not to probe for this interface
+        */
+       if (__dev_get_by_name(&init_net, name))
+               return 1;
+
+       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
+               if (!strcmp(name, s[i].name))
+                       return s[i].map.base_addr;
+       return 0;
+}
+
+#if !defined(MODULE) && defined(CONFIG_ISA)
+/**
+ *     netdev_boot_setup_add   - add new setup entry
+ *     @name: name of the device
+ *     @map: configured settings for the device
+ *
+ *     Adds new setup entry to the dev_boot_setup list.  The function
+ *     returns 0 on error and 1 on success.  This is a generic routine to
+ *     all netdevices.
+ */
+static int netdev_boot_setup_add(char *name, struct ifmap *map)
+{
+       struct netdev_boot_setup *s;
+       int i;
+
+       s = dev_boot_setup;
+       for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++) {
+               if (s[i].name[0] == '\0' || s[i].name[0] == ' ') {
+                       strscpy_pad(s[i].name, name);
+                       memcpy(&s[i].map, map, sizeof(s[i].map));
+                       break;
+               }
+       }
+
+       return i >= NETDEV_BOOT_SETUP_MAX ? 0 : 1;
+}
+
+/*
+ * Saves at boot time configured settings for any netdevice.
+ */
+static int __init netdev_boot_setup(char *str)
+{
+       int ints[5];
+       struct ifmap map;
+
+       str = get_options(str, ARRAY_SIZE(ints), ints);
+       if (!str || !*str)
+               return 0;
+
+       /* Save settings */
+       memset(&map, 0, sizeof(map));
+       if (ints[0] > 0)
+               map.irq = ints[1];
+       if (ints[0] > 1)
+               map.base_addr = ints[2];
+       if (ints[0] > 2)
+               map.mem_start = ints[3];
+       if (ints[0] > 3)
+               map.mem_end = ints[4];
+
+       /* Add new entry to the list */
+       return netdev_boot_setup_add(str, &map);
+}
+
+__setup("netdev=", netdev_boot_setup);
+
+static int __init ether_boot_setup(char *str)
+{
+       return netdev_boot_setup(str);
+}
+__setup("ether=", ether_boot_setup);
 #endif
 
+/* A unified ethernet device probe.  This is the easiest way to have every
+ * ethernet adaptor have the name "eth[0123...]".
+ */
+
+struct devprobe2 {
+       struct net_device *(*probe)(int unit);
+       int status;     /* non-zero if autoprobe has failed */
+};
+
+static int __init probe_list2(int unit, struct devprobe2 *p, int autoprobe)
+{
+       struct net_device *dev;
+
+       for (; p->probe; p++) {
+               if (autoprobe && p->status)
+                       continue;
+               dev = p->probe(unit);
+               if (!IS_ERR(dev))
+                       return 0;
+               if (autoprobe)
+                       p->status = PTR_ERR(dev);
+       }
+       return -ENODEV;
+}
+
+static struct devprobe2 isa_probes[] __initdata = {
+       {ne_probe, 0},
+       {NULL, 0},
+};
+
+/* Unified ethernet device probe, segmented per architecture and
+ * per bus interface. This drives the legacy devices only for now.
+ */
+
+static void __init ethif_probe2(int unit)
+{
+       unsigned long base_addr = netdev_boot_base("eth", unit);
+
+       if (base_addr == 1)
+               return;
+
+       probe_list2(unit, isa_probes, base_addr == 0);
+}
+
+/*  Statically configured drivers -- order matters here. */
+static int __init net_olddevs_init(void)
+{
+       int num;
+
+       for (num = 0; num < 8; ++num)
+               ethif_probe2(num);
+
+       return 0;
+}
+
+static int __init ne_init(void)
+{
+       int retval;
+
+       if (IS_MODULE(CONFIG_NE2000))
+               ne_add_devices();
+       else
+               net_olddevs_init();
+
+       retval = platform_driver_probe(&ne_driver, ne_drv_probe);
+
+       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");
+               ne_loop_rm_unreg(1);
+               return retval;
+       }
+
+       /* Unregister unused platform_devices. */
+       ne_loop_rm_unreg(0);
+       return retval;
+}
+module_init(ne_init);
+
 static void __exit ne_exit(void)
 {
        platform_driver_unregister(&ne_driver);
index 0e1e581efc5ac264259b2f0fdfe41c50a6f47239..744ffa243501c70eb21da28c39af3410f2832dc2 100644 (file)
@@ -3378,7 +3378,6 @@ static inline struct net_device *first_net_device(struct net *net)
                net_device_entry(net->dev_base_head.next);
 }
 
-int netdev_boot_setup_check(struct net_device *dev);
 struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type,
                                   const char *hwaddr);
 struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
diff --git a/include/net/Space.h b/include/net/Space.h
deleted file mode 100644 (file)
index 1b9ab0d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* A unified ethernet device probe.  This is the easiest way to have every
- * ethernet adaptor have the name "eth[0123...]".
- */
-
-struct net_device *ne_probe(int unit);