Re: [patch 2.6.21-rc5] usb-serial, ti_usb: fix usb configuration changing

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Am Montag, 2. April 2007 13:25 schrieb Al Borchers:
> Oleg --
> 
> Quoting Oleg Verych <[email protected]>:
> > OK, then i must recheck, why it works for me. Maybe it's just another
> > sysfs crap, because i tested on rc5 without any of it enabled.
> 
> You will only see the problem if you have more than one usb serial
> device.  Plug in the first device, then plug in a TI 3410 device.
> They will both try to use ttyUSB0--unplug them and you will see an
> oops.
> 
> The problem is not in your patch; the problem is in usb-serial,
> as I described.

Does this help?

	Regards
		Oliver
Signed-off-by: Oliver Neukum <[email protected]>
--------
--- linux-2.6.21-rc5/drivers/usb/serial/usb-serial.c.alt	2007-04-02 17:19:15.000000000 +0200
+++ linux-2.6.21-rc5/drivers/usb/serial/usb-serial.c	2007-04-02 17:22:20.000000000 +0200
@@ -969,17 +969,24 @@
 	} else if (num_interrupt_out) {
 		dbg("the device claims to support interrupt out transfers, but write_int_callback is not defined");
 	}
-	
-	/* if this device type has an attach function, call it */
+
+	if (get_free_serial (serial, num_ports, &minor) == NULL) {
+		dev_err(&interface->dev, "No more free serial devices\n");
+		goto probe_error;
+	}
+	serial->minor = minor;
+
+	/* if this device type has an attach function, call it
+	 * now as the minors are known but the device not registered */
 	if (type->attach) {
 		if (!try_module_get(type->driver.owner)) {
 			dev_err(&interface->dev, "module get failed, exiting\n");
-			goto probe_error;
+			goto full_error;
 		}
 		retval = type->attach (serial);
 		module_put(type->driver.owner);
 		if (retval < 0)
-			goto probe_error;
+			goto full_error;
 		if (retval > 0) {
 			/* quietly accept this device, but don't bind to a serial port
 			 * as it's about to disappear */
@@ -987,12 +994,6 @@
 		}
 	}
 
-	if (get_free_serial (serial, num_ports, &minor) == NULL) {
-		dev_err(&interface->dev, "No more free serial devices\n");
-		goto probe_error;
-	}
-	serial->minor = minor;
-
 	/* register all of the individual ports with the driver core */
 	for (i = 0; i < num_ports; ++i) {
 		port = serial->port[i];
@@ -1016,6 +1017,8 @@
 	usb_set_intfdata (interface, serial);
 	return 0;
 
+full_error:
+	return_serial(serial);
 probe_error:
 	for (i = 0; i < num_bulk_in; ++i) {
 		port = serial->port[i];

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.