Commit f3e971e4 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[NET]: More SDLS fixes.

Since sdla.c now has locking instead of cli/sti, it shouldn't be
completely busted on SMP.

Also, the frad interface registration needed to be done once
(and check the result), and undone on module unload.
parent 7810e97c
...@@ -465,7 +465,7 @@ config DLCI_MAX ...@@ -465,7 +465,7 @@ config DLCI_MAX
config SDLA config SDLA
tristate "SDLA (Sangoma S502/S508) support" tristate "SDLA (Sangoma S502/S508) support"
depends on DLCI && ISA && BROKEN_ON_SMP depends on DLCI && ISA
help help
Say Y here if you need a driver for the Sangoma S502A, S502E, and Say Y here if you need a driver for the Sangoma S502A, S502E, and
S508 Frame Relay Access Devices. These are multi-protocol cards, but S508 Frame Relay Access Devices. These are multi-protocol cards, but
......
...@@ -1633,12 +1633,26 @@ static void setup_sdla(struct net_device *dev) ...@@ -1633,12 +1633,26 @@ static void setup_sdla(struct net_device *dev)
dev->mtu = SDLA_MAX_MTU; dev->mtu = SDLA_MAX_MTU;
} }
static int frad_registered;
struct net_device * __init sdla_init(void) struct net_device * __init sdla_init(void)
{ {
struct net_device *dev; struct net_device *dev;
struct frad_local *flp; struct frad_local *flp;
int err = -ENOMEM; int err = -ENOMEM;
if (!frad_registered) {
err = register_frad(devname);
if (err) {
printk(KERN_ERR "%s: frad registration failed %d\n",
devname, err);
return ERR_PTR(err);
}
frad_registered = 1;
printk("%s.\n", version);
}
dev = alloc_netdev(sizeof(struct frad_local), "sdla0", setup_sdla); dev = alloc_netdev(sizeof(struct frad_local), "sdla0", setup_sdla);
if (!dev) if (!dev)
goto out; goto out;
...@@ -1677,39 +1691,35 @@ struct net_device * __init sdla_init(void) ...@@ -1677,39 +1691,35 @@ struct net_device * __init sdla_init(void)
return ERR_PTR(err); return ERR_PTR(err);
} }
int __init sdla_c_setup(void)
{
printk("%s.\n", version);
register_frad(devname);
return 0;
}
#ifdef MODULE #ifdef MODULE
static struct net_device *sdla0; static struct net_device *sdla0;
#endif /* MODULE */
static int __init init_sdla(void) static int __init init_sdla(void)
{ {
int result = 0; int result = 0;
sdla_c_setup();
#ifdef MODULE
sdla0 = sdla_init(); sdla0 = sdla_init();
if (IS_ERR(sdla0)) if (IS_ERR(sdla0))
result = PTR_ERR(sdla0); result = PTR_ERR(sdla0);
#endif
return result; return result;
} }
static void __exit exit_sdla(void) static void __exit exit_sdla(void)
{ {
#ifdef MODULE struct frad_local *flp;
unregister_netdev(sdla0); unregister_netdev(sdla0);
if (sdla0->irq) if (sdla0->irq)
free_irq(sdla0->irq, sdla0); free_irq(sdla0->irq, sdla0);
flp = sdla0->priv;
del_timer_sync(&flp->timer);
free_netdev(sdla0); free_netdev(sdla0);
#endif
unregister_frad(devname);
} }
#endif
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
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