All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make USB process hub events in correct order
@ 2004-06-15 18:26 Byron Stanoszek
  2004-06-15 20:06 ` [linux-usb-devel] " Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Byron Stanoszek @ 2004-06-15 18:26 UTC (permalink / raw)
  To: linux-usb-devel, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 5350 bytes --]

This patch fixes the USB hub module to process events in the order that they
are received. It fixes the case where multi-port devices have multiple
hubs in them--while they are detected in the correct order, they are
initialized in reverse. It is required for the Sealink 8-port USB->serial hubs
to initialize with the port numbers in the correct order.

I don't think it breaks any existing functionality, but I won't send this to
Linus yet till I know it doesn't break anything.

Patch below against 2.6.7-rc3.



--- linux/drivers/usb/core/hub.bak	2004-06-08 10:21:57.000000000 -0400
+++ linux/drivers/usb/core/hub.c	2004-06-08 10:59:34.000000000 -0400
@@ -260,7 +260,7 @@

  	/* Something happened, let khubd figure it out */
  	if (list_empty(&hub->event_list)) {
-		list_add(&hub->event_list, &hub_event_list);
+		list_add_tail(&hub->event_list, &hub_event_list);
  		wake_up(&khubd_wait);
  	}


An example without the patch (1-1.2.1 gets initialized before 1-1.1.1):

usb 1-1: new full speed USB device using address 2
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usb 1-1.1: new full speed USB device using address 3
hub 1-1.1:1.0: USB hub found
hub 1-1.1:1.0: 4 ports detected
usb 1-1.2: new full speed USB device using address 4
hub 1-1.2:1.0: USB hub found
hub 1-1.2:1.0: 4 ports detected
usb 1-1.2.1: new full speed USB device using address 5
ftdi_sio 1-1.2.1:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.1: FTDI FT232BM Compatible converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
usb 1-1.2.2: new full speed USB device using address 6
ftdi_sio 1-1.2.2:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.2: FTDI FT232BM Compatible converter now attached to ttyUSB1 (or usb/tts/1 for devfs)
usb 1-1.2.3: new full speed USB device using address 7
ftdi_sio 1-1.2.3:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.3: FTDI FT232BM Compatible converter now attached to ttyUSB2 (or usb/tts/2 for devfs)
usb 1-1.2.4: new full speed USB device using address 8
ftdi_sio 1-1.2.4:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.4: FTDI FT232BM Compatible converter now attached to ttyUSB3 (or usb/tts/3 for devfs)
usb 1-1.1.1: new full speed USB device using address 9
ftdi_sio 1-1.1.1:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.1: FTDI FT232BM Compatible converter now attached to ttyUSB4 (or usb/tts/4 for devfs)
usb 1-1.1.2: new full speed USB device using address 10
ftdi_sio 1-1.1.2:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.2: FTDI FT232BM Compatible converter now attached to ttyUSB5 (or usb/tts/5 for devfs)
usb 1-1.1.3: new full speed USB device using address 11
ftdi_sio 1-1.1.3:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.3: FTDI FT232BM Compatible converter now attached to ttyUSB6 (or usb/tts/6 for devfs)
usb 1-1.1.4: new full speed USB device using address 12
ftdi_sio 1-1.1.4:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.4: FTDI FT232BM Compatible converter now attached to ttyUSB7 (or usb/tts/7 for devfs)


With the patch (the correct ordering):

usb 1-1: new full speed USB device using address 2
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usb 1-1.1: new full speed USB device using address 3
hub 1-1.1:1.0: USB hub found
hub 1-1.1:1.0: 4 ports detected
usb 1-1.2: new full speed USB device using address 4
hub 1-1.2:1.0: USB hub found
hub 1-1.2:1.0: 4 ports detected
usb 1-1.1.1: new full speed USB device using address 5
ftdi_sio 1-1.1.1:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.1: FTDI FT232BM Compatible converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
usb 1-1.1.2: new full speed USB device using address 6
ftdi_sio 1-1.1.2:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.2: FTDI FT232BM Compatible converter now attached to ttyUSB1 (or usb/tts/1 for devfs)
usb 1-1.1.3: new full speed USB device using address 7
ftdi_sio 1-1.1.3:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.3: FTDI FT232BM Compatible converter now attached to ttyUSB2 (or usb/tts/2 for devfs)
usb 1-1.1.4: new full speed USB device using address 8
ftdi_sio 1-1.1.4:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.1.4: FTDI FT232BM Compatible converter now attached to ttyUSB3 (or usb/tts/3 for devfs)
usb 1-1.2.1: new full speed USB device using address 9
ftdi_sio 1-1.2.1:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.1: FTDI FT232BM Compatible converter now attached to ttyUSB4 (or usb/tts/4 for devfs)
usb 1-1.2.2: new full speed USB device using address 10
ftdi_sio 1-1.2.2:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.2: FTDI FT232BM Compatible converter now attached to ttyUSB5 (or usb/tts/5 for devfs)
usb 1-1.2.3: new full speed USB device using address 11
ftdi_sio 1-1.2.3:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.3: FTDI FT232BM Compatible converter now attached to ttyUSB6 (or usb/tts/6 for devfs)
usb 1-1.2.4: new full speed USB device using address 12
ftdi_sio 1-1.2.4:1.0: FTDI FT232BM Compatible converter detected
usb 1-1.2.4: FTDI FT232BM Compatible converter now attached to ttyUSB7 (or usb/tts/7 for devfs)


  -Byron

--
Byron Stanoszek                         Ph: (330) 644-3059
Systems Programmer                      Fax: (330) 644-8110
Commercial Timesharing Inc.             Email: byron@comtime.com

[-- Attachment #2: Type: TEXT/PLAIN, Size: 395 bytes --]

--- linux/drivers/usb/core/hub.bak	2004-06-08 10:21:57.000000000 -0400
+++ linux/drivers/usb/core/hub.c	2004-06-08 10:59:34.000000000 -0400
@@ -260,7 +260,7 @@
 
 	/* Something happened, let khubd figure it out */
 	if (list_empty(&hub->event_list)) {
-		list_add(&hub->event_list, &hub_event_list);
+		list_add_tail(&hub->event_list, &hub_event_list);
 		wake_up(&khubd_wait);
 	}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-15 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-15 18:26 [PATCH] Make USB process hub events in correct order Byron Stanoszek
2004-06-15 20:06 ` [linux-usb-devel] " Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.