Commit 3bf1ad5d authored by Andrew Morton's avatar Andrew Morton Committed by Christoph Hellwig

[PATCH] generic HDLC module API update

From: Krzysztof Halasa <khc@pm.waw.pl>

Updates the HDLC drivers to the approved module API.
parent 748b3ebb
...@@ -255,8 +255,8 @@ config HDLC ...@@ -255,8 +255,8 @@ config HDLC
If you want to compile the driver as a module ( = code which can be If you want to compile the driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want), inserted in and removed from the running kernel whenever you want),
say M here and read Documentation/modules.txt. The module say M here and read <file:Documentation/modules.txt>. The module
will be called hdlc.o. will be called hdlc.
If unsure, say N here. If unsure, say N here.
...@@ -363,7 +363,7 @@ config N2 ...@@ -363,7 +363,7 @@ config N2
If you want to compile the driver as a module ( = code which can be If you want to compile the driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want), inserted in and removed from the running kernel whenever you want),
say M here and read <file:Documentation/modules.txt>. The module say M here and read <file:Documentation/modules.txt>. The module
will be called n2.o. will be called n2.
If unsure, say N here. If unsure, say N here.
...@@ -378,7 +378,7 @@ config C101 ...@@ -378,7 +378,7 @@ config C101
If you want to compile the driver as a module ( = code which can be If you want to compile the driver as a module ( = code which can be
inserted in and removed from the running kernel whenever you want), inserted in and removed from the running kernel whenever you want),
say M here and read <file:Documentation/modules.txt>. The module say M here and read <file:Documentation/modules.txt>. The module
will be called c101.o. will be called c101.
If unsure, say N here. If unsure, say N here.
......
...@@ -157,14 +157,9 @@ static int c101_open(struct net_device *dev) ...@@ -157,14 +157,9 @@ static int c101_open(struct net_device *dev)
port_t *port = hdlc_to_port(hdlc); port_t *port = hdlc_to_port(hdlc);
int result; int result;
if (!try_module_get(THIS_MODULE))
return -EFAULT; /* rmmod in progress */
result = hdlc_open(hdlc); result = hdlc_open(hdlc);
if (result) { if (result)
return result; return result;
module_put(THIS_MODULE);
}
writeb(1, port->win0base + C101_DTR); writeb(1, port->win0base + C101_DTR);
sca_out(0, MSCI1_OFFSET + CTL, port); /* RTS uses ch#2 output */ sca_out(0, MSCI1_OFFSET + CTL, port); /* RTS uses ch#2 output */
...@@ -183,7 +178,6 @@ static int c101_close(struct net_device *dev) ...@@ -183,7 +178,6 @@ static int c101_close(struct net_device *dev)
writeb(0, port->win0base + C101_DTR); writeb(0, port->win0base + C101_DTR);
sca_out(CTL_NORTS, MSCI1_OFFSET + CTL, port); sca_out(CTL_NORTS, MSCI1_OFFSET + CTL, port);
hdlc_close(hdlc); hdlc_close(hdlc);
module_put(THIS_MODULE);
return 0; return 0;
} }
...@@ -319,6 +313,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) ...@@ -319,6 +313,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
dev = hdlc_to_dev(&card->hdlc); dev = hdlc_to_dev(&card->hdlc);
spin_lock_init(&card->lock); spin_lock_init(&card->lock);
SET_MODULE_OWNER(dev);
dev->irq = irq; dev->irq = irq;
dev->mem_start = winbase; dev->mem_start = winbase;
dev->mem_end = winbase + C101_MAPPED_RAM_SIZE - 1; dev->mem_end = winbase + C101_MAPPED_RAM_SIZE - 1;
......
...@@ -218,15 +218,9 @@ static int n2_open(struct net_device *dev) ...@@ -218,15 +218,9 @@ static int n2_open(struct net_device *dev)
u8 mcr = inb(io + N2_MCR) | (port->phy_node ? TX422_PORT1:TX422_PORT0); u8 mcr = inb(io + N2_MCR) | (port->phy_node ? TX422_PORT1:TX422_PORT0);
int result; int result;
if (!try_module_get(THIS_MODULE))
return -EFAULT; /* rmmod in progress */
result = hdlc_open(hdlc); result = hdlc_open(hdlc);
if (result) { if (result)
return result; return result;
module_put(THIS_MODULE);
}
mcr &= port->phy_node ? ~DTR_PORT1 : ~DTR_PORT0; /* set DTR ON */ mcr &= port->phy_node ? ~DTR_PORT1 : ~DTR_PORT0; /* set DTR ON */
outb(mcr, io + N2_MCR); outb(mcr, io + N2_MCR);
...@@ -251,7 +245,6 @@ static int n2_close(struct net_device *dev) ...@@ -251,7 +245,6 @@ static int n2_close(struct net_device *dev)
mcr |= port->phy_node ? DTR_PORT1 : DTR_PORT0; /* set DTR OFF */ mcr |= port->phy_node ? DTR_PORT1 : DTR_PORT0; /* set DTR OFF */
outb(mcr, io + N2_MCR); outb(mcr, io + N2_MCR);
hdlc_close(hdlc); hdlc_close(hdlc);
module_put(THIS_MODULE);
return 0; return 0;
} }
...@@ -451,6 +444,7 @@ static int __init n2_run(unsigned long io, unsigned long irq, ...@@ -451,6 +444,7 @@ static int __init n2_run(unsigned long io, unsigned long irq,
port->log_node = 1; port->log_node = 1;
spin_lock_init(&port->lock); spin_lock_init(&port->lock);
SET_MODULE_OWNER(dev);
dev->irq = irq; dev->irq = irq;
dev->mem_start = winbase; dev->mem_start = winbase;
dev->mem_end = winbase + USE_WINDOWSIZE-1; dev->mem_end = winbase + USE_WINDOWSIZE-1;
......
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