Re: usbserial not working/oops on removal

From: Oliver Neukum
Date: Sat Mar 03 2007 - 15:45:34 EST


Am Samstag, 3. MÃrz 2007 14:27 schrieb Andreas Laumann:
> Unfortunately your fix Âdoes not work. ÂThe first one seems registered
> correctly, but after that it fails again for the next one. Â

Unfortunately the last patch I sent you introduced a race. Could you test
this alternative patch?

Regards
Oliver

--- a/drivers/usb/serial/usb-serial.c 2007-03-03 16:28:22.000000000 +0100
+++ b/drivers/usb/serial/usb-serial.c 2007-03-03 21:37:27.000000000 +0100
@@ -99,9 +99,12 @@
continue;

*minor = i;
+ j = 0;
dbg("%s - minor base = %d", __FUNCTION__, *minor);
- for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i)
+ for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
serial_table[i] = serial;
+ serial->port[j++]->number = i;
+ }
spin_unlock(&table_lock);
return serial;
}
@@ -847,7 +850,6 @@
port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
if (!port)
goto probe_error;
- port->number = i + serial->minor;
port->serial = serial;
spin_lock_init(&port->lock);
mutex_init(&port->mutex);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/