Commit 4ad50851 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

[NET]: Switch arcnet over to initcalls.

parent 73baeace
...@@ -53,10 +53,12 @@ struct ArcProto rawmode_proto = ...@@ -53,10 +53,12 @@ struct ArcProto rawmode_proto =
}; };
void arcnet_raw_init(void) static int __init arcnet_raw_init(void)
{ {
int count; int count;
printk(VERSION);
for (count = 0; count < 256; count++) for (count = 0; count < 256; count++)
if (arc_proto_map[count] == arc_proto_default) if (arc_proto_map[count] == arc_proto_default)
arc_proto_map[count] = &rawmode_proto; arc_proto_map[count] = &rawmode_proto;
...@@ -66,26 +68,18 @@ void arcnet_raw_init(void) ...@@ -66,26 +68,18 @@ void arcnet_raw_init(void)
arc_bcast_proto = &rawmode_proto; arc_bcast_proto = &rawmode_proto;
arc_proto_default = &rawmode_proto; arc_proto_default = &rawmode_proto;
}
#ifdef MODULE
int __init init_module(void)
{
printk(VERSION);
arcnet_raw_init();
return 0; return 0;
} }
void cleanup_module(void) static void __exit arcnet_raw_exit(void)
{ {
arcnet_unregister_proto(&rawmode_proto); arcnet_unregister_proto(&rawmode_proto);
} }
MODULE_LICENSE("GPL"); module_init(arcnet_raw_init);
#endif /* MODULE */ module_exit(arcnet_raw_exit);
MODULE_LICENSE("GPL");
/* packet receiver */ /* packet receiver */
......
...@@ -106,13 +106,15 @@ static int arcnet_rebuild_header(struct sk_buff *skb); ...@@ -106,13 +106,15 @@ static int arcnet_rebuild_header(struct sk_buff *skb);
static struct net_device_stats *arcnet_get_stats(struct net_device *dev); static struct net_device_stats *arcnet_get_stats(struct net_device *dev);
static int go_tx(struct net_device *dev); static int go_tx(struct net_device *dev);
void __init arcnet_init(void) static int debug = ARCNET_DEBUG;
MODULE_PARM(debug, "i");
MODULE_LICENSE("GPL");
static int __init arcnet_init(void)
{ {
static int arcnet_inited;
int count; int count;
if (arcnet_inited++) arcnet_debug = debug;
return;
printk(VERSION); printk(VERSION);
...@@ -138,47 +140,15 @@ void __init arcnet_init(void) ...@@ -138,47 +140,15 @@ void __init arcnet_init(void)
sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap), sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap),
sizeof(struct archdr)); sizeof(struct archdr));
#ifdef CONFIG_ARCNET /* We're not built as a module */
printk("arcnet: Available protocols:");
#ifdef CONFIG_ARCNET_1201
printk(" RFC1201");
arcnet_rfc1201_init();
#endif
#ifdef CONFIG_ARCNET_1051
printk(" RFC1051");
arcnet_rfc1051_init();
#endif
#ifdef CONFIG_ARCNET_RAW
printk(" RAW");
arcnet_raw_init();
#endif
printk("\n");
#ifdef CONFIG_ARCNET_COM90xx
com90xx_probe(NULL);
#endif
#endif
}
#ifdef MODULE
static int debug = ARCNET_DEBUG;
MODULE_PARM(debug, "i");
MODULE_LICENSE("GPL");
int __init init_module(void)
{
arcnet_debug = debug;
arcnet_init();
return 0; return 0;
} }
void cleanup_module(void) static void __exit arcnet_exit(void)
{ {
} }
#endif module_init(arcnet_init);
module_exit(arcnet_exit);
/* /*
* Dump the contents of an sk_buff * Dump the contents of an sk_buff
......
...@@ -54,10 +54,6 @@ static int __init com20020isa_probe(struct net_device *dev) ...@@ -54,10 +54,6 @@ static int __init com20020isa_probe(struct net_device *dev)
unsigned long airqmask; unsigned long airqmask;
struct arcnet_local *lp = dev->priv; struct arcnet_local *lp = dev->priv;
#ifndef MODULE
arcnet_init();
#endif
BUGLVL(D_NORMAL) printk(VERSION); BUGLVL(D_NORMAL) printk(VERSION);
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
......
...@@ -183,9 +183,6 @@ static struct pci_driver com20020pci_driver = { ...@@ -183,9 +183,6 @@ static struct pci_driver com20020pci_driver = {
static int __init com20020pci_init(void) static int __init com20020pci_init(void)
{ {
BUGLVL(D_NORMAL) printk(VERSION); BUGLVL(D_NORMAL) printk(VERSION);
#ifndef MODULE
arcnet_init();
#endif
return pci_module_init(&com20020pci_driver); return pci_module_init(&com20020pci_driver);
} }
......
...@@ -151,10 +151,6 @@ static int __init com90io_probe(struct net_device *dev) ...@@ -151,10 +151,6 @@ static int __init com90io_probe(struct net_device *dev)
int ioaddr = dev->base_addr, status; int ioaddr = dev->base_addr, status;
unsigned long airqmask; unsigned long airqmask;
#ifndef MODULE
arcnet_init();
#endif
BUGLVL(D_NORMAL) printk(VERSION); BUGLVL(D_NORMAL) printk(VERSION);
BUGLVL(D_NORMAL) printk("E-mail me if you actually test this driver, please!\n"); BUGLVL(D_NORMAL) printk("E-mail me if you actually test this driver, please!\n");
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/bootmem.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/arcdevice.h> #include <linux/arcdevice.h>
...@@ -100,7 +99,7 @@ static int numcards; ...@@ -100,7 +99,7 @@ static int numcards;
static int com90xx_skip_probe __initdata = 0; static int com90xx_skip_probe __initdata = 0;
int __init com90xx_probe(struct net_device *dev) static int __init com90xx_probe(struct net_device *dev)
{ {
int count, status, ioaddr, numprint, airq, retval = -ENODEV, int count, status, ioaddr, numprint, airq, retval = -ENODEV,
openparen = 0; openparen = 0;
...@@ -115,10 +114,6 @@ int __init com90xx_probe(struct net_device *dev) ...@@ -115,10 +114,6 @@ int __init com90xx_probe(struct net_device *dev)
if (!dev && com90xx_skip_probe) if (!dev && com90xx_skip_probe)
return -ENODEV; return -ENODEV;
#ifndef MODULE
arcnet_init();
#endif
BUGLVL(D_NORMAL) printk(VERSION); BUGLVL(D_NORMAL) printk(VERSION);
/* set up the arrays where we'll store the possible probe addresses */ /* set up the arrays where we'll store the possible probe addresses */
...@@ -603,9 +598,6 @@ static void com90xx_copy_from_card(struct net_device *dev, int bufnum, int offse ...@@ -603,9 +598,6 @@ static void com90xx_copy_from_card(struct net_device *dev, int bufnum, int offse
} }
#ifdef MODULE
/* Module parameters */ /* Module parameters */
static int io; /* use the insmod io= irq= shmem= options */ static int io; /* use the insmod io= irq= shmem= options */
...@@ -619,7 +611,7 @@ MODULE_PARM(shmem, "i"); ...@@ -619,7 +611,7 @@ MODULE_PARM(shmem, "i");
MODULE_PARM(device, "s"); MODULE_PARM(device, "s");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
int init_module(void) static int __init com90xx_init(void)
{ {
struct net_device *dev; struct net_device *dev;
int err; int err;
...@@ -642,8 +634,7 @@ int init_module(void) ...@@ -642,8 +634,7 @@ int init_module(void)
return 0; return 0;
} }
static void __exit com90xx_exit(void)
void cleanup_module(void)
{ {
struct net_device *dev; struct net_device *dev;
struct arcnet_local *lp; struct arcnet_local *lp;
...@@ -663,44 +654,38 @@ void cleanup_module(void) ...@@ -663,44 +654,38 @@ void cleanup_module(void)
} }
} }
#else module_init(com90xx_init);
module_exit(com90xx_exit);
#ifndef MODULE
static int __init com90xx_setup(char *s) static int __init com90xx_setup(char *s)
{ {
struct net_device *dev;
int ints[8]; int ints[8];
com90xx_skip_probe = 1;
s = get_options(s, 8, ints); s = get_options(s, 8, ints);
if (!ints[0] && !*s) { if (!ints[0] && !*s) {
printk("com90xx: Disabled.\n"); printk("com90xx: Disabled.\n");
return 1; return 1;
} }
dev = alloc_bootmem(sizeof(struct net_device));
memset(dev, 0, sizeof(struct net_device));
dev->init = com90xx_probe;
switch (ints[0]) { switch (ints[0]) {
default: /* ERROR */ default: /* ERROR */
printk("com90xx: Too many arguments.\n"); printk("com90xx: Too many arguments.\n");
case 3: /* Mem address */ case 3: /* Mem address */
dev->mem_start = ints[3]; shmem = ints[3];
case 2: /* IRQ */ case 2: /* IRQ */
dev->irq = ints[2]; irq = ints[2];
case 1: /* IO address */ case 1: /* IO address */
dev->base_addr = ints[1]; io = ints[1];
} }
if (*s) if (*s)
strncpy(dev->name, s, 9); strncpy(device, s, 9);
else else
strcpy(dev->name, "arc%d"); strcpy(device, "arc%d");
if (register_netdev(dev))
printk(KERN_ERR "com90xx: Cannot register arcnet device\n");
return 1; return 1;
} }
__setup("com90xx=", com90xx_setup); __setup("com90xx=", com90xx_setup);
#endif
#endif /* MODULE */
...@@ -53,8 +53,10 @@ struct ArcProto rfc1051_proto = ...@@ -53,8 +53,10 @@ struct ArcProto rfc1051_proto =
}; };
void __init arcnet_rfc1051_init(void) static int __init arcnet_rfc1051_init(void)
{ {
printk(VERSION);
arc_proto_map[ARC_P_IP_RFC1051] arc_proto_map[ARC_P_IP_RFC1051]
= arc_proto_map[ARC_P_ARP_RFC1051] = arc_proto_map[ARC_P_ARP_RFC1051]
= &rfc1051_proto; = &rfc1051_proto;
...@@ -63,27 +65,18 @@ void __init arcnet_rfc1051_init(void) ...@@ -63,27 +65,18 @@ void __init arcnet_rfc1051_init(void)
if (arc_bcast_proto == arc_proto_default) if (arc_bcast_proto == arc_proto_default)
arc_bcast_proto = &rfc1051_proto; arc_bcast_proto = &rfc1051_proto;
}
#ifdef MODULE
MODULE_LICENSE("GPL");
int __init init_module(void)
{
printk(VERSION);
arcnet_rfc1051_init();
return 0; return 0;
} }
void cleanup_module(void) static void __exit arcnet_rfc1051_exit(void)
{ {
arcnet_unregister_proto(&rfc1051_proto); arcnet_unregister_proto(&rfc1051_proto);
} }
#endif /* MODULE */ module_init(arcnet_rfc1051_init);
module_exit(arcnet_rfc1051_exit);
MODULE_LICENSE("GPL");
/* /*
* Determine a packet's protocol ID. * Determine a packet's protocol ID.
......
...@@ -53,8 +53,10 @@ struct ArcProto rfc1201_proto = ...@@ -53,8 +53,10 @@ struct ArcProto rfc1201_proto =
}; };
void __init arcnet_rfc1201_init(void) static int __init arcnet_rfc1201_init(void)
{ {
printk(VERSION);
arc_proto_map[ARC_P_IP] arc_proto_map[ARC_P_IP]
= arc_proto_map[ARC_P_IPV6] = arc_proto_map[ARC_P_IPV6]
= arc_proto_map[ARC_P_ARP] = arc_proto_map[ARC_P_ARP]
...@@ -66,27 +68,17 @@ void __init arcnet_rfc1201_init(void) ...@@ -66,27 +68,17 @@ void __init arcnet_rfc1201_init(void)
/* if someone else already owns the broadcast, we won't take it */ /* if someone else already owns the broadcast, we won't take it */
if (arc_bcast_proto == arc_proto_default) if (arc_bcast_proto == arc_proto_default)
arc_bcast_proto = &rfc1201_proto; arc_bcast_proto = &rfc1201_proto;
}
#ifdef MODULE
MODULE_LICENSE("GPL");
int __init init_module(void)
{
printk(VERSION);
arcnet_rfc1201_init();
return 0; return 0;
} }
void cleanup_module(void) static void __exit arcnet_rfc1201_exit(void)
{ {
arcnet_unregister_proto(&rfc1201_proto); arcnet_unregister_proto(&rfc1201_proto);
} }
#endif /* MODULE */ module_init(arcnet_rfc1201_init);
module_exit(arcnet_rfc1201_exit);
/* /*
* Determine a packet's protocol ID. * Determine a packet's protocol ID.
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
extern int dmascc_init(void); extern int dmascc_init(void);
extern int arcnet_init(void);
extern int scc_enet_init(void); extern int scc_enet_init(void);
extern int fec_enet_init(void); extern int fec_enet_init(void);
extern int sdla_setup(void); extern int sdla_setup(void);
...@@ -42,9 +41,6 @@ static struct net_probe pci_probes[] __initdata = { ...@@ -42,9 +41,6 @@ static struct net_probe pci_probes[] __initdata = {
#if defined(CONFIG_SDLA) #if defined(CONFIG_SDLA)
{sdla_c_setup, 0}, {sdla_c_setup, 0},
#endif #endif
#if defined(CONFIG_ARCNET)
{arcnet_init, 0},
#endif
#if defined(CONFIG_SCC_ENET) #if defined(CONFIG_SCC_ENET)
{scc_enet_init, 0}, {scc_enet_init, 0},
#endif #endif
......
...@@ -333,14 +333,5 @@ void arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs); ...@@ -333,14 +333,5 @@ void arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs);
void arcdev_setup(struct net_device *dev); void arcdev_setup(struct net_device *dev);
void arcnet_rx(struct net_device *dev, int bufnum); void arcnet_rx(struct net_device *dev, int bufnum);
void arcnet_init(void);
void arcnet_rfc1201_init(void);
void arcnet_rfc1051_init(void);
void arcnet_raw_init(void);
int com90xx_probe(struct net_device *dev);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_ARCDEVICE_H */ #endif /* _LINUX_ARCDEVICE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment