Commit 6d62388c authored by Stephen Hemminger's avatar Stephen Hemminger

[NET]: ibmtr - get rid of MOD_INC/DEC.

With the new module system MOD_INC/MOD_DEC are no longer necessary.
Also changed to new module init/exit macros for function setup.

The module exit code can sleep, so calling schedule_timeout is better
than spinning.
parent 02245132
...@@ -876,7 +876,6 @@ static int tok_open(struct net_device *dev) ...@@ -876,7 +876,6 @@ static int tok_open(struct net_device *dev)
if (i==0) break; if (i==0) break;
if (ti->open_status == OPEN && ti->sap_status==OPEN) { if (ti->open_status == OPEN && ti->sap_status==OPEN) {
netif_start_queue(dev); netif_start_queue(dev);
MOD_INC_USE_COUNT;
DPRINTK("Adapter is up and running\n"); DPRINTK("Adapter is up and running\n");
return 0; return 0;
} }
...@@ -1041,7 +1040,6 @@ static int tok_close(struct net_device *dev) ...@@ -1041,7 +1040,6 @@ static int tok_close(struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
DPRINTK("Adapter is closed.\n"); DPRINTK("Adapter is closed.\n");
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -1918,7 +1916,7 @@ MODULE_PARM(io, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i"); ...@@ -1918,7 +1916,7 @@ MODULE_PARM(io, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
MODULE_PARM(mem, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i"); MODULE_PARM(mem, "1-" __MODULE_STRING(IBMTR_MAX_ADAPTERS) "i");
int init_module(void) static int __init ibmtr_init(void)
{ {
int i; int i;
int count=0; int count=0;
...@@ -1948,21 +1946,24 @@ int init_module(void) ...@@ -1948,21 +1946,24 @@ int init_module(void)
if (count) return 0; if (count) return 0;
printk("ibmtr: register_netdev() returned non-zero.\n"); printk("ibmtr: register_netdev() returned non-zero.\n");
return -EIO; return -EIO;
} /*init_module */ }
module_init(ibmtr_init);
void cleanup_module(void) static void __exit ibmtr_cleanup(void)
{ {
int i,j; int i;
for (i = 0; i < IBMTR_MAX_ADAPTERS; i++){ for (i = 0; i < IBMTR_MAX_ADAPTERS; i++){
if (!dev_ibmtr[i]) if (!dev_ibmtr[i])
continue; continue;
if (dev_ibmtr[i]->base_addr) { if (dev_ibmtr[i]->base_addr) {
outb(0,dev_ibmtr[i]->base_addr+ADAPTRESET); outb(0,dev_ibmtr[i]->base_addr+ADAPTRESET);
for(j=jiffies+TR_RST_TIME;
time_before_eq(jiffies,j);) ; schedule_timeout(TR_RST_TIME); /* wait 50ms */
outb(0,dev_ibmtr[i]->base_addr+ADAPTRESETREL); outb(0,dev_ibmtr[i]->base_addr+ADAPTRESETREL);
} }
unregister_netdev(dev_ibmtr[i]); unregister_netdev(dev_ibmtr[i]);
free_irq(dev_ibmtr[i]->irq, dev_ibmtr[i]); free_irq(dev_ibmtr[i]->irq, dev_ibmtr[i]);
release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT); release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT);
...@@ -1978,4 +1979,5 @@ void cleanup_module(void) ...@@ -1978,4 +1979,5 @@ void cleanup_module(void)
dev_ibmtr[i] = NULL; dev_ibmtr[i] = NULL;
} }
} }
#endif /* MODULE */ module_exit(ibmtr_cleanup);
#endif
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