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

[NET]: COSA driver fixes.

* get rid of leftover sti
* no longer need MOD_INC/DEC stuff
* get rid of dead code related to MOD_INC/DEC
* use module_init/module_exit to cleanly run init code
parent 7d464ed4
...@@ -357,11 +357,7 @@ static void debug_status_out(struct cosa_data *cosa, int status); ...@@ -357,11 +357,7 @@ static void debug_status_out(struct cosa_data *cosa, int status);
/* ---------- Initialization stuff ---------- */ /* ---------- Initialization stuff ---------- */
#ifdef MODULE
int init_module(void)
#else
static int __init cosa_init(void) static int __init cosa_init(void)
#endif
{ {
int i; int i;
...@@ -398,9 +394,9 @@ static int __init cosa_init(void) ...@@ -398,9 +394,9 @@ static int __init cosa_init(void)
} }
return 0; return 0;
} }
module_init(cosa_init);
#ifdef MODULE static void __exit cosa_exit(void)
void cleanup_module (void)
{ {
struct cosa_data *cosa; struct cosa_data *cosa;
int i; int i;
...@@ -424,7 +420,7 @@ void cleanup_module (void) ...@@ -424,7 +420,7 @@ void cleanup_module (void)
} }
unregister_chrdev(cosa_major, "cosa"); unregister_chrdev(cosa_major, "cosa");
} }
#endif module_exit(cosa_exit);
/* /*
* This function should register all the net devices needed for the * This function should register all the net devices needed for the
...@@ -513,7 +509,6 @@ static int cosa_probe(int base, int irq, int dma) ...@@ -513,7 +509,6 @@ static int cosa_probe(int base, int irq, int dma)
if (irq < 0) { if (irq < 0) {
unsigned long irqs; unsigned long irqs;
/* printk(KERN_INFO "IRQ autoprobe\n"); */ /* printk(KERN_INFO "IRQ autoprobe\n"); */
sti();
irqs = probe_irq_on(); irqs = probe_irq_on();
/* /*
* Enable interrupt on tx buffer empty (it sure is) * Enable interrupt on tx buffer empty (it sure is)
...@@ -624,6 +619,7 @@ static void sppp_channel_init(struct channel_data *chan) ...@@ -624,6 +619,7 @@ static void sppp_channel_init(struct channel_data *chan)
if (register_netdev(d) == -1) { if (register_netdev(d) == -1) {
printk(KERN_WARNING "%s: register_netdev failed.\n", d->name); printk(KERN_WARNING "%s: register_netdev failed.\n", d->name);
sppp_detach(chan->pppdev.dev); sppp_detach(chan->pppdev.dev);
free_netdev(chan->pppdev.dev);
return; return;
} }
} }
...@@ -658,7 +654,6 @@ static int cosa_sppp_open(struct net_device *d) ...@@ -658,7 +654,6 @@ static int cosa_sppp_open(struct net_device *d)
chan->rx_done = sppp_rx_done; chan->rx_done = sppp_rx_done;
chan->usage=-1; chan->usage=-1;
chan->cosa->usage++; chan->cosa->usage++;
MOD_INC_USE_COUNT;
spin_unlock_irqrestore(&chan->cosa->lock, flags); spin_unlock_irqrestore(&chan->cosa->lock, flags);
err = sppp_open(d); err = sppp_open(d);
...@@ -666,7 +661,6 @@ static int cosa_sppp_open(struct net_device *d) ...@@ -666,7 +661,6 @@ static int cosa_sppp_open(struct net_device *d)
spin_lock_irqsave(&chan->cosa->lock, flags); spin_lock_irqsave(&chan->cosa->lock, flags);
chan->usage=0; chan->usage=0;
chan->cosa->usage--; chan->cosa->usage--;
MOD_DEC_USE_COUNT;
spin_unlock_irqrestore(&chan->cosa->lock, flags); spin_unlock_irqrestore(&chan->cosa->lock, flags);
return err; return err;
...@@ -726,7 +720,6 @@ static int cosa_sppp_close(struct net_device *d) ...@@ -726,7 +720,6 @@ static int cosa_sppp_close(struct net_device *d)
} }
chan->usage=0; chan->usage=0;
chan->cosa->usage--; chan->cosa->usage--;
MOD_DEC_USE_COUNT;
spin_unlock_irqrestore(&chan->cosa->lock, flags); spin_unlock_irqrestore(&chan->cosa->lock, flags);
return 0; return 0;
} }
...@@ -1187,21 +1180,6 @@ static int cosa_ioctl_common(struct cosa_data *cosa, ...@@ -1187,21 +1180,6 @@ static int cosa_ioctl_common(struct cosa_data *cosa,
return cosa_gettype(cosa, (char *)arg); return cosa_gettype(cosa, (char *)arg);
case COSAIORIDSTR: case COSAIORIDSTR:
return cosa_getidstr(cosa, (char *)arg); return cosa_getidstr(cosa, (char *)arg);
/*
* These two are _very_ugly_hack_(tm). Don't even look at this.
* Implementing this saved me few reboots after some process segfaulted
* inside this module.
*/
#ifdef MODULE
#if 0
case COSAIOMINC:
MOD_INC_USE_COUNT;
return 0;
case COSAIOMDEC:
MOD_DEC_USE_COUNT;
return 0;
#endif
#endif
case COSAIONRCARDS: case COSAIONRCARDS:
return nr_cards; return nr_cards;
case COSAIONRCHANS: case COSAIONRCHANS:
......
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