Hi,
Here's a patch against 2.4.9-ac13 that fixes a long standing bug with
the module use count of the usb-serial core. If after applying this
patch, anyone has a problem of the usbserial module usage being wrong,
please let me know. Users of the pl2303 usb-serial driver really need
this patch :)
thanks,
greg k-h
diff -Nru a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c
--- a/drivers/usb/serial/usbserial.c Fri Sep 21 16:35:05 2001
+++ b/drivers/usb/serial/usbserial.c Fri Sep 21 16:35:05 2001
@@ -505,8 +505,6 @@
return -ENODEV;
}
- MOD_INC_USE_COUNT;
-
/* set up our port structure making the tty driver remember our port object,
and us it */
portNumber = MINOR(tty->device) - serial->minor;
port = &serial->port[portNumber];
@@ -544,8 +542,6 @@
} else {
generic_close(port, filp);
}
-
- MOD_DEC_USE_COUNT;
}
@@ -768,7 +764,10 @@
if (port_paranoia_check (port, __FUNCTION__))
return -ENODEV;
- MOD_INC_USE_COUNT;
+ /* only increment our usage count, if this device is _really_ a generic device
+*/
+ if ((serial->dev->descriptor.idVendor == vendor) &&
+ (serial->dev->descriptor.idProduct == product))
+ MOD_INC_USE_COUNT;
dbg(__FUNCTION__ " - port %d", port->number);
@@ -828,7 +827,11 @@
}
up (&port->sem);
- MOD_DEC_USE_COUNT;
+
+ /* only decrement our usage count, if this device is _really_ a generic device
+*/
+ if ((serial->dev->descriptor.idVendor == vendor) &&
+ (serial->dev->descriptor.idProduct == product))
+ MOD_DEC_USE_COUNT;
}