drivers/net/Space.c cleanup
Subsystems (8)
cover drivers/net/Space.c cleanup
From: Arnd Bergmann <[email protected]>
I discovered that there are still a couple of drivers that rely on beiong statically initialized from drivers/net/Space.c the way we did in the last century. As it turns out, there are a couple of simplifications that can be made here, as well as some minor bugfixes.
There are four classes of drivers that use this:
- most 10mbit ISA bus ethernet drivers (and one 100mbit one)
- both ISA localtalk drivers
- several m68k ethernet drivers
- one obsolete WAN driver
I found that the drivers using in arch/m68k/ don't actually benefit from being probed this way as they do not rely on the netdev= command line arguments, they have simply never been changed to work like a modern driver.
I had previously sent a patch to remove the sbni/granch driver, and there were no objections to this patch but forgot to resend it after some discussion about another patch in the same series.
For the ISA drivers, there is usually no way to probe multiple devices at boot time other than the netdev= arguments, so all that logic is left in place for the moment, but centralized in a single file that only gets included in the kernel build if one or more of the drivers are built-in.
I'm also changing the old-style init_module() functions in these drivers to static functions with a module_init() annotation, to more closely resemble modern drivers. There are only a few users of the init_module() interface remaining, and removing that would likely allow some cleanups in the module loader code.
There are a couple of possible follow-ups:
* Most of ISA drivers could be trivially converted to use the module_init() entry point, which would slightly change the command line syntax and still support a single device of that type, but not more than one. We could decide that this is fine, as few users remain that have any of these devices, let alone more than one.
* Alternatively, the fact that the ISA drivers have never been cleaned up can be seen as an indication that there isn't really much remaining interest in them. We could move them to drivers/staging along with the consolidated contents of drivers/net/Space.c and see if anyone still uses them and eventually remove the ones that nobody has. I can see that Paul Gortmaker removed a number of less common ISA ethernet drivers in 2013, but at the time left these because they were possibly still relevant.
* If we end up moving the cops localtalk driver to staging, support for localtalk devices (though probably not appletalk over ethernet) can arguably meet the same fate.
If someone wants to work on those follow-ups or thinks they are a good idea, let me know, otherwise I'd leave it at this cleanup.
Arnd
Arnd Bergmann (13):
[net-next] bcmgenet: remove call to netdev_boot_setup_check [net-next] natsemi: sonic: stop calling netdev_boot_setup_check [net-next] appletalk: ltpc: remove static probing [net-next] 3c509: stop calling netdev_boot_setup_check [net-next] cs89x0: rework driver configuration [net-next] m68k: remove legacy probing
[net-next] move netdev_boot_setup into Space.c [net-next] make legacy ISA probe optional
[net-next] wan: remove stale Kconfig entries [net-next] wan: remove sbni/granch driver
[net-next] wan: hostess_sv11: use module_init/module_exit helpers [net-next] ethernet: isa: convert to module_init/module_exit [net-next] 8390: xsurf100: avoid including lib8390.c
.../admin-guide/kernel-parameters.txt | 2 - drivers/net/Kconfig | 7 + drivers/net/Makefile | 3 +- drivers/net/Space.c | 178 +- drivers/net/appletalk/Kconfig | 4 +- drivers/net/appletalk/ltpc.c | 7 +- drivers/net/ethernet/3com/3c509.c | 3 - drivers/net/ethernet/3com/3c515.c | 3 +- drivers/net/ethernet/3com/Kconfig | 1 + drivers/net/ethernet/8390/Kconfig | 3 + drivers/net/ethernet/8390/Makefile | 2 +- drivers/net/ethernet/8390/apne.c | 11 +- drivers/net/ethernet/8390/ne.c | 5 +- drivers/net/ethernet/8390/smc-ultra.c | 9 +- drivers/net/ethernet/8390/wd.c | 7 +- drivers/net/ethernet/8390/xsurf100.c | 7 +- drivers/net/ethernet/amd/Kconfig | 2 + drivers/net/ethernet/amd/atarilance.c | 11 +- drivers/net/ethernet/amd/lance.c | 6 +- drivers/net/ethernet/amd/mvme147.c | 16 +- drivers/net/ethernet/amd/ni65.c | 6 +- drivers/net/ethernet/amd/sun3lance.c | 19 +- .../net/ethernet/broadcom/genet/bcmgenet.c | 2 - drivers/net/ethernet/cirrus/Kconfig | 27 +- drivers/net/ethernet/cirrus/cs89x0.c | 31 +- drivers/net/ethernet/i825xx/82596.c | 24 +- drivers/net/ethernet/i825xx/sun3_82586.c | 17 +- drivers/net/ethernet/natsemi/jazzsonic.c | 2 - drivers/net/ethernet/natsemi/xtsonic.c | 1 - drivers/net/ethernet/smsc/Kconfig | 1 + drivers/net/ethernet/smsc/smc9194.c | 6 +- drivers/net/wan/Kconfig | 51 - drivers/net/wan/Makefile | 1 - drivers/net/wan/hostess_sv11.c | 6 +- drivers/net/wan/sbni.c | 1638 ----------------- drivers/net/wan/sbni.h | 147 -- include/linux/netdevice.h | 13 - include/net/Space.h | 10 - net/core/dev.c | 125 -- net/ethernet/eth.c | 2 - 40 files changed, 259 insertions(+), 2157 deletions(-) delete mode 100644 drivers/net/wan/sbni.c delete mode 100644 drivers/net/wan/sbni.h
Signature · 20 lines
2.29.2 Cc: Paul Gortmaker <[email protected]> Cc: "Maciej W. Rozycki" <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Doug Berger <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Sam Creasey <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Finn Thain <[email protected]> Cc: Christophe JAILLET <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected]
RFC 1/13 bcmgenet: remove call to netdev_boot_setup_check
From: Arnd Bergmann <[email protected]>
The driver has never used the netdev->{irq,base_addr,mem_start} members, so this call is completely unnecessary.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -2
@@ -3972,8 +3972,6 @@ static int bcmgenet_probe(struct platform_device *pdev)*/ dev->needed_headroom +=64 ; -netdev_boot_setup_check (dev); - priv->dev = dev; priv->pdev = pdev;
Signature · 1 line
2.29.2
RFC 2/13 natsemi: sonic: stop calling netdev_boot_setup_check
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The data from the kernel command line is no longer used since the probe function gets it from the platform device resources instead.
The jazz version was changed to be like this in 2007, the xtensa version apparently copied the code from there.
--- drivers/net/ethernet/natsemi/jazzsonic.c | 2 -- drivers/net/ethernet/natsemi/xtsonic.c | 1 - 2 files changed, 3 deletions(-)
drivers/net/ethernet/natsemi/jazzsonic.c +0 -2
@@ -193,8 +193,6 @@ static int jazz_sonic_probe(struct platform_device *pdev)SET_NETDEV_DEV (dev, &pdev->dev);platform_set_drvdata (pdev, dev); -netdev_boot_setup_check (dev); - dev->base_addr = res->start; dev->irq =platform_get_irq (pdev,0 ); err =sonic_probe1 (dev);
drivers/net/ethernet/natsemi/xtsonic.c +0 -1
@@ -215,7 +215,6 @@ int xtsonic_probe(struct platform_device *pdev) lp->device = &pdev->dev;platform_set_drvdata (pdev, dev);SET_NETDEV_DEV (dev, &pdev->dev); -netdev_boot_setup_check (dev); dev->base_addr = resmem->start; dev->irq = resirq->start;
Signature · 1 line
2.29.2
RFC 3/13 appletalk: ltpc: remove static probing
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
This driver never relies on the netdev_boot_setup_check() to get its configuration, so it can just as well do its own probing all the time.
--- drivers/net/Space.c | 3 --- drivers/net/appletalk/ltpc.c | 7 ++----- include/net/Space.h | 1 - 3 files changed, 2 insertions(+), 9 deletions(-)
drivers/net/Space.c +0 -3
@@ -142,9 +142,6 @@ static int __init net_olddevs_init(void)cops_probe (1 );cops_probe (2 );#endif -#ifdef CONFIG_LTPC -ltpc_probe (); -#endif return 0 ; }
drivers/net/appletalk/ltpc.c +2 -5
@@ -1013,7 +1013,7 @@ static const struct net_device_ops ltpc_netdev = { .ndo_set_rx_mode = set_multicast_list, }; -struct net_device *__init ltpc_probe (void ) +static struct net_device *__init ltpc_probe (void ) {struct net_device *dev;int err = -ENOMEM ;
@@ -1219,12 +1219,10 @@ static int __init ltpc_setup(char *str) }__setup ("ltpc=" , ltpc_setup); -#endif /* MODULE */ +#endif static struct net_device *dev_ltpc; -#ifdef MODULE -MODULE_LICENSE ("GPL" );module_param (debug, int,0 );module_param_hw (io, int, ioport,0 );
@@ -1242,7 +1240,6 @@ static int __init ltpc_module_init(void)return PTR_ERR_OR_ZERO (dev_ltpc); }module_init (ltpc_module_init); -#endif static void __exit ltpc_cleanup(void) {
include/net/Space.h +0 -1
@@ -21,7 +21,6 @@ struct net_device *mvme147lance_probe(int unit);struct net_device *tc515_probe (int unit);struct net_device *lance_probe (int unit);struct net_device *cops_probe (int unit); -struct net_device *ltpc_probe (void );/* Fibre Channel adapters */ int iph5526_probe (struct net_device *dev);
Signature · 1 line
2.29.2
RFC 4/13 3c509: stop calling netdev_boot_setup_check
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
This driver never uses the information returned by netdev_boot_setup_check, and is not called by the boot-time probing from driver/net/Space.c, so just remove these stale references.
--- drivers/net/ethernet/3com/3c509.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/3com/3c509.c +0 -3
@@ -302,7 +302,6 @@ static int el3_isa_match(struct device *pdev, unsigned int ndev)return -ENOMEM ;SET_NETDEV_DEV (dev, pdev); -netdev_boot_setup_check (dev);if (!request_region (ioaddr,EL3_IO_EXTENT ,"3c509-isa" )) {free_netdev (dev);
@@ -421,7 +420,6 @@ static int el3_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id)return -ENOMEM ; }SET_NETDEV_DEV (dev, &pdev->dev); -netdev_boot_setup_check (dev);el3_dev_fill (dev, phys_addr, ioaddr, irq, if_port,EL3_PNP );pnp_set_drvdata (pdev, dev);
@@ -588,7 +586,6 @@ static int el3_eisa_probe(struct device *device) }SET_NETDEV_DEV (dev, device); -netdev_boot_setup_check (dev);el3_dev_fill (dev, phys_addr, ioaddr, irq, if_port,EL3_EISA );eisa_set_drvdata (edev, dev);
Signature · 1 line
2.29.2
RFC 5/13 cs89x0: rework driver configuration
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There are two drivers in the cs89x0 file, with the CONFIG_CS89x0_PLATFORM symbol deciding which one is getting built. This is somewhat confusing and makes it more likely ton configure a driver that works nowhere.
Split up the Kconfig option into separate ISA and PLATFORM drivers, with the ISA symbol explicitly connecting to the static probing in drivers/net/Space.c
The two drivers are still mutually incompatible at compile time, which could be lifted by splitting them into multiple files, but in practice this will make no difference.
The platform driver can now be enabled for compile-testing on non-ARM machines.
--- drivers/net/Space.c | 4 +--- drivers/net/ethernet/cirrus/Kconfig | 26 ++++++++++++++++---------- drivers/net/ethernet/cirrus/cs89x0.c | 24 +++++++++++------------- 3 files changed, 28 insertions(+), 26 deletions(-)
drivers/net/Space.c +1 -3
@@ -77,11 +77,9 @@ static struct devprobe2 isa_probes[] __initdata = { #ifdef CONFIG_SMC9194 {smc_init, 0}, #endif -#ifdef CONFIG_CS89x0 -#ifndef CONFIG_CS89x0_PLATFORM +#ifdef CONFIG_CS89x0_ISA {cs89x0_probe, 0}, #endif -#endif #if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel */ {i82596_probe, 0}, /* I82596 */ #endif
drivers/net/ethernet/cirrus/Kconfig +16 -10
@@ -6,7 +6,7 @@ config NET_VENDOR_CIRRUS bool "Cirrus devices" default y - depends on ISA || EISA || ARM || MAC + depends on ISA || EISA || ARM || MAC || COMPILE_TEST help If you have a network (Ethernet) card belonging to this class, say Y.
@@ -18,9 +18,15 @@ config NET_VENDOR_CIRRUS if NET_VENDOR_CIRRUS config CS89x0 - tristate "CS89x0 support" - depends on ISA || EISA || ARM + tristate + +config CS89x0_ISA + tristate "CS89x0 ISA driver support" + depends on HAS_IOPORT_MAP + depends on ISA depends on !PPC32 + depends on CS89x0_PLATFORM=n + select CS89x0 help Support for CS89x0 chipset based Ethernet cards. If you have a network (Ethernet) card of this type, say Y and read the file
@@ -30,15 +36,15 @@ config CS89x0 will be called cs89x0. config CS89x0_PLATFORM - bool "CS89x0 platform driver support" if HAS_IOPORT_MAP - default !HAS_IOPORT_MAP - depends on CS89x0 + tristate "CS89x0 platform driver support" + depends on ARM || COMPILE_TEST + select CS89x0 help - Say Y to compile the cs89x0 driver as a platform driver. This - makes this driver suitable for use on certain evaluation boards - such as the iMX21ADS. + Say Y to compile the cs89x0 platform driver. This makes this driver + suitable for use on certain evaluation boards such as the iMX21ADS. - If you are unsure, say N. + To compile this driver as a module, choose M here. The module + will be called cs89x0. config EP93XX_ETH tristate "EP93xx Ethernet support"
drivers/net/ethernet/cirrus/cs89x0.c +11 -13
@@ -104,7 +104,7 @@ static char version[] __initdata =* them to system IRQ numbers. This mapping is card specific and is set to * the configuration of the Cirrus Eval board for this chip. */ -#ifndef CONFIG_CS89x0_PLATFORM +#if IS_ENABLED (CONFIG_CS89x0_ISA)static unsigned int netcard_portlist[]__used __initdata = {0x300 ,0x320 ,0x340 ,0x360 ,0x200 ,0x220 ,0x240 , 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0
@@ -292,7 +292,7 @@ write_irq(struct net_device *dev, int chip_type, int irq)int i;if (chip_type ==CS8900 ) { -#ifndef CONFIG_CS89x0_PLATFORM +#if IS_ENABLED (CONFIG_CS89x0_ISA)/* Search the mapping table for the corresponding IRQ pin. */ for (i =0 ; i !=ARRAY_SIZE (cs8900_irq_map); i++)if (cs8900_irq_map[i] == irq)
@@ -859,7 +859,7 @@ net_open(struct net_device *dev) goto bad_out; } }else { -#if !defined(CONFIG_CS89x0_PLATFORM) +#if IS_ENABLED (CONFIG_CS89x0_ISA)if (((1 << dev->irq) & lp->irq_map) ==0 ) {pr_err ("%s: IRQ %d is not in our map of allowable IRQs, which is %x\n" , dev->name, dev->irq, lp->irq_map);
@@ -1523,7 +1523,7 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular) dev->irq = i; }else { i = lp->isa_config &INT_NO_MASK ; -#ifndef CONFIG_CS89x0_PLATFORM +#if IS_ENABLED (CONFIG_CS89x0_ISA)if (lp->chip_type ==CS8900 ) {/* Translate the IRQ using the IRQ mapping table. */ if (i >=ARRAY_SIZE (cs8900_irq_map))
@@ -1576,7 +1576,7 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular)return retval; } -#ifndef CONFIG_CS89x0_PLATFORM +#if IS_ENABLED (CONFIG_CS89x0_ISA)/* * This function converts the I/O port address used by the cs89x0_probe() and * init_module() functions to the I/O memory address used by the
@@ -1682,11 +1682,7 @@ struct net_device * __init cs89x0_probe(int unit)pr_warn ("no cs8900 or cs8920 detected. Be sure to disable PnP with SETUP\n" ); return ERR_PTR(err); } -#endif -#endif - -#if defined(MODULE ) && !defined(CONFIG_CS89x0_PLATFORM) - +#else static struct net_device *dev_cs89x0;/* Support the 'debug' module parm even if we're compiled for non-debug to
@@ -1759,7 +1755,7 @@ MODULE_LICENSE("GPL");int __init init_module (void ) { -struct net_device *dev =alloc_etherdev (sizeof (struct net_local )); +struct net_device *dev;struct net_local *lp;int ret =0 ;
@@ -1768,6 +1764,7 @@ int __init init_module(void)#else debug =0 ;#endif + dev =alloc_etherdev (sizeof (struct net_local ));if (!dev)return -ENOMEM ;
@@ -1838,9 +1835,10 @@ cleanup_module(void)release_region (dev_cs89x0->base_addr,NETCARD_IO_EXTENT );free_netdev (dev_cs89x0); } -#endif /* MODULE && !CONFIG_CS89x0_PLATFORM */ +#endif /* MODULE */ +#endif /* CONFIG_CS89x0_ISA */ -#ifdef CONFIG_CS89x0_PLATFORM +#if IS_ENABLED (CONFIG_CS89x0_PLATFORM)static int __init cs89x0_platform_probe (struct platform_device *pdev) {struct net_device *dev =alloc_etherdev (sizeof (struct net_local ));
Signature · 1 line
2.29.2
RFC 6/13 m68k: remove legacy probing
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There are six m68k specific drivers that use the legacy probe method in drivers/net/Space.c. However, all of these only support a single device, and they completely ignore the command line settings from netdev_boot_setup_check, so there is really no point at all.
Aside from sun3_82586, these already have a module_init function that can be used for built-in mode as well, simply by removing the #ifdef.
Note that the 82596 driver was previously used on ISA as well, but that got dropped long ago.
--- drivers/net/Space.c | 25 +----------------------- drivers/net/ethernet/8390/apne.c | 11 ++--------- drivers/net/ethernet/amd/atarilance.c | 11 ++--------- drivers/net/ethernet/amd/mvme147.c | 16 ++++++--------- drivers/net/ethernet/amd/sun3lance.c | 19 ++++++------------ drivers/net/ethernet/i825xx/82596.c | 24 ++++++----------------- drivers/net/ethernet/i825xx/sun3_82586.c | 17 +++++++--------- include/net/Space.h | 6 ------ 8 files changed, 30 insertions(+), 99 deletions(-)
drivers/net/Space.c +1 -24
@@ -80,34 +80,12 @@ static struct devprobe2 isa_probes[] __initdata = { #ifdef CONFIG_CS89x0_ISA {cs89x0_probe, 0}, #endif -#if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel */ - {i82596_probe, 0}, /* I82596 */ -#endif #ifdef CONFIG_NI65 {ni65_probe, 0}, #endif {NULL, 0}, }; -static struct devprobe2 m68k_probes[] __initdata = { -#ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */ - {atarilance_probe, 0}, -#endif -#ifdef CONFIG_SUN3LANCE /* sun3 onboard Lance chip */ - {sun3lance_probe, 0}, -#endif -#ifdef CONFIG_SUN3_82586 /* sun3 onboard Intel 82586 chip */ - {sun3_82586_probe, 0}, -#endif -#ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */ - {apne_probe, 0}, -#endif -#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ - {mvme147lance_probe, 0}, -#endif - {NULL, 0}, -}; - /* Unified ethernet device probe, segmented per architecture and * per bus interface. This drives the legacy devices only for now. */
@@ -119,8 +97,7 @@ static void __init ethif_probe2(int unit)if (base_addr ==1 )return ; - (void )(probe_list2 (unit, m68k_probes, base_addr ==0 ) && -probe_list2 (unit, isa_probes, base_addr ==0 )); +probe_list2 (unit, isa_probes, base_addr ==0 ); }/* Statically configured drivers -- order matters here. */
drivers/net/ethernet/8390/apne.c +2 -9
@@ -75,7 +75,6 @@#define NESM_STOP_PG 0x80/* Last page +1 of RX ring */ -struct net_device *__init apne_probe (int unit);static int apne_probe1 (struct net_device *dev,int ioaddr);static void apne_reset_8390 (struct net_device *dev);
@@ -120,7 +119,7 @@ static u32 apne_msg_enable;module_param_named (msg_enable, apne_msg_enable, uint,0444 );MODULE_PARM_DESC (msg_enable,"Debug message level (see linux/netdevice.h for bitmap)" ); -struct net_device *__init apne_probe (int unit) +static struct net_device *__init apne_probe (void ) {struct net_device *dev;struct ei_device *ei_local;
@@ -150,10 +149,6 @@ struct net_device * __init apne_probe(int unit) dev =alloc_ei_netdev ();if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - } ei_local =netdev_priv (dev); ei_local->msg_enable = apne_msg_enable;
@@ -554,12 +549,11 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -#ifdef MODULE static struct net_device *apne_dev;static int __init apne_module_init (void ) { - apne_dev =apne_probe (-1 ); + apne_dev =apne_probe ();return PTR_ERR_OR_ZERO (apne_dev); }
@@ -579,7 +573,6 @@ static void __exit apne_module_exit(void) }module_init (apne_module_init);module_exit (apne_module_exit); -#endif static int init_pcmcia (void ) {
drivers/net/ethernet/amd/atarilance.c +2 -9
@@ -367,7 +367,7 @@ static void *slow_memcpy( void *dst, const void *src, size_t len ) } -struct net_device *__init atarilance_probe (int unit) +struct net_device *__init atarilance_probe (void ) {int i;static int found;
@@ -382,10 +382,6 @@ struct net_device * __init atarilance_probe(int unit) dev =alloc_etherdev (sizeof (struct lance_private ));if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - }for ( i =0 ; i <N_LANCE_ADDR ; ++i ) {if (lance_probe1 ( dev, &lance_addr_list[i] )) {
@@ -1137,13 +1133,11 @@ static int lance_set_mac_address( struct net_device *dev, void *addr )return 0 ; } - -#ifdef MODULE static struct net_device *atarilance_dev;static int __init atarilance_module_init (void ) { - atarilance_dev =atarilance_probe (-1 ); + atarilance_dev =atarilance_probe ();return PTR_ERR_OR_ZERO (atarilance_dev); }
@@ -1155,4 +1149,3 @@ static void __exit atarilance_module_exit(void) }module_init (atarilance_module_init);module_exit (atarilance_module_exit); -#endif /* MODULE */
drivers/net/ethernet/amd/mvme147.c +6 -10
@@ -68,7 +68,7 @@ static const struct net_device_ops lance_netdev_ops = { };/* Initialise the one and only on-board 7990 */ -struct net_device *__init mvme147lance_probe (int unit) +static struct net_device *__init mvme147lance_probe (void ) {struct net_device *dev;static int called;
@@ -86,9 +86,6 @@ struct net_device * __init mvme147lance_probe(int unit)if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) -sprintf (dev->name,"eth%d" , unit); -/* Fill the dev fields */ dev->base_addr = (unsigned long )MVME147_LANCE_BASE ; dev->netdev_ops = &lance_netdev_ops;
@@ -179,22 +176,21 @@ static int m147lance_close(struct net_device *dev)return 0 ; } -#ifdef MODULE MODULE_LICENSE ("GPL" );static struct net_device *dev_mvme147_lance; -int __init init_module (void ) +static int __init m147lance_init (void ) { - dev_mvme147_lance =mvme147lance_probe (-1 ); + dev_mvme147_lance =mvme147lance_probe ();return PTR_ERR_OR_ZERO (dev_mvme147_lance); } +module_init (m147lance_init); -void __exit cleanup_module(void) +static void __exit m147lance_exit(void) {struct m147lance_private *lp =netdev_priv (dev_mvme147_lance);unregister_netdev (dev_mvme147_lance);free_pages (lp->ram,3 );free_netdev (dev_mvme147_lance); } - -#endif /* MODULE */ +module_exit (m147lance_exit);
drivers/net/ethernet/amd/sun3lance.c +6 -13
@@ -245,7 +245,7 @@ static void set_multicast_list( struct net_device *dev );/************************* End of Prototypes **************************/ -struct net_device *__init sun3lance_probe (int unit) +static struct net_device *__init sun3lance_probe (void ) {struct net_device *dev;static int found;
@@ -272,10 +272,6 @@ struct net_device * __init sun3lance_probe(int unit) dev =alloc_etherdev (sizeof (struct lance_private ));if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - }if (!lance_probe (dev)) goto out;
@@ -924,17 +920,16 @@ static void set_multicast_list( struct net_device *dev ) } -#ifdef MODULE -static struct net_device *sun3lance_dev; -int __init init_module (void ) +static int __init sun3lance_init (void ) { - sun3lance_dev =sun3lance_probe (-1 ); + sun3lance_dev =sun3lance_probe ();return PTR_ERR_OR_ZERO (sun3lance_dev); } +module_init (sun3lance_init); -void __exit cleanup_module(void) +static void __exit sun3lance_cleanup(void) {unregister_netdev (sun3lance_dev);#ifdef CONFIG_SUN3
@@ -942,6 +937,4 @@ void __exit cleanup_module(void)#endif free_netdev (sun3lance_dev); } - -#endif /* MODULE */ - +module_exit (sun3lance_cleanup);
drivers/net/ethernet/i825xx/82596.c +6 -18
@@ -1110,9 +1110,6 @@ static void print_eth(unsigned char *add, char *str) add, add + 6, add, add[12], add[13], str); } -static int io =0x300 ; -static int irq =10 ; -static const struct net_device_ops i596_netdev_ops = { .ndo_open = i596_open, .ndo_stop = i596_close,
@@ -1123,7 +1120,7 @@ static const struct net_device_ops i596_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -struct net_device *__init i82596_probe (int unit) +static struct net_device *__init i82596_probe (void ) {struct net_device *dev;int i;
@@ -1140,14 +1137,6 @@ struct net_device * __init i82596_probe(int unit)if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - }else { - dev->base_addr = io; - dev->irq = irq; - } -#ifdef ENABLE_MVME16x_NETif (MACH_IS_MVME16x) {if (mvme16x_config & MVME16x_CONFIG_NO_ETHERNET) {
@@ -1515,22 +1504,22 @@ static void set_multicast_list(struct net_device *dev) } } -#ifdef MODULE static struct net_device *dev_82596;static int debug =-1 ;module_param (debug, int,0 );MODULE_PARM_DESC (debug,"i82596 debug mask" ); -int __init init_module (void ) +static int __init i82596_init (void ) {if (debug >=0 ) i596_debug = debug; - dev_82596 =i82596_probe (-1 ); + dev_82596 =i82596_probe ();return PTR_ERR_OR_ZERO (dev_82596); } +module_init (i82596_init); -void __exit cleanup_module(void) +static void __exit i82596_cleanup(void) {unregister_netdev (dev_82596);#ifdef __mc68000__
@@ -1544,5 +1533,4 @@ void __exit cleanup_module(void)free_page ((u32)(dev_82596->mem_start));free_netdev (dev_82596); } - -#endif /* MODULE */ +module_exit (i82596_cleanup);
drivers/net/ethernet/i825xx/sun3_82586.c +7 -10
@@ -29,6 +29,7 @@ static int rfdadd = 0; /* rfdadd=1 may be better for 8K MEM cards */static int fifo=0x8 ;/* don't change */ #include <linux/kernel.h> +#include <linux/module.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/ioport.h>
@@ -276,7 +277,7 @@ static void alloc586(struct net_device *dev)memset ((char *)p->scb,0 ,sizeof (struct scb_struct )); } -struct net_device *__init sun3_82586_probe (int unit) +static int __init sun3_82586_probe (void ) {struct net_device *dev;unsigned long ioaddr;
@@ -291,25 +292,20 @@ struct net_device * __init sun3_82586_probe(int unit)break ;default : -return ERR_PTR (-ENODEV ); +return -ENODEV ; }if (found) -return ERR_PTR (-ENODEV ); +return -ENODEV ; ioaddr = (unsigned long )ioremap (IE_OBIO ,SUN3_82586_TOTAL_SIZE );if (!ioaddr) -return ERR_PTR (-ENOMEM ); +return -ENOMEM ; found =1 ; dev =alloc_etherdev (sizeof (struct priv ));if (!dev) goto out; -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - } - dev->irq =IE_IRQ ; dev->base_addr = ioaddr; err =sun3_82586_probe1 (dev, ioaddr);
@@ -326,8 +322,9 @@ struct net_device * __init sun3_82586_probe(int unit)free_netdev (dev); out:iounmap ((void __iomem *)ioaddr); -return ERR_PTR (err); +return err; } +module_init (sun3_82586_probe);static const struct net_device_ops sun3_82586_netdev_ops = { .ndo_open = sun3_82586_open,
include/net/Space.h +0 -6
@@ -8,16 +8,10 @@ struct net_device *ultra_probe(int unit);struct net_device *wd_probe (int unit);struct net_device *ne_probe (int unit);struct net_device *fmv18x_probe (int unit); -struct net_device *i82596_probe (int unit);struct net_device *ni65_probe (int unit);struct net_device *sonic_probe (int unit);struct net_device *smc_init (int unit); -struct net_device *atarilance_probe (int unit); -struct net_device *sun3lance_probe (int unit); -struct net_device *sun3_82586_probe (int unit); -struct net_device *apne_probe (int unit);struct net_device *cs89x0_probe (int unit); -struct net_device *mvme147lance_probe (int unit);struct net_device *tc515_probe (int unit);struct net_device *lance_probe (int unit);struct net_device *cops_probe (int unit);
Signature · 1 line
2.29.2
RFC 7/13 move netdev_boot_setup into Space.c
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
This is now only used by a handful of old ISA drivers, and can be moved into the file they already all depend on.
--- drivers/net/Space.c | 142 ++++++++++++++++++++++++++++++++++++++ include/linux/netdevice.h | 13 ---- net/core/dev.c | 125 --------------------------------- net/ethernet/eth.c | 2 - 4 files changed, 142 insertions(+), 140 deletions(-)
drivers/net/Space.c +142 -0
@@ -30,6 +30,148 @@#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 ] ==' ' ) { +memset (s[i].name,0 ,sizeof (s[i].name)); +strlcpy (s[i].name, name,IFNAMSIZ ); +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...]". */
include/linux/netdevice.h +0 -13
@@ -295,18 +295,6 @@ enum netdev_state_t { }; -/* -* 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 - -int __init netdev_boot_setup (char *str); -struct gro_list {struct list_head list;int count;
@@ -2917,7 +2905,6 @@ static inline struct net_device *first_net_device_rcu(struct net *net) }int netdev_boot_setup_check (struct net_device *dev); -unsigned long netdev_boot_base (const char *prefix,int unit);struct net_device *dev_getbyhwaddr_rcu (struct net *net,unsigned short type,const char *hwaddr);struct net_device *dev_getfirstbyhwtype (struct net *net,unsigned short type);
net/core/dev.c +0 -125
131 lines not on this page · raw message
net/ethernet/eth.c +0 -2
@@ -62,8 +62,6 @@#include <linux/uaccess.h> #include <net/pkt_sched.h> -__setup ("ether=" , netdev_boot_setup); -/** * eth_header - create the Ethernet header * @skb: buffer to alter
Signature · 1 line
2.29.2
RFC 8/13 make legacy ISA probe optional
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There are very few ISA drivers left that rely on the static probing from drivers/net/Space.o. Make them all select a new CONFIG_NETDEV_LEGACY_INIT symbol, and drop the entire probe logic when that is disabled.
The 9 drivers that are called from Space.c are the same set that calls netdev_boot_setup_check().
--- drivers/net/Kconfig | 7 +++++++ drivers/net/Makefile | 3 ++- drivers/net/appletalk/Kconfig | 4 +++- drivers/net/ethernet/3com/Kconfig | 1 + drivers/net/ethernet/8390/Kconfig | 3 +++ drivers/net/ethernet/8390/ne.c | 2 ++ drivers/net/ethernet/amd/Kconfig | 2 ++ drivers/net/ethernet/cirrus/Kconfig | 1 + drivers/net/ethernet/smsc/Kconfig | 1 + 9 files changed, 22 insertions(+), 2 deletions(-)
drivers/net/Kconfig +7 -0
@@ -603,4 +603,11 @@ 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
drivers/net/Makefile +2 -1
@@ -18,7 +18,8 @@ obj-$(CONFIG_MACVLAN) += macvlan.o obj-$(CONFIG_MACVTAP) += macvtap.o obj-$(CONFIG_MII) += mii.o obj-$(CONFIG_MDIO) += mdio.o -obj-$(CONFIG_NET) += Space.o loopback.o +obj-$(CONFIG_NET) += loopback.o +obj-$(CONFIG_NETDEV_LEGACY_INIT) += Space.o obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-y += phy/ obj-y += mdio/
drivers/net/appletalk/Kconfig +3 -1
@@ -52,7 +52,9 @@ config LTPC config COPS tristate "COPS LocalTalk PC support" - depends on DEV_APPLETALK && (ISA || EISA) + depends on DEV_APPLETALK && ISA + depends on NETDEVICES + select NETDEV_LEGACY_INIT help This allows you to use COPS AppleTalk cards to connect to LocalTalk networks. You also need version 1.3.3 or later of the netatalk
drivers/net/ethernet/3com/Kconfig +1 -0
@@ -34,6 +34,7 @@ config EL3 config 3C515 tristate "3c515 ISA \"Fast EtherLink\"" depends on ISA && ISA_DMA_API && !PPC32 + select NETDEV_LEGACY_INIT help If you have a 3Com ISA EtherLink XL "Corkscrew" 3c515 Fast Ethernet network card, say Y here.
drivers/net/ethernet/8390/Kconfig +3 -0
@@ -102,6 +102,7 @@ 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.
@@ -169,6 +170,7 @@ config STNIC config ULTRA tristate "SMC Ultra support" depends on ISA + select NETDEV_LEGACY_INIT select CRC32 help If you have a network (Ethernet) card of this type, say Y here.
@@ -186,6 +188,7 @@ config ULTRA config WD80x3 tristate "WD80*3 support" depends on ISA + select NETDEV_LEGACY_INIT select CRC32 help If you have a network (Ethernet) card of this type, say Y here.
drivers/net/ethernet/8390/ne.c +2 -0
@@ -951,6 +951,7 @@ static int __init ne_init(void) }module_init (ne_init); +#ifdef CONFIG_NETDEV_LEGACY_INIT struct net_device *__init ne_probe (int unit) {int this_dev;
@@ -991,6 +992,7 @@ struct net_device * __init ne_probe(int unit)return ERR_PTR (-ENODEV ); } +#endif #endif /* MODULE */ static void __exit ne_exit(void)
drivers/net/ethernet/amd/Kconfig +2 -0
@@ -46,6 +46,7 @@ config AMD8111_ETH config LANCE tristate "AMD LANCE and PCnet (AT1500 and NE2100) support" depends on ISA && ISA_DMA_API && !ARM && !PPC32 + select NETDEV_LEGACY_INIT help If you have a network (Ethernet) card of this type, say Y here. Some LinkSys cards are of this type.
@@ -132,6 +133,7 @@ config PCMCIA_NMCLAN config NI65 tristate "NI6510 support" depends on ISA && ISA_DMA_API && !ARM && !PPC32 + select NETDEV_LEGACY_INIT help If you have a network (Ethernet) card of this type, say Y here.
drivers/net/ethernet/cirrus/Kconfig +1 -0
@@ -26,6 +26,7 @@ config CS89x0_ISA depends on ISA depends on !PPC32 depends on CS89x0_PLATFORM=n + select NETDEV_LEGACY_INIT select CS89x0 help Support for CS89x0 chipset based Ethernet cards. If you have a
drivers/net/ethernet/smsc/Kconfig +1 -0
@@ -23,6 +23,7 @@ config SMC9194 tristate "SMC 9194 support" depends on ISA select CRC32 + select NETDEV_LEGACY_INIT help This is support for the SMC9xxx based Ethernet cards. Choose this option if you have a DELL laptop with the docking station, or
Signature · 1 line
2.29.2
RFC 9/13 wan: remove stale Kconfig entries
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The dscc4 driver was removed in 2019 but these Kconfig entries remain, so remove them as well.
--- drivers/net/wan/Kconfig | 24 ------------------------ 1 file changed, 24 deletions(-)
drivers/net/wan/Kconfig +0 -24
@@ -290,30 +290,6 @@ config SLIC_DS26522 To compile this driver as a module, choose M here: the module will be called slic_ds26522. -config DSCC4_PCISYNC - bool "Etinc PCISYNC features" - depends on DSCC4 - help - Due to Etinc's design choice for its PCISYNC cards, some operations - are only allowed on specific ports of the DSCC4. This option is the - only way for the driver to know that it shouldn't return a success - code for these operations. - - Please say Y if your card is an Etinc's PCISYNC. - -config DSCC4_PCI_RST - bool "Hard reset support" - depends on DSCC4 - help - Various DSCC4 bugs forbid any reliable software reset of the ASIC. - As a replacement, some vendors provide a way to assert the PCI #RST - pin of DSCC4 through the GPIO port of the card. If you choose Y, - the driver will make use of this feature before module removal - (i.e. rmmod). The feature is known to be available on Commtech's - cards. Contact your manufacturer for details. - - Say Y if your card supports this feature. - config IXP4XX_HSS tristate "Intel IXP4xx HSS (synchronous serial port) support" depends on HDLC && IXP4XX_NPE && IXP4XX_QMGR
Signature · 1 line
2.29.2
RFC 10/13 wan: remove sbni/granch driver
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The driver was merged in 1999 and has only ever seen treewide cleanups since then, with no indication whatsoever that anyone has actually had access to hardware for testing the patches.
From the information in the link below, it appears that the hardware is for some leased line system in Russia that has since been discontinued, and useless without any remote end to connect to.
As the driver still feels like a Linux-2.2 era artifact today, it appears that the best way forward is to just delete it.
--- .../admin-guide/kernel-parameters.txt | 2 - drivers/net/Space.c | 4 - drivers/net/wan/Kconfig | 27 - drivers/net/wan/Makefile | 1 - drivers/net/wan/sbni.c | 1638 ----------------- drivers/net/wan/sbni.h | 147 -- include/net/Space.h | 3 - 7 files changed, 1822 deletions(-) delete mode 100644 drivers/net/wan/sbni.c delete mode 100644 drivers/net/wan/sbni.h
Documentation/admin-guide/kernel-parameters.txt +0 -2
@@ -4876,8 +4876,6 @@ sa1100ir [NET] See drivers/net/irda/sa1100_ir.c. - sbni= [NET] Granch SBNI12 leased line adapter - sched_verbose [KNL] Enables verbose scheduler debug messages. schedstats= [KNL,X86] Enable or disable scheduled statistics.
drivers/net/Space.c +0 -4
@@ -247,10 +247,6 @@ static int __init net_olddevs_init(void) {int num; -#ifdef CONFIG_SBNI -for (num =0 ; num <8 ; ++num) -sbni_probe (num); -#endif for (num =0 ; num <8 ; ++num)ethif_probe2 (num);
drivers/net/wan/Kconfig +0 -27
@@ -313,33 +313,6 @@ config LAPBETHER To compile this driver as a module, choose M here: the module will be called lapbether. - If unsure, say N. - -config SBNI - tristate "Granch SBNI12 Leased Line adapter support" - depends on X86 - help - Driver for ISA SBNI12-xx cards which are low cost alternatives to - leased line modems. - - You can find more information and last versions of drivers and - utilities at <http://www.granch.ru/>. If you have any question you - can send email to <[email protected]>. - - To compile this driver as a module, choose M here: the - module will be called sbni. - - If unsure, say N. - -config SBNI_MULTILINE - bool "Multiple line feature support" - depends on SBNI - help - Schedule traffic for some parallel lines, via SBNI12 adapters. - - If you have two computers connected with two parallel lines it's - possible to increase transfer rate nearly twice. You should have - a program named 'sbniconfig' to configure adapters. If unsure, say N.
drivers/net/wan/Makefile +0 -1
@@ -22,7 +22,6 @@ obj-$(CONFIG_FARSYNC) += farsync.o obj-$(CONFIG_LANMEDIA) += lmc/ obj-$(CONFIG_LAPBETHER) += lapbether.o -obj-$(CONFIG_SBNI) += sbni.o obj-$(CONFIG_N2) += n2.o obj-$(CONFIG_C101) += c101.o obj-$(CONFIG_WANXL) += wanxl.o
drivers/net/wan/sbni.c deleted +0 -1638
1,638 lines not on this page · raw message
drivers/net/wan/sbni.h deleted +0 -147
147 lines not on this page · raw message
include/net/Space.h +0 -3
@@ -18,6 +18,3 @@ struct net_device *cops_probe(int unit);/* Fibre Channel adapters */ int iph5526_probe (struct net_device *dev); - -/* SBNI adapters */ -int sbni_probe (int unit);
Signature · 1 line
2.29.2
RFC 11/13 wan: hostess_sv11: use module_init/module_exit helpers
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
This is one of very few drivers using the old init_module/cleanup_module function names. Change it over to the modern method.
--- drivers/net/wan/hostess_sv11.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wan/hostess_sv11.c +4 -2
@@ -338,15 +338,17 @@ MODULE_DESCRIPTION("Modular driver for the Comtrol Hostess SV11");static struct z8530_dev *sv11_unit; -int init_module (void ) +static int sv11_module_init (void ) {if ((sv11_unit =sv11_init (io, irq)) ==NULL )return -ENODEV ;return 0 ; } +module_init (sv11_module_init); -void cleanup_module (void ) +static void sv11_module_cleanup (void ) {if (sv11_unit)sv11_shutdown (sv11_unit); } +module_exit (sv11_module_cleanup);
Signature · 1 line
2.29.2
RFC 12/13 ethernet: isa: convert to module_init/module_exit
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
There are a couple of ISA ethernet drivers that use the old init_module/cleanup_module function names for the main entry points, practically nothing else uses those.
Change them to the documented method with module_init() and module_exit() markers next to static functions.
--- drivers/net/ethernet/3com/3c515.c | 3 ++- drivers/net/ethernet/8390/ne.c | 3 ++- drivers/net/ethernet/8390/smc-ultra.c | 9 ++++----- drivers/net/ethernet/8390/wd.c | 7 ++++--- drivers/net/ethernet/amd/lance.c | 6 ++++-- drivers/net/ethernet/amd/ni65.c | 6 ++++-- drivers/net/ethernet/cirrus/cs89x0.c | 7 ++++--- drivers/net/ethernet/smsc/smc9194.c | 6 ++++-- 8 files changed, 28 insertions(+), 19 deletions(-)
drivers/net/ethernet/3com/3c515.c +2 -1
@@ -407,7 +407,7 @@ MODULE_PARM_DESC(max_interrupt_work, "3c515 maximum events handled per interrupt/* we will need locking (and refcounting) if we ever use it for more */ static LIST_HEAD (root_corkscrew_dev); -int init_module (void ) +static int corkscrew_init_module (void ) {int found =0 ;if (debug >=0 )
@@ -416,6 +416,7 @@ int init_module(void) found++; return found ? 0 : -ENODEV; } +module_init (corkscrew_init_module);#else struct net_device *tc515_probe (int unit)
drivers/net/ethernet/8390/ne.c +2 -1
@@ -923,7 +923,7 @@ static void __init ne_add_devices(void) }#ifdef MODULE -int __init init_module (void ) +static int __init ne_init (void ) {int retval;ne_add_devices ();
@@ -940,6 +940,7 @@ int __init init_module(void)ne_loop_rm_unreg (0 ); return retval; } +module_init (ne_init);#else /* MODULE */ static int __init ne_init (void ) {
drivers/net/ethernet/8390/smc-ultra.c +4 -5
@@ -522,7 +522,6 @@ static void ultra_pio_input(struct net_device *dev, int count,/* We know skbuffs are padded to at least word alignment. */ insw (ioaddr +IOPD , buf, (count+1 )>>1 ); } -static void ultra_pio_output (struct net_device *dev,int count,const unsigned char *buf,const int start_page) {
@@ -572,8 +571,7 @@ MODULE_LICENSE("GPL");/* This is set up so that only a single autoprobe takes place per call. ISA device autoprobes on a running machine are not recommended. */ -int __init -init_module (void ) +static int __init ultra_init_module (void ) {struct net_device *dev;int this_dev, found =0 ;
@@ -600,6 +598,7 @@ init_module(void)return 0 ;return -ENXIO ; } +module_init (ultra_init_module);static void cleanup_card (struct net_device *dev) {
@@ -613,8 +612,7 @@ static void cleanup_card(struct net_device *dev)iounmap (ei_status.mem); } -void __exit -cleanup_module (void ) +static void __exit ultra_cleanup_module(void) {int this_dev;
@@ -627,4 +625,5 @@ cleanup_module(void) } } } +module_exit (ultra_cleanup_module);#endif /* MODULE */
drivers/net/ethernet/8390/wd.c +4 -3
@@ -519,7 +519,7 @@ MODULE_LICENSE("GPL");/* This is set up so that only a single autoprobe takes place per call. ISA device autoprobes on a running machine are not recommended. */ -int __init init_module (void ) +static int __init wd_init_module (void ) {struct net_device *dev;int this_dev, found =0 ;
@@ -548,6 +548,7 @@ int __init init_module(void)return 0 ;return -ENXIO ; } +module_init (wd_init_module);static void cleanup_card (struct net_device *dev) {
@@ -556,8 +557,7 @@ static void cleanup_card(struct net_device *dev)iounmap (ei_status.mem); } -void __exit -cleanup_module (void ) +static void __exit wd_cleanup_module(void) {int this_dev;
@@ -570,4 +570,5 @@ cleanup_module(void) } } } +module_exit (wd_cleanup_module);#endif /* MODULE */
drivers/net/ethernet/amd/lance.c +4 -2
@@ -327,7 +327,7 @@ MODULE_PARM_DESC(dma, "LANCE/PCnet ISA DMA channel (ignored for some devices)");MODULE_PARM_DESC (irq,"LANCE/PCnet IRQ number (ignored for some devices)" );MODULE_PARM_DESC (lance_debug,"LANCE/PCnet debug level (0-7)" ); -int __init init_module (void ) +static int __init lance_init_module (void ) {struct net_device *dev;int this_dev, found =0 ;
@@ -356,6 +356,7 @@ int __init init_module(void)return 0 ;return -ENXIO ; } +module_init (lance_init_module);static void cleanup_card (struct net_device *dev) {
@@ -368,7 +369,7 @@ static void cleanup_card(struct net_device *dev)kfree (lp); } -void __exit cleanup_module(void) +static void __exit lance_cleanup_module(void) {int this_dev;
@@ -381,6 +382,7 @@ void __exit cleanup_module(void) } } } +module_exit (lance_cleanup_module);#endif /* MODULE */ MODULE_LICENSE ("GPL" );
drivers/net/ethernet/amd/ni65.c +4 -2
@@ -1230,18 +1230,20 @@ MODULE_PARM_DESC(irq, "ni6510 IRQ number (ignored for some cards)");MODULE_PARM_DESC (io,"ni6510 I/O base address" );MODULE_PARM_DESC (dma,"ni6510 ISA DMA channel (ignored for some cards)" ); -int __init init_module (void ) +static int __init ni65_init_module (void ) { dev_ni65 =ni65_probe (-1 );return PTR_ERR_OR_ZERO (dev_ni65); } +module_init (ni65_init_module); -void __exit cleanup_module(void) +static void __exit ni65_cleanup_module(void) {unregister_netdev (dev_ni65);cleanup_card (dev_ni65);free_netdev (dev_ni65); } +module_exit (ni65_cleanup_module);#endif /* MODULE */ MODULE_LICENSE ("GPL" );
drivers/net/ethernet/cirrus/cs89x0.c +4 -3
@@ -1753,7 +1753,7 @@ MODULE_LICENSE("GPL");* (hw or software util) */ -int __init init_module (void ) +static int __init cs89x0_isa_init_module (void ) {struct net_device *dev;struct net_local *lp;
@@ -1823,9 +1823,9 @@ int __init init_module(void)free_netdev (dev);return ret; } +module_init (cs89x0_isa_init_module); -void __exit -cleanup_module (void ) +static void __exit cs89x0_isa_cleanup_module(void) {struct net_local *lp =netdev_priv (dev_cs89x0);
@@ -1835,6 +1835,7 @@ cleanup_module(void)release_region (dev_cs89x0->base_addr,NETCARD_IO_EXTENT );free_netdev (dev_cs89x0); } +module_exit (cs89x0_isa_cleanup_module);#endif /* MODULE */ #endif /* CONFIG_CS89x0_ISA */
drivers/net/ethernet/smsc/smc9194.c +4 -2
@@ -1508,7 +1508,7 @@ MODULE_PARM_DESC(io, "SMC 99194 I/O base address");MODULE_PARM_DESC (irq,"SMC 99194 IRQ number" );MODULE_PARM_DESC (ifport,"SMC 99194 interface port (0-default, 1-TP, 2-AUI)" ); -int __init init_module (void ) +static int __init smc_init_module (void ) {if (io ==0 ) printk(KERN_WARNING
@@ -1518,13 +1518,15 @@ int __init init_module(void) devSMC9194 =smc_init (-1 );return PTR_ERR_OR_ZERO (devSMC9194); } +module_init (smc_init_module); -void __exit cleanup_module(void) +static void __exit smc_cleanup_module(void) {unregister_netdev (devSMC9194);free_irq (devSMC9194->irq, devSMC9194);release_region (devSMC9194->base_addr,SMC_IO_EXTENT );free_netdev (devSMC9194); } +module_exit (smc_cleanup_module);#endif /* MODULE */
Signature · 1 line
2.29.2
RFC 13/13 8390: xsurf100: avoid including lib8390.c
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
This driver always warns about unused functions because it includes an file that it doesn't actually need:
In file included from drivers/net/ethernet/8390/xsurf100.c:48:drivers/net/ethernet/8390/lib8390.c:995:27: error: '____alloc_ei_netdev' defined but not used [-Werror=unused-function]
995 | static struct net_device *____alloc_ei_netdev(int size)
| ^~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/8390/lib8390.c:957:13: error: '__ei_set_multicast_list' defined but not used [-Werror=unused-function]
957 | static void __ei_set_multicast_list(struct net_device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/8390/lib8390.c:857:33: error: '__ei_get_stats' defined but not used [-Werror=unused-function]
857 | static struct net_device_stats *__ei_get_stats(struct net_device *dev)
| ^~~~~~~~~~~~~~
drivers/net/ethernet/8390/lib8390.c:512:13: error: '__ei_poll' defined but not used [-Werror=unused-function]
512 | static void __ei_poll(struct net_device *dev)
| ^~~~~~~~~
drivers/net/ethernet/8390/lib8390.c:303:20: error: '__ei_start_xmit' defined but not used [-Werror=unused-function]
303 | static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
| ^~~~~~~~~~~~~~~
drivers/net/ethernet/8390/lib8390.c:257:13: error: '__ei_tx_timeout' defined but not used [-Werror=unused-function]
257 | static void __ei_tx_timeout(struct net_device *dev, unsigned int txqueue)
| ^~~~~~~~~~~~~~~
drivers/net/ethernet/8390/lib8390.c:233:12: error: '__ei_close' defined but not used [-Werror=unused-function]
233 | static int __ei_close(struct net_device *dev)
| ^~~~~~~~~~
drivers/net/ethernet/8390/lib8390.c:204:12: error: '__ei_open' defined but not used [-Werror=unused-function]
204 | static int __ei_open(struct net_device *dev)
| ^~~~~~~~~Use the normal library module instead and call the NS8390p_init() function.
--- drivers/net/ethernet/8390/Makefile | 2 +- drivers/net/ethernet/8390/xsurf100.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/8390/Makefile +1 -1
@@ -16,5 +16,5 @@ obj-$(CONFIG_PCMCIA_PCNET) += pcnet_cs.o 8390.o obj-$(CONFIG_STNIC) += stnic.o 8390.o obj-$(CONFIG_ULTRA) += smc-ultra.o 8390.o obj-$(CONFIG_WD80x3) += wd.o 8390.o -obj-$(CONFIG_XSURF100) += xsurf100.o +obj-$(CONFIG_XSURF100) += xsurf100.o 8390.o obj-$(CONFIG_ZORRO8390) += zorro8390.o
drivers/net/ethernet/8390/xsurf100.c +2 -5
@@ -42,10 +42,7 @@/* Ensure we have our RCR base value */ #define AX88796_PLATFORM -static unsigned char version[] = -"ax88796.c: Copyright 2005,2007 Simtec Electronics\n" ; - -#include "lib8390.c" +#include "8390.h" /* from ne.c */ #define NE_CMD EI_SHIFT(0x00)
@@ -232,7 +229,7 @@ static void xs100_block_output(struct net_device *dev, int count,if (jiffies - dma_start >2 *HZ /100 ) {/* 20ms */ netdev_warn (dev,"timeout waiting for Tx RDC.\n" ); ei_local->reset_8390 (dev); -ax_NS8390_init (dev,1 ); +NS8390p_init (dev,1 );break ; } }
Signature · 1 line
2.29.2
Re: [RFC 01/13] [net-next] bcmgenet: remove call to netdev_boot_setup_check
In reply to Arnd BergmannQuoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The driver has never used the netdev->{irq,base_addr,mem_start} members, so this call is completely unnecessary.
Signed-off-by Arnd Bergmann <[email protected]>
Signature · 1 line
Florian
Maciej W. Rozycki
maintainerQuoted 4 lines · Arnd Bergmann
For the ISA drivers, there is usually no way to probe multiple devices at boot time other than the netdev= arguments, so all that logic is left in place for the moment, but centralized in a single file that only gets included in the kernel build if one or more of the drivers are built-in.
As I recall at least some ISA drivers did probe multiple interfaces in
their monolithic configuration; I used a configuration with as many as five ne2k clones for a bridge machine for a fairly large network (~300 machines) and as I recall it required no command-line parameters (but then it was some 25 years ago, so I may well not remember correctly anymore). It may have been with ISA PnP though (damn!).
For modular drivers it was deemed too dangerous, for obvious reasons, and
explicit parameters were the only way.
Quoted 11 lines
* Most of ISA drivers could be trivially converted to use the
module_init()entry point, which would slightly change the command line syntax and still support a single device of that type, but not more than one. We could decide that this is fine, as few users remain that have any of these devices, let alone more than one.* Alternatively, the fact that the ISA drivers have never been cleaned up can be seen as an indication that there isn't really much remaining interest in them. We could move them to
drivers/stagingalong with the consolidated contents ofdrivers/net/Space.cand see if anyone still uses them and eventually remove the ones that nobody has.
I have a 3c509b interface in active use (although in the EISA mode, so no
need for weird probing, but it can be reconfigured), and I have an ne2k clone in storage, so I could do some run-time verification if there is no one else available. I'll see if I can do some driver polishing for these devices, but given the number of other tasks on my table this is somewhat low priority for me.
Maciej
Re: [RFC 13/13] [net-next] 8390: xsurf100: avoid including lib8390.c
In reply to Arnd BergmannQuoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
This driver always warns about unused functions because it includes an file that it doesn't actually need:
I don't think you can omit #include "lib8390.c" here without changing driver behaviour, because of the macros in effect.
I think this change would need some actual testing unless you can show that the module binary does not change.
Re: [RFC 13/13] [net-next] 8390: xsurf100: avoid including lib8390.c
Quoted 11 lines · Finn Thain
Quoted 4 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
This driver always warns about unused functions because it includes an file that it doesn't actually need:
I don't think you can omit #include "
lib8390.c" here without changing driver behaviour, because of the macros in effect.I think this change would need some actual testing unless you can show that the module binary does not change.
Michael posted a similar but different patch a while ago, involving calling ax_NS8390_reinit():
https://lore.kernel.org/linux-m68k/[email protected]/
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
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
Quoted 15 lines · Maciej W. Rozycki
Quoted 4 lines · Arnd Bergmann
For the ISA drivers, there is usually no way to probe multiple devices at boot time other than the netdev= arguments, so all that logic is left in place for the moment, but centralized in a single file that only gets included in the kernel build if one or more of the drivers are built-in.
As I recall at least some ISA drivers did probe multiple interfaces in
their monolithic configuration; I used a configuration with as many as five ne2k clones for a bridge machine for a fairly large network (~300 machines) and as I recall it required no command-line parameters (but then it was some 25 years ago, so I may well not remember correctly anymore). It may have been with ISA PnP though (damn!).
Quoted 2 lines
For modular drivers it was deemed too dangerous, for obvious reasons, and
explicit parameters were the only way.
I did use two ne2k compatible pre-PnP cards in a router, by loading two copies of the same driver module, and I'm fairly sure that would still work, but it's obviously not how it was meant to be used. ;-)
To clarify: the code drivers/net/Space.c logic can probe these drivers both with and without explicit configuration. Using the netdev= arguments will result in reliable assignment of device names and prevent drivers from poking ports that may be used by other devices, but drivers can also implement their own device detection, in case of drivers/net/ethernet/8390/ne.c, it can find devices at up to six addresses:
static unsigned int netcard_portlist[] __initdata = {
0x300, 0x280, 0x320, 0x340, 0x360, 0x380, 0
};Quoted 6 lines
Quoted 6 lines
* Most of ISA drivers could be trivially converted to use the
module_init()entry point, which would slightly change the command line syntax and still support a single device of that type, but not more than one. We could decide that this is fine, as few users remain that have any of these devices, let alone more than one.
Quoted 8 lines
Quoted 5 lines
* Alternatively, the fact that the ISA drivers have never been cleaned up can be seen as an indication that there isn't really much remaining interest in them. We could move them to
drivers/stagingalong with the consolidated contents ofdrivers/net/Space.cand see if anyone still uses them and eventually remove the ones that nobody has.I have a 3c509b interface in active use (although in the EISA mode, so no
need for weird probing, but it can be reconfigured),
The 3c509 driver already doesn't use the drivers/net/Space.c probing, Marc Zyngier addressed this when he added EISA support in 2003. It also supports multiple non-PnP cards with module parameters as well as pre-standard jumperless autoconfiguration. My only change to this driver was to remove a few lines of dead code that I guess Marc missed at the time.
I probably should have listed the drivers that still use Space.c after my series. Here is the list I'm talking about:
3com:
3c515/corkscrew: supports PnP mode, ignores command line and
module parameters but scans for devices on all ports
8390:
wd80x3: supports module parameters up to four cards, no PnP
smc-ultra: supports up to four devices with module parameters, plus PnP ne2k/iosa: supports up to four devices with module parameters, plus PnP
amd
lance: supports up to eight devices with module parameters, no PnP
ni65: supports only one device as loadable module, no PnP
smsc
smc9194: supports only one device as loadable module, no PnP
cirrus
cs89x0 (supports only one device as loadable module, plus custom
PnP-like probing in built-in mode)
Quoted 4 lines
and I have an ne2k clone in storage, so I could do some run-time verification if there is no one else available. I'll see if I can do some driver polishing for these devices, but given the number of other tasks on my table this is somewhat low priority for me.
I don't think it's necessary to validate the changes I did to the ne2k driver specifically, though it might be nice to see that I didn't break the overall logic in Space.c.
Arnd
Re: [RFC 13/13] [net-next] 8390: xsurf100: avoid including lib8390.c
In reply to Geert UytterhoevenQuoted 11 lines · Geert Uytterhoeven
Quoted 9 lines · Finn Thain
Quoted 4 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
This driver always warns about unused functions because it includes an file that it doesn't actually need:
I don't think you can omit #include "
lib8390.c" here without changing driver behaviour, because of the macros in effect.
Quoted 6 lines
Quoted 2 lines
I think this change would need some actual testing unless you can show that the module binary does not change.
Michael posted a similar but different patch a while ago, involving calling
ax_NS8390_reinit():
https://lore.kernel.org/linux-m68k/[email protected]/
Ah nice. As far as I can tell, the two versions are functionally equivalent based on my reading of the port accessors, but he probably tested his version, so I'll drop mine from this series. Nothing else depends on this one, I just included it since it was an obvious thing to fix.
Arnd
Re: [RFC 06/13] [net-next] m68k: remove legacy probing
In reply to Arnd BergmannHi Arnd,
CC linux-m68k
Quoted 7 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
There are six m68k specific drivers that use the legacy probe method in
drivers/net/Space.c. However, all of these only support a single device, and they completely ignore the command line settings fromnetdev_boot_setup_check, so there is really no point at all.
Quoted 7 lines
Aside from
sun3_82586, these already have amodule_initfunction that can be used for built-in mode as well, simply by removing the #ifdef.Note that the 82596 driver was previously used on ISA as well, but that got dropped long ago.
Signed-off-by Arnd Bergmann <[email protected]>
Looks all good to me, so
but I don't have any of the hardware to test.
Quoted 407 lines
--- drivers/net/Space.c | 25 +----------------------- drivers/net/ethernet/8390/apne.c | 11 ++--------- drivers/net/ethernet/amd/atarilance.c | 11 ++--------- drivers/net/ethernet/amd/mvme147.c | 16 ++++++--------- drivers/net/ethernet/amd/sun3lance.c | 19 ++++++------------ drivers/net/ethernet/i825xx/82596.c | 24 ++++++----------------- drivers/net/ethernet/i825xx/sun3_82586.c | 17 +++++++--------- include/net/Space.h | 6 ------ 8 files changed, 30 insertions(+), 99 deletions(-)drivers/net/Space.c +1
-24@@ -80,34 +80,12 @@ static struct devprobe2 isa_probes[] __initdata = { #ifdef CONFIG_CS89x0_ISA {cs89x0_probe, 0}, #endif -#if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel */ - {i82596_probe, 0}, /* I82596 */ -#endif #ifdef CONFIG_NI65 {ni65_probe, 0}, #endif {NULL, 0}, }; -static struct devprobe2 m68k_probes[] __initdata = { -#ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */ - {atarilance_probe, 0}, -#endif -#ifdef CONFIG_SUN3LANCE /* sun3 onboard Lance chip */ - {sun3lance_probe, 0}, -#endif -#ifdef CONFIG_SUN3_82586 /* sun3 onboard Intel 82586 chip */ - {sun3_82586_probe, 0}, -#endif -#ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */ - {apne_probe, 0}, -#endif -#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ - {mvme147lance_probe, 0}, -#endif - {NULL, 0}, -}; - /* Unified ethernet device probe, segmented per architecture and * per bus interface. This drives the legacy devices only for now. */@@ -119,8 +97,7 @@ static void __init ethif_probe2(int unit)if (base_addr ==1 )return ; - (void )(probe_list2 (unit, m68k_probes, base_addr ==0 ) && -probe_list2 (unit, isa_probes, base_addr ==0 )); +probe_list2 (unit, isa_probes, base_addr ==0 ); }/* Statically configured drivers -- order matters here. */ drivers/net/ethernet/8390/apne.c +2
-9@@ -75,7 +75,6 @@#define NESM_STOP_PG 0x80/* Last page +1 of RX ring */ -struct net_device *__init apne_probe (int unit);static int apne_probe1 (struct net_device *dev,int ioaddr);static void apne_reset_8390 (struct net_device *dev);@@ -120,7 +119,7 @@ static u32 apne_msg_enable;module_param_named (msg_enable, apne_msg_enable, uint,0444 );MODULE_PARM_DESC (msg_enable,"Debug message level (see linux/netdevice.h for bitmap)" ); -struct net_device *__init apne_probe (int unit) +static struct net_device *__init apne_probe (void ) {struct net_device *dev;struct ei_device *ei_local;@@ -150,10 +149,6 @@ struct net_device * __init apne_probe(int unit) dev =alloc_ei_netdev ();if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - } ei_local =netdev_priv (dev); ei_local->msg_enable = apne_msg_enable;@@ -554,12 +549,11 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -#ifdef MODULE static struct net_device *apne_dev;static int __init apne_module_init (void ) { - apne_dev =apne_probe (-1 ); + apne_dev =apne_probe ();return PTR_ERR_OR_ZERO (apne_dev); }@@ -579,7 +573,6 @@ static void __exit apne_module_exit(void) }module_init (apne_module_init);module_exit (apne_module_exit); -#endif static int init_pcmcia (void ) {drivers/net/ethernet/amd/atarilance.c +2
-9@@ -367,7 +367,7 @@ static void *slow_memcpy( void *dst, const void *src, size_t len ) } -struct net_device *__init atarilance_probe (int unit) +struct net_device *__init atarilance_probe (void ) {int i;static int found;@@ -382,10 +382,6 @@ struct net_device * __init atarilance_probe(int unit) dev =alloc_etherdev (sizeof (struct lance_private ));if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - }for ( i =0 ; i <N_LANCE_ADDR ; ++i ) {if (lance_probe1 ( dev, &lance_addr_list[i] )) {@@ -1137,13 +1133,11 @@ static int lance_set_mac_address( struct net_device *dev, void *addr )return 0 ; } - -#ifdef MODULE static struct net_device *atarilance_dev;static int __init atarilance_module_init (void ) { - atarilance_dev =atarilance_probe (-1 ); + atarilance_dev =atarilance_probe ();return PTR_ERR_OR_ZERO (atarilance_dev); }@@ -1155,4 +1149,3 @@ static void __exit atarilance_module_exit(void) }module_init (atarilance_module_init);module_exit (atarilance_module_exit); -#endif /* MODULE */ drivers/net/ethernet/amd/mvme147.c +6
-10@@ -68,7 +68,7 @@ static const struct net_device_ops lance_netdev_ops = { };/* Initialise the one and only on-board 7990 */ -struct net_device *__init mvme147lance_probe (int unit) +static struct net_device *__init mvme147lance_probe (void ) {struct net_device *dev;static int called;@@ -86,9 +86,6 @@ struct net_device * __init mvme147lance_probe(int unit)if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) -sprintf (dev->name,"eth%d" , unit); -/* Fill the dev fields */ dev->base_addr = (unsigned long )MVME147_LANCE_BASE ; dev->netdev_ops = &lance_netdev_ops;@@ -179,22 +176,21 @@ static int m147lance_close(struct net_device *dev)return 0 ; } -#ifdef MODULE MODULE_LICENSE ("GPL" );static struct net_device *dev_mvme147_lance; -int __init init_module (void ) +static int __init m147lance_init (void ) { - dev_mvme147_lance =mvme147lance_probe (-1 ); + dev_mvme147_lance =mvme147lance_probe ();return PTR_ERR_OR_ZERO (dev_mvme147_lance); } +module_init (m147lance_init); -void __exit cleanup_module(void) +static void __exit m147lance_exit(void) {struct m147lance_private *lp =netdev_priv (dev_mvme147_lance);unregister_netdev (dev_mvme147_lance);free_pages (lp->ram,3 );free_netdev (dev_mvme147_lance); } - -#endif /* MODULE */ +module_exit (m147lance_exit);drivers/net/ethernet/amd/sun3lance.c +6
-13@@ -245,7 +245,7 @@ static void set_multicast_list( struct net_device *dev );/************************* End of Prototypes **************************/ -struct net_device *__init sun3lance_probe (int unit) +static struct net_device *__init sun3lance_probe (void ) {struct net_device *dev;static int found;@@ -272,10 +272,6 @@ struct net_device * __init sun3lance_probe(int unit) dev =alloc_etherdev (sizeof (struct lance_private ));if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - }if (!lance_probe (dev)) goto out;@@ -924,17 +920,16 @@ static void set_multicast_list( struct net_device *dev ) } -#ifdef MODULE -static struct net_device *sun3lance_dev; -int __init init_module (void ) +static int __init sun3lance_init (void ) { - sun3lance_dev =sun3lance_probe (-1 ); + sun3lance_dev =sun3lance_probe ();return PTR_ERR_OR_ZERO (sun3lance_dev); } +module_init (sun3lance_init); -void __exit cleanup_module(void) +static void __exit sun3lance_cleanup(void) {unregister_netdev (sun3lance_dev);#ifdef CONFIG_SUN3 @@ -942,6 +937,4 @@ void __exit cleanup_module(void)#endif free_netdev (sun3lance_dev); } - -#endif /* MODULE */ - +module_exit (sun3lance_cleanup);drivers/net/ethernet/i825xx/82596.c +6
-18@@ -1110,9 +1110,6 @@ static void print_eth(unsigned char *add, char *str) add, add + 6, add, add[12], add[13], str); } -static int io =0x300 ; -static int irq =10 ; -static const struct net_device_ops i596_netdev_ops = { .ndo_open = i596_open, .ndo_stop = i596_close,@@ -1123,7 +1120,7 @@ static const struct net_device_ops i596_netdev_ops = { .ndo_validate_addr = eth_validate_addr, }; -struct net_device *__init i82596_probe (int unit) +static struct net_device *__init i82596_probe (void ) {struct net_device *dev;int i;@@ -1140,14 +1137,6 @@ struct net_device * __init i82596_probe(int unit)if (!dev)return ERR_PTR (-ENOMEM ); -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - }else { - dev->base_addr = io; - dev->irq = irq; - } -#ifdef ENABLE_MVME16x_NETif (MACH_IS_MVME16x) {if (mvme16x_config & MVME16x_CONFIG_NO_ETHERNET) {@@ -1515,22 +1504,22 @@ static void set_multicast_list(struct net_device *dev) } } -#ifdef MODULE static struct net_device *dev_82596;static int debug =-1 ;module_param (debug, int,0 );MODULE_PARM_DESC (debug,"i82596 debug mask" ); -int __init init_module (void ) +static int __init i82596_init (void ) {if (debug >=0 ) i596_debug = debug; - dev_82596 =i82596_probe (-1 ); + dev_82596 =i82596_probe ();return PTR_ERR_OR_ZERO (dev_82596); } +module_init (i82596_init); -void __exit cleanup_module(void) +static void __exit i82596_cleanup(void) {unregister_netdev (dev_82596);#ifdef __mc68000__@@ -1544,5 +1533,4 @@ void __exit cleanup_module(void)free_page ((u32)(dev_82596->mem_start));free_netdev (dev_82596); } - -#endif /* MODULE */ +module_exit (i82596_cleanup);drivers/net/ethernet/i825xx/sun3_82586.c +7
-10@@ -29,6 +29,7 @@ static int rfdadd = 0; /* rfdadd=1 may be better for 8K MEM cards */static int fifo=0x8 ;/* don't change */ #include <linux/kernel.h> +#include <linux/module.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/ioport.h> @@ -276,7 +277,7 @@ static void alloc586(struct net_device *dev)memset ((char *)p->scb,0 ,sizeof (struct scb_struct )); } -struct net_device *__init sun3_82586_probe (int unit) +static int __init sun3_82586_probe (void ) {struct net_device *dev;unsigned long ioaddr;@@ -291,25 +292,20 @@ struct net_device * __init sun3_82586_probe(int unit)break ;default : -return ERR_PTR (-ENODEV ); +return -ENODEV ; }if (found) -return ERR_PTR (-ENODEV ); +return -ENODEV ; ioaddr = (unsigned long )ioremap (IE_OBIO ,SUN3_82586_TOTAL_SIZE );if (!ioaddr) -return ERR_PTR (-ENOMEM ); +return -ENOMEM ; found =1 ; dev =alloc_etherdev (sizeof (struct priv ));if (!dev) goto out; -if (unit >=0 ) { -sprintf (dev->name,"eth%d" , unit); -netdev_boot_setup_check (dev); - } - dev->irq =IE_IRQ ; dev->base_addr = ioaddr; err =sun3_82586_probe1 (dev, ioaddr);@@ -326,8 +322,9 @@ struct net_device * __init sun3_82586_probe(int unit)free_netdev (dev); out:iounmap ((void __iomem *)ioaddr); -return ERR_PTR (err); +return err; } +module_init (sun3_82586_probe);static const struct net_device_ops sun3_82586_netdev_ops = { .ndo_open = sun3_82586_open,include/net/Space.h +0
-1@@ -8,16 +8,10 @@ struct net_device *ultra_probe(int unit);struct net_device *wd_probe (int unit);struct net_device *ne_probe (int unit);struct net_device *fmv18x_probe (int unit); -struct net_device *i82596_probe (int unit);struct net_device *ni65_probe (int unit);struct net_device *sonic_probe (int unit);
include/net/Space.h struct net_device *ultra_probe(int unit); · line 17
Quoted 10 lines
include/net/Space.h +0
-5struct net_device *smc_init (int unit); -struct net_device *atarilance_probe (int unit); -struct net_device *sun3lance_probe (int unit); -struct net_device *sun3_82586_probe (int unit); -struct net_device *apne_probe (int unit);struct net_device *cs89x0_probe (int unit); -struct net_device *mvme147lance_probe (int unit);struct net_device *tc515_probe (int unit);struct net_device *lance_probe (int unit);struct net_device *cops_probe (int unit);
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
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
Quoted 1 line · [[RFC 00/13] [net-next] drivers/net/Space.c cleanup] On 16/05/2021 (Sun 00:13)…
From: Arnd Bergmann <[email protected]>
[...]
Quoted 8 lines
* Alternatively, the fact that the ISA drivers have never been cleaned up can be seen as an indication that there isn't really much remaining interest in them. We could move them to
drivers/stagingalong with the consolidated contents ofdrivers/net/Space.cand see if anyone still uses them and eventually remove the ones that nobody has. I can see that Paul Gortmaker removed a number of less common ISA ethernet drivers in 2013, but at the time left these because they were possibly still relevant.
It was a thin/remote possibility, even then: From v3.9-rc1~139^2~288
In theory, it is possible that someone could still be running one of these 12+ year old P3 machines and want 3.9+ bleeding edge kernels (but unlikely). In light of the above (remote) possibility, we can defer the removal of some ISA network drivers that were highly popular and well tested. Typically that means the stuff more from the mid to late '90s, some with ISA PnP support, like the 3c509, the wd/SMC 8390 based stuff, PCnet/lance etc.
Now those 12y old machines are 20y old, and bleeding edge for this discussion will be the the v5.14+ kernel.
Leaving the more popular cards was a concession to making progress vs. having the whole cleanup blocked by individuals who haven't yet realized that using ancient hardware is best done (only done?) with ancient kernels.
Maybe things are better now; people are putting more consideration to the future of the kernel, rather than clinging to times long past? We've since managed to delete several complete old arch dirs; which I had previously thought impossible. I couldn't even git rid of the x86 EISA support code six years ago.[1]
I'd be willing to do a "Phase 2" of 930d52c012b8 ISA net delete; I'm not sure the bounce through stable on the way out does much other than muddy the git history. I'd be tempted to just propose the individual deletes and see where that goes....
Paul.
--
[1] https://lwn.net/Articles/630115/
Quoted 90 lines
* If we end up moving the cops localtalk driver to staging, support for localtalk devices (though probably not appletalk over ethernet) can arguably meet the same fate.
If someone wants to work on those follow-ups or thinks they are a good idea, let me know, otherwise I'd leave it at this cleanup.
Arnd
Arnd Bergmann (13):
[net-next] bcmgenet: remove call tonetdev_boot_setup_check[net-next] natsemi: sonic: stop callingnetdev_boot_setup_check[net-next] appletalk: ltpc: remove static probing [net-next] 3c509: stop callingnetdev_boot_setup_check[net-next] cs89x0: rework driver configuration [net-next] m68k: remove legacy probing
[net-next] movenetdev_boot_setupintoSpace.c[net-next] make legacy ISA probe optional
[net-next] wan: remove staleKconfigentries [net-next] wan: remove sbni/granch driver
[net-next] wan:hostess_sv11: use module_init/module_exit helpers [net-next] ethernet: isa: convert to module_init/module_exit [net-next] 8390: xsurf100: avoid includinglib8390.c.../admin-guide/kernel-parameters.txt | 2 - drivers/net/Kconfig | 7 + drivers/net/Makefile | 3 +- drivers/net/Space.c | 178 +- drivers/net/appletalk/Kconfig | 4 +- drivers/net/appletalk/ltpc.c | 7 +- drivers/net/ethernet/3com/3c509.c | 3 - drivers/net/ethernet/3com/3c515.c | 3 +- drivers/net/ethernet/3com/Kconfig | 1 + drivers/net/ethernet/8390/Kconfig | 3 + drivers/net/ethernet/8390/Makefile | 2 +- drivers/net/ethernet/8390/apne.c | 11 +- drivers/net/ethernet/8390/ne.c | 5 +- drivers/net/ethernet/8390/smc-ultra.c | 9 +- drivers/net/ethernet/8390/wd.c | 7 +- drivers/net/ethernet/8390/xsurf100.c | 7 +- drivers/net/ethernet/amd/Kconfig | 2 + drivers/net/ethernet/amd/atarilance.c | 11 +- drivers/net/ethernet/amd/lance.c | 6 +- drivers/net/ethernet/amd/mvme147.c | 16 +- drivers/net/ethernet/amd/ni65.c | 6 +- drivers/net/ethernet/amd/sun3lance.c | 19 +- .../net/ethernet/broadcom/genet/bcmgenet.c | 2 - drivers/net/ethernet/cirrus/Kconfig | 27 +- drivers/net/ethernet/cirrus/cs89x0.c | 31 +- drivers/net/ethernet/i825xx/82596.c | 24 +- drivers/net/ethernet/i825xx/sun3_82586.c | 17 +- drivers/net/ethernet/natsemi/jazzsonic.c | 2 - drivers/net/ethernet/natsemi/xtsonic.c | 1 - drivers/net/ethernet/smsc/Kconfig | 1 + drivers/net/ethernet/smsc/smc9194.c | 6 +- drivers/net/wan/Kconfig | 51 - drivers/net/wan/Makefile | 1 - drivers/net/wan/hostess_sv11.c | 6 +- drivers/net/wan/sbni.c | 1638 ----------------- drivers/net/wan/sbni.h | 147 -- include/linux/netdevice.h | 13 - include/net/Space.h | 10 - net/core/dev.c | 125 -- net/ethernet/eth.c | 2 - 40 files changed, 259 insertions(+), 2157 deletions(-) delete mode 100644 drivers/net/wan/sbni.c delete mode 100644 drivers/net/wan/sbni.hSignature · 20 lines
2.29.2 Cc: Paul Gortmaker <[email protected]> Cc: "Maciej W. Rozycki" <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Doug Berger <[email protected]> Cc: Florian Fainelli <[email protected]> Cc: Sam Creasey <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Finn Thain <[email protected]> Cc: Christophe JAILLET <[email protected]> Cc: Andrew Lunn <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Bartosz Golaszewski <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected]
Maciej W. Rozycki
maintainerQuoted 3 lines · Paul Gortmaker
Leaving the more popular cards was a concession to making progress vs. having the whole cleanup blocked by individuals who haven't yet realized that using ancient hardware is best done (only done?) with ancient kernels.
Hmm, it depends on what you want to achieve, although I think it will be
fair if you require anyone caring about old hardware to keep any relevant code base, such as drivers, board support, etc. up to date as our internal interfaces evolve. Otherwise if it works, then I fail to see a reason to remove it just because you can.
Quoted 5 lines
Maybe things are better now; people are putting more consideration to the future of the kernel, rather than clinging to times long past? We've since managed to delete several complete old arch dirs; which I had previously thought impossible. I couldn't even git rid of the x86 EISA support code six years ago.[1]
Heh, that machine I raised my objection for is now back in service, after
a failure of its industrial PSU and the installation of a replacement one (which was a bit of a challenge to track down), serving the maintenance of the defxx driver for the DEFEA (EISA) variant of the DEC FDDI network adapter:
platform eisa.0: Probing EISA bus 0
eisa 00:00: EISA: Mainboard AEI0401 detected
eisa 00:05: EISA: slot 5: DEC3002 detected
defxx: v1.12 2021/03/10 Lawrence V. Stefani and others
00:05: DEFEA at I/O addr = 0x5000, IRQ = 10, Hardware addr = 00-00-f8-c8-b3-b6 00:05: registered as fddi0
eisa 00:06: EISA: slot 6: NPI0303 detected
eisa 00:08: EISA: slot 8: TCM5094 detected
eth0: 3c5x9 found at 0x8000, 10baseT port, address 00:a0:24:b6:8b:db, IRQ 12. platform eisa.0: EISA: Detected 3 cards
I just need to upgrade it with more DRAM (256MiB supported; not too bad for an i486) so that it runs a tad more smoothly. An alternative would be switching to an EISA Alpha machine, however I don't have any at the moment and chasing one would be a bit of an issue.
FAOD I keep getting contacted about the FDDI stuff as it remains in use
in various industrial and scientific installations and the typical use case nowadays is getting whatever old gear, which has fallen apart, they have used to communicate with their equipment over FDDI with a modern Linux machine, preferably running out of the box with one of the readily available distributions, and one of those FDDI cards (normally the PCI variant though), which are reasonably available still.
Quoted 4 lines
I'd be willing to do a "Phase 2" of
930d52c012b8ISA net delete; I'm not sure the bounce through stable on the way out does much other than muddy the git history. I'd be tempted to just propose the individual deletes and see where that goes....
Sounds fair to me.
Maciej
Quoted 6 lines · Paul Gortmaker
Quoted 1 line
From: Arnd Bergmann <[email protected]>
I'd be willing to do a "Phase 2" of
930d52c012b8ISA net delete; I'm not sure the bounce through stable on the way out does much other than muddy the git history. I'd be tempted to just propose the individual deletes and see where that goes....
I think the main benefit of going through drivers/staging would be that it could be done somewhat more aggressively by moving more of the presumed-unused hardware out at once, and waiting for media coverage to wake up any remaining users. Then again, reverting a removal isn't that different from reverting the move to staging.
If we do it one driver at a time, a good start might be the ones that don't already have support for probing multiple devices in a loadable module (ni65,smc9194, cs89x0-isa, cops, ltpc), which would let us kill off drivers/net/Space.c by always using the module_init() logic. These are all non-ISAPnP devices, and a second step could be to remove support for all non-PNP devices (lance, wd80x3, corkscrew and maybe the ISA WAN devices).
Unless we can agree to remove CONFIG_ISA completely, it's probably best to leave ISA support for those drivers that also work on PCI, EISA or m68k hardware, as those have the best chance to still get tested. 3c509 is probably the best maintained, given that it's the only network driver that got converted to isa_register_driver() from the linux-2.0 style static probing. 3c515 has the distinction of being the only remaining 100mbit one, and ne2k is obviously the one that one can still find on ebay or the parent's attic.
Arnd
Quoted 5 lines · Paul Gortmaker
Leaving the more popular cards was a concession to making progress vs. having the whole cleanup blocked by individuals who haven't yet realized that using ancient hardware is best done (only done?) with ancient kernels.
By extension, using ancient kernels is best done with ancient userland. And now the time has come to remove all the 'compat' nonsense.
Oh, wait, all of that old software seems to be riddled with bugs and vulnerabilities.
And who would have thought that all those developers writing new code for emulators and their users were holding up "progress"?
Quoted 2 lines
Maybe things are better now; people are putting more consideration to the future of the kernel, rather than clinging to times long past?
If you've been doing engineering for a while you'll start to notice a
pattern: old designs that work get reused. That's partly why the latest silicon contains ancient logic blocks.
When that changes, perhaps we can talk about "progress"...