Hi,
Here's a patch against 2.5.2-pre9 that modifies all of the usb-serial
drivers to use the new usb-serial module reference logic.
thanks,
greg k-h
diff -Nru a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
--- a/drivers/usb/serial/belkin_sa.c Sun Jan 6 12:18:37 2002
+++ b/drivers/usb/serial/belkin_sa.c Sun Jan 6 12:18:37 2002
@@ -119,6 +119,7 @@
/* All of the device info needed for the serial converters */
static struct usb_serial_device_type belkin_device = {
+ owner: THIS_MODULE,
name: "Belkin / Peracom / GoHubs USB Serial Adapter",
id_table: id_table_combined,
num_interrupt_in: 1,
@@ -209,7 +210,6 @@
down (&port->sem);
++port->open_count;
- MOD_INC_USE_COUNT;
if (port->open_count == 1) {
/*Start reading from the device*/
@@ -264,7 +264,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
} /* belkin_sa_close */
diff -Nru a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
--- a/drivers/usb/serial/cyberjack.c Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/cyberjack.c Sun Jan 6 12:18:36 2002
@@ -77,6 +77,7 @@
MODULE_DEVICE_TABLE (usb, id_table);
static struct usb_serial_device_type cyberjack_device = {
+ owner: THIS_MODULE,
name: "Reiner SCT Cyberjack USB card reader",
id_table: id_table,
num_interrupt_in: 1,
@@ -148,8 +149,6 @@
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
- MOD_INC_USE_COUNT;
-
dbg(__FUNCTION__ " - port %d", port->number);
down (&port->sem);
@@ -204,7 +203,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
}
static int cyberjack_write (struct usb_serial_port *port, int from_user, const
unsigned char *buf, int count)
diff -Nru a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
--- a/drivers/usb/serial/digi_acceleport.c Sun Jan 6 12:18:37 2002
+++ b/drivers/usb/serial/digi_acceleport.c Sun Jan 6 12:18:37 2002
@@ -501,6 +501,7 @@
/* device info needed for the Digi serial converter */
static struct usb_serial_device_type digi_acceleport_2_device = {
+ owner: THIS_MODULE,
name: "Digi USB",
id_table: id_table_2,
num_interrupt_in: 0,
@@ -524,6 +525,7 @@
};
static struct usb_serial_device_type digi_acceleport_4_device = {
+ owner: THIS_MODULE,
name: "Digi USB",
id_table: id_table_4,
num_interrupt_in: 0,
@@ -603,7 +605,6 @@
spin_lock_irqsave( &priv->dp_port_lock, flags );
digi_wakeup_write( port );
spin_unlock_irqrestore( &priv->dp_port_lock, flags );
- MOD_DEC_USE_COUNT;
}
static void digi_wakeup_write( struct usb_serial_port *port )
@@ -1410,9 +1411,7 @@
/* also queue up a wakeup at scheduler time, in case we */
/* lost the race in write_chan(). */
- MOD_INC_USE_COUNT;
- if (schedule_task(&priv->dp_wakeup_task) == 0)
- MOD_DEC_USE_COUNT;
+ schedule_task(&priv->dp_wakeup_task);
spin_unlock( &priv->dp_port_lock );
@@ -1493,7 +1492,6 @@
/* inc module use count before sleeping to wait for closes */
++port->open_count;
- MOD_INC_USE_COUNT;
/* wait for a close in progress to finish */
while( priv->dp_in_close ) {
@@ -1502,7 +1500,6 @@
&priv->dp_port_lock, flags );
if( signal_pending(current) ) {
--port->open_count;
- MOD_DEC_USE_COUNT;
return( -EINTR );
}
spin_lock_irqsave( &priv->dp_port_lock, flags );
@@ -1562,7 +1559,6 @@
spin_lock_irqsave( &priv->dp_port_lock, flags );
if( port->open_count > 1 ) {
--port->open_count;
- MOD_DEC_USE_COUNT;
spin_unlock_irqrestore( &priv->dp_port_lock, flags );
return;
} else if( port->open_count <= 0 ) {
@@ -1642,7 +1638,6 @@
priv->dp_write_urb_in_use = 0;
priv->dp_in_close = 0;
--port->open_count;
- MOD_DEC_USE_COUNT;
wake_up_interruptible( &priv->dp_close_wait );
spin_unlock_irqrestore( &priv->dp_port_lock, flags );
@@ -1787,7 +1782,6 @@
priv = serial->port[i].private;
spin_lock_irqsave( &priv->dp_port_lock, flags );
while( serial->port[i].open_count > 0 ) {
- MOD_DEC_USE_COUNT;
--serial->port[i].open_count;
}
spin_unlock_irqrestore( &priv->dp_port_lock, flags );
diff -Nru a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
--- a/drivers/usb/serial/empeg.c Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/empeg.c Sun Jan 6 12:18:36 2002
@@ -114,6 +114,7 @@
MODULE_DEVICE_TABLE (usb, id_table);
static struct usb_serial_device_type empeg_device = {
+ owner: THIS_MODULE,
name: "Empeg",
id_table: id_table,
num_interrupt_in: 0,
@@ -159,7 +160,6 @@
down (&port->sem);
++port->open_count;
- MOD_INC_USE_COUNT;
if (port->open_count == 1) {
@@ -224,8 +224,6 @@
/* Uncomment the following line if you want to see some statistics in your
syslog */
/* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */
-
- MOD_DEC_USE_COUNT;
}
diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/ftdi_sio.c Sun Jan 6 12:18:36 2002
@@ -174,6 +174,7 @@
which share common code */
static struct usb_serial_device_type ftdi_sio_device = {
+ owner: THIS_MODULE,
name: "FTDI SIO",
id_table: id_table_sio,
num_interrupt_in: 0,
@@ -318,7 +319,6 @@
down (&port->sem);
- MOD_INC_USE_COUNT;
++port->open_count;
if (port->open_count == 1){
@@ -411,7 +411,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
} /* ftdi_sio_close */
diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c Sun Jan 6 12:18:37 2002
+++ b/drivers/usb/serial/io_edgeport.c Sun Jan 6 12:18:37 2002
@@ -985,7 +985,6 @@
return -ENODEV;
++port->open_count;
- MOD_INC_USE_COUNT;
if (port->open_count == 1) {
/* force low_latency on so that our tty_push actually forces the data
through,
@@ -999,7 +998,6 @@
edge_serial = (struct edgeport_serial *)serial->private;
if (edge_serial == NULL) {
port->open_count = 0;
- MOD_DEC_USE_COUNT;
return -ENODEV;
}
if (edge_serial->interrupt_in_buffer == NULL) {
@@ -1062,7 +1060,6 @@
err(__FUNCTION__" - error sending open port command");
edge_port->openPending = FALSE;
port->open_count = 0;
- MOD_DEC_USE_COUNT;
return -ENODEV;
}
@@ -1077,7 +1074,6 @@
dbg(__FUNCTION__" - open timedout");
edge_port->openPending = FALSE;
port->open_count = 0;
- MOD_DEC_USE_COUNT;
return -ENODEV;
}
@@ -1283,7 +1279,6 @@
port->open_count = 0;
}
- MOD_DEC_USE_COUNT;
dbg(__FUNCTION__" exited");
}
diff -Nru a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
--- a/drivers/usb/serial/io_tables.h Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/io_tables.h Sun Jan 6 12:18:36 2002
@@ -72,6 +72,7 @@
MODULE_DEVICE_TABLE (usb, id_table_combined);
static struct usb_serial_device_type edgeport_1port_device = {
+ owner: THIS_MODULE,
name: "Edgeport 1 port adapter",
id_table: edgeport_1port_id_table,
num_interrupt_in: 1,
@@ -93,6 +94,7 @@
};
static struct usb_serial_device_type edgeport_2port_device = {
+ owner: THIS_MODULE,
name: "Edgeport 2 port adapter",
id_table: edgeport_2port_id_table,
num_interrupt_in: 1,
@@ -114,6 +116,7 @@
};
static struct usb_serial_device_type edgeport_4port_device = {
+ owner: THIS_MODULE,
name: "Edgeport 4 port adapter",
id_table: edgeport_4port_id_table,
num_interrupt_in: 1,
@@ -135,6 +138,7 @@
};
static struct usb_serial_device_type edgeport_8port_device = {
+ owner: THIS_MODULE,
name: "Edgeport 8 port adapter",
id_table: edgeport_8port_id_table,
num_interrupt_in: 1,
diff -Nru a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
--- a/drivers/usb/serial/ir-usb.c Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/ir-usb.c Sun Jan 6 12:18:36 2002
@@ -91,6 +91,7 @@
struct usb_serial_device_type ir_device = {
+ owner: THIS_MODULE,
name: "IR Dongle",
id_table: id_table,
num_interrupt_in: 1,
@@ -204,7 +205,6 @@
down (&port->sem);
++port->open_count;
- MOD_INC_USE_COUNT;
if (port->open_count == 1) {
if (buffer_size) {
@@ -270,7 +270,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
}
static int ir_write (struct usb_serial_port *port, int from_user, const unsigned char
*buf, int count)
diff -Nru a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
--- a/drivers/usb/serial/keyspan.c Sun Jan 6 12:18:37 2002
+++ b/drivers/usb/serial/keyspan.c Sun Jan 6 12:18:37 2002
@@ -877,8 +877,6 @@
dbg("keyspan_open called for port%d.\n", port->number);
- MOD_INC_USE_COUNT;
-
down (&port->sem);
already_active = port->open_count;
++port->open_count;
@@ -960,8 +958,6 @@
port->tty = 0;
}
up (&port->sem);
-
- MOD_DEC_USE_COUNT;
}
@@ -1789,7 +1785,6 @@
port = &serial->port[i];
while (port->open_count > 0) {
--port->open_count;
- MOD_DEC_USE_COUNT;
}
kfree(port->private);
}
diff -Nru a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
--- a/drivers/usb/serial/keyspan.h Sun Jan 6 12:18:35 2002
+++ b/drivers/usb/serial/keyspan.h Sun Jan 6 12:18:35 2002
@@ -449,6 +449,7 @@
/* Structs for the devices, pre and post renumeration. */
static struct usb_serial_device_type keyspan_usa18x_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA18X - (without firmware)",
id_table: keyspan_usa18x_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -459,6 +460,7 @@
};
static struct usb_serial_device_type keyspan_usa19_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA19 - (without firmware)",
id_table: keyspan_usa19_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -470,6 +472,7 @@
static struct usb_serial_device_type keyspan_usa19w_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA19W - (without firmware)",
id_table: keyspan_usa19w_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -481,6 +484,7 @@
static struct usb_serial_device_type keyspan_usa28_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA28 - (without firmware)",
id_table: keyspan_usa28_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -491,6 +495,7 @@
};
static struct usb_serial_device_type keyspan_usa28x_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA28X - (without firmware)",
id_table: keyspan_usa28x_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -501,6 +506,7 @@
};
static struct usb_serial_device_type keyspan_usa28xa_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA28XA - (without firmware)",
id_table: keyspan_usa28xa_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -511,6 +517,7 @@
};
static struct usb_serial_device_type keyspan_usa28xb_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA28XB - (without firmware)",
id_table: keyspan_usa28xb_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -521,6 +528,7 @@
};
static struct usb_serial_device_type keyspan_usa49w_pre_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA49W - (without firmware)",
id_table: keyspan_usa49w_pre_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -531,6 +539,7 @@
};
static struct usb_serial_device_type keyspan_usa18x_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA18X",
id_table: keyspan_usa18x_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -554,6 +563,7 @@
};
static struct usb_serial_device_type keyspan_usa19_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA19",
id_table: keyspan_usa19_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -578,6 +588,7 @@
static struct usb_serial_device_type keyspan_usa19w_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA19W",
id_table: keyspan_usa19w_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -602,6 +613,7 @@
static struct usb_serial_device_type keyspan_usa28_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA28",
id_table: keyspan_usa28_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -617,6 +629,7 @@
static struct usb_serial_device_type keyspan_usa28x_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA28X/XB",
id_table: keyspan_usa28x_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -641,6 +654,7 @@
};
static struct usb_serial_device_type keyspan_usa28xa_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA28XA",
id_table: keyspan_usa28xa_ids,
num_interrupt_in: NUM_DONT_CARE,
@@ -665,6 +679,7 @@
};
static struct usb_serial_device_type keyspan_usa49w_device = {
+ owner: THIS_MODULE,
name: "Keyspan USA49W",
id_table: keyspan_usa49w_ids,
num_interrupt_in: NUM_DONT_CARE,
diff -Nru a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
--- a/drivers/usb/serial/keyspan_pda.c Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/keyspan_pda.c Sun Jan 6 12:18:36 2002
@@ -193,7 +193,6 @@
/* wake up other tty processes */
wake_up_interruptible( &tty->write_wait );
/* For 2.2.16 backport -- wake_up_interruptible( &tty->poll_wait ); */
- MOD_DEC_USE_COUNT;
}
static void keyspan_pda_request_unthrottle( struct usb_serial *serial )
@@ -212,7 +211,6 @@
NULL,
0,
2*HZ);
- MOD_DEC_USE_COUNT;
}
@@ -261,9 +259,7 @@
tty = serial->port[0].tty;
priv->tx_throttled = 0;
/* queue up a wakeup at scheduler time */
- MOD_INC_USE_COUNT;
- if (schedule_task(&priv->wakeup_task) == 0)
- MOD_DEC_USE_COUNT;
+ schedule_task(&priv->wakeup_task);
break;
default:
break;
@@ -602,9 +598,7 @@
if (request_unthrottle) {
priv->tx_throttled = 1; /* block writers */
- MOD_INC_USE_COUNT;
- if (schedule_task(&priv->unthrottle_task) == 0)
- MOD_DEC_USE_COUNT;
+ schedule_task(&priv->unthrottle_task);
}
rc = count;
@@ -631,9 +625,7 @@
}
/* queue up a wakeup at scheduler time */
- MOD_INC_USE_COUNT;
- if (schedule_task(&priv->wakeup_task) == 0)
- MOD_DEC_USE_COUNT;
+ schedule_task(&priv->wakeup_task);
}
@@ -672,7 +664,6 @@
down (&port->sem);
- MOD_INC_USE_COUNT;
++port->open_count;
if (port->open_count == 1) {
@@ -721,7 +712,6 @@
return rc;
error:
--port->open_count;
- MOD_DEC_USE_COUNT;
up (&port->sem);
return rc;
}
@@ -749,7 +739,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
}
diff -Nru a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
--- a/drivers/usb/serial/mct_u232.c Sun Jan 6 12:18:37 2002
+++ b/drivers/usb/serial/mct_u232.c Sun Jan 6 12:18:37 2002
@@ -144,6 +144,7 @@
static struct usb_serial_device_type mct_u232_device = {
+ owner: THIS_MODULE,
name: "Magic Control Technology USB-RS232",
id_table: id_table_combined,
num_interrupt_in: 2,
@@ -343,7 +344,6 @@
down (&port->sem);
++port->open_count;
- MOD_INC_USE_COUNT;
if (port->open_count == 1) {
/* Compensate for a hardware bug: although the Sitecom U232-P25
@@ -423,7 +423,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
} /* mct_u232_close */
diff -Nru a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
--- a/drivers/usb/serial/omninet.c Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/omninet.c Sun Jan 6 12:18:36 2002
@@ -88,6 +88,7 @@
static struct usb_serial_device_type zyxel_omninet_device = {
+ owner: THIS_MODULE,
name: "ZyXEL - omni.net lcd plus usb",
id_table: id_table,
num_interrupt_in: 1,
@@ -158,7 +159,6 @@
down (&port->sem);
- MOD_INC_USE_COUNT;
++port->open_count;
if (port->open_count == 1) {
@@ -167,7 +167,6 @@
err(__FUNCTION__"- kmalloc(%Zd) failed.", sizeof(struct
omninet_data));
port->open_count = 0;
up (&port->sem);
- MOD_DEC_USE_COUNT;
return -ENOMEM;
}
@@ -223,7 +222,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
}
diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c Sun Jan 6 12:18:36 2002
+++ b/drivers/usb/serial/pl2303.c Sun Jan 6 12:18:36 2002
@@ -116,6 +116,7 @@
/* All of the device info needed for the PL2303 SIO serial converter */
static struct usb_serial_device_type pl2303_device = {
+ owner: THIS_MODULE,
name: "PL-2303",
id_table: id_table,
num_interrupt_in: NUM_DONT_CARE,
@@ -369,7 +370,6 @@
down (&port->sem);
++port->open_count;
- MOD_INC_USE_COUNT;
if (port->open_count == 1) {
#define FISH(a,b,c,d)
\
@@ -480,7 +480,6 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
}
static int set_modem_info (struct usb_serial_port *port, unsigned int cmd, unsigned
int *value)
diff -Nru a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
--- a/drivers/usb/serial/whiteheat.c Sun Jan 6 12:18:37 2002
+++ b/drivers/usb/serial/whiteheat.c Sun Jan 6 12:18:37 2002
@@ -133,6 +133,7 @@
static void whiteheat_real_shutdown (struct usb_serial *serial);
static struct usb_serial_device_type whiteheat_fake_device = {
+ owner: THIS_MODULE,
name: "Connect Tech - WhiteHEAT - (prerenumeration)",
id_table: id_table_prerenumeration,
num_interrupt_in: NUM_DONT_CARE,
@@ -143,6 +144,7 @@
};
static struct usb_serial_device_type whiteheat_device = {
+ owner: THIS_MODULE,
name: "Connect Tech - WhiteHEAT",
id_table: id_table_std,
num_interrupt_in: NUM_DONT_CARE,
@@ -307,7 +309,6 @@
down (&port->sem);
++port->open_count;
- MOD_INC_USE_COUNT;
if (port->open_count == 1) {
/* set up some stuff for our command port */
@@ -359,7 +360,6 @@
error_exit:
--port->open_count;
- MOD_DEC_USE_COUNT;
dbg(__FUNCTION__ " - error_exit");
up (&port->sem);
@@ -391,7 +391,6 @@
usb_unlink_urb (port->read_urb);
port->open_count = 0;
}
- MOD_DEC_USE_COUNT;
up (&port->sem);
}
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel