Skip to contentSkip to conversation

linux-3.9.3 - hit limit of 255 usb->serial devices

PATCH In review Tobias Winter 7 participants 13 messages May 24, 2013 – Jun 4, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi there,

since my propblem is with usb to serial adapters I was unsure if this is the right place. If not, please let me know.

After equipping a server with a lot of ftdi singleport usb2serial devices, I ran into a serial device limit that is included in include/linux/usb/serial.h .

The limit of devices seems to be 255, resulting in ttyUSB254 to be the last supported device.

The codesnippet in question is:

#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ #define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */

I successfully modified it to support 256 devices and fail gracefully afterward:

#define SERIAL_TTY_MINORS 256 /* loads of devices :) */ #define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */

That results in the following dmesg output:

[..]
usb 1-8.4.4.4.3: Detected FT232BM
usb 1-8.4.4.4.3: Number of endpoints 2
usb 1-8.4.4.4.3: Endpoint 1 MaxPacketSize 64
usb 1-8.4.4.4.3: Endpoint 2 MaxPacketSize 64
usb 1-8.4.4.4.3: Setting MaxPacketSize 64
usb 1-8.4.4.4.3: FTDI USB Serial Device converter now attached to ttyUSB254 hub 1-8.4.4.4:1.0: port 4, status 0101, change 0000, 12 Mb/s usb 1-8.4.4.4.4: new full-speed USB device number 91 using ehci-pci usb 1-8.4.4.4.4: ep0 maxpacket = 8
usb 1-8.4.4.4.4: default language 0x0409
usb 1-8.4.4.4.4: udev 91, busnum 1, minor = 90
usb 1-8.4.4.4.4: New USB device found, idVendor=0403, idProduct=6001 usb 1-8.4.4.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-8.4.4.4.4: Product: USB <-> Serial
usb 1-8.4.4.4.4: Manufacturer: FTDI
usb 1-8.4.4.4.4: usb_probe_device
usb 1-8.4.4.4.4: configuration #1 chosen from 1 choice
usb 1-8.4.4.4.4: adding 1-8.4.4.4.4:1.0 (config #1, interface 0) ftdi_sio 1-8.4.4.4.4:1.0: usb_probe_interface
ftdi_sio 1-8.4.4.4.4:1.0: usb_probe_interface - got id
ftdi_sio 1-8.4.4.4.4:1.0: FTDI USB Serial Device converter detected usb 1-8.4.4.4.4: Detected FT232BM
usb 1-8.4.4.4.4: Number of endpoints 2
usb 1-8.4.4.4.4: Endpoint 1 MaxPacketSize 64
usb 1-8.4.4.4.4: Endpoint 2 MaxPacketSize 64
usb 1-8.4.4.4.4: Setting MaxPacketSize 64
usb 1-8.4.4.4.4: FTDI USB Serial Device converter now attached to ttyUSB255

If any further devices are connected, I get the expected error that no more free sedrial devices are there.

hub 4-1.1:1.0: state 7 ports 4 chg 001e evt 0000
hub 4-1.1:1.0: port 1, status 0101, change 0000, 12 Mb/s usb 4-1.1.1: new full-speed USB device number 89 using uhci_hcd usb 4-1.1.1: ep0 maxpacket = 8
usb 4-1.1.1: default language 0x0409
usb 4-1.1.1: udev 89, busnum 4, minor = 472
usb 4-1.1.1: New USB device found, idVendor=0403, idProduct=6001 usb 4-1.1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 4-1.1.1: Product: FT232R USB UART
usb 4-1.1.1: Manufacturer: FTDI
usb 4-1.1.1: SerialNumber: A500EG03
usb 4-1.1.1: usb_probe_device
usb 4-1.1.1: configuration #1 chosen from 1 choice
usb 4-1.1.1: adding 4-1.1.1:1.0 (config #1, interface 0) ftdi_sio 4-1.1.1:1.0: usb_probe_interface
ftdi_sio 4-1.1.1:1.0: usb_probe_interface - got id ftdi_sio 4-1.1.1:1.0: FTDI USB Serial Device converter detected ftdi_sio 4-1.1.1:1.0: No more free serial devices
ftdi_sio: probe of 4-1.1.1:1.0 failed with error -5
hub 4-1.1:1.0: port 2, status 0101, change 0000, 12 Mb/s usb 4-1.1.2: new full-speed USB device number 90 using uhci_hcd usb 4-1.1.2: ep0 maxpacket = 8
usb 4-1.1.2: default language 0x0409
usb 4-1.1.2: udev 90, busnum 4, minor = 473
usb 4-1.1.2: New USB device found, idVendor=0403, idProduct=6001 usb 4-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 4-1.1.2: Product: FT232R USB UART
usb 4-1.1.2: Manufacturer: FTDI
usb 4-1.1.2: SerialNumber: A500EG07
usb 4-1.1.2: usb_probe_device
usb 4-1.1.2: configuration #1 chosen from 1 choice
usb 4-1.1.2: adding 4-1.1.2:1.0 (config #1, interface 0) ftdi_sio 4-1.1.2:1.0: usb_probe_interface
ftdi_sio 4-1.1.2:1.0: usb_probe_interface - got id ftdi_sio 4-1.1.2:1.0: FTDI USB Serial Device converter detected ftdi_sio 4-1.1.2:1.0: No more free serial devices
ftdi_sio: probe of 4-1.1.2:1.0 failed with error -5

and so on.

Output of lsusb | sort with 256 usb2serial devices connected:
http://pastebin.com/wqrYUbwZ

In case you end up agreeing with me that there are no reasons to limit the devices to 255, would you be inclined to fix this in the main kernel tree? Do I have to open up a bug somewhere?

I also tried increasing the numbers further but I run into rollover issues as the kernel tries to reassign ttyUSB0 ttyUSB1 which is already taken. It seems without some other modification 256 devices is the limit?

Thanks for your efforts!

Tobias

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 006: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 007: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 001 Device 008: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 009: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 010: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 011: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 012: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 013: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 014: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 015: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 016: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 017: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 018: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 019: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 020: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 021: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 022: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 023: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 024: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 025: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 026: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 027: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 001 Device 028: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 029: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 030: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 031: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 032: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 033: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 034: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 035: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 036: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 037: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 038: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 039: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 040: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 041: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 042: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 043: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 044: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 045: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 046: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 047: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 048: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 049: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 050: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 051: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 052: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 053: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 054: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 055: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 056: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 057: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 058: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 059: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 060: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 061: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 062: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 063: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 064: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 065: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 066: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 067: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 068: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 069: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 070: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 071: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 072: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 073: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 074: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 075: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 076: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 077: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 078: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 079: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 080: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 081: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 082: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 083: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 084: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 085: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 086: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 087: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 088: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 089: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 090: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 001 Device 091: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 002 Device 003: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 004: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 005: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 006: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 007: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 008: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 009: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 010: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 011: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 012: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 013: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 014: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 015: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 016: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 017: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 018: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 019: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 020: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 021: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 022: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 002 Device 023: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 024: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 025: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 026: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 027: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 028: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 029: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 030: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 031: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 032: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 033: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 034: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 035: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 036: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 037: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 038: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 039: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 040: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 041: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 042: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 043: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 044: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 045: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 046: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 047: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 048: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 049: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 050: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 051: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 052: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 053: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 054: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 055: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 056: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 057: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 058: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 059: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 060: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 061: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 062: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 063: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 064: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 065: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 066: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 067: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 068: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 069: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 070: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 071: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 072: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 073: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 074: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 075: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 076: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 077: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 078: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 079: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 080: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 081: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 082: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 083: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 084: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 085: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 002 Device 086: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 413c:1003 Dell Computer Corp. Keyboard Hub
Bus 003 Device 003: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 003 Device 004: ID 413c:2010 Dell Computer Corp. Keyboard
Bus 003 Device 005: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 006: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 007: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 008: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 009: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 010: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 011: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 012: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 013: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 014: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 015: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 016: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 017: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 018: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 019: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 020: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 021: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 022: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 023: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 024: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 003 Device 025: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 026: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 027: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 028: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 029: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 030: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 031: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 032: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 033: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 034: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 035: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 036: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 037: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 038: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 039: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 040: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 041: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 042: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 043: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 044: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 045: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 046: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 047: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 048: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 049: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 050: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 051: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 052: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 053: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 054: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 055: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 056: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 057: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 058: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 059: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 060: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 061: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 062: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 063: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 064: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 065: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 066: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 067: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 068: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 069: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 070: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 071: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 072: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 073: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 074: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 075: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 076: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 077: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 078: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 079: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 080: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 081: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 082: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 083: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 084: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 085: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 086: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 087: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 088: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 0451:2046 Texas Instruments, Inc. TUSB2046 Hub
Bus 004 Device 003: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 004: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 005: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 006: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 007: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 008: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 009: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 010: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 011: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 012: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 013: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 014: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 015: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 016: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 017: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 018: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 019: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 020: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 021: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 022: ID 03eb:3301 Atmel Corp. at43301 4-Port Hub
Bus 004 Device 023: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 024: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 025: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 026: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 027: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 028: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 029: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 030: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 031: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 032: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 033: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 034: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 035: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 036: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 037: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 038: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 039: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 040: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 041: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 042: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 043: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 044: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 045: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 046: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 047: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 048: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 049: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 050: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 051: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 052: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 053: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 054: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 055: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 056: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 057: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 058: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 059: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 060: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 061: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 062: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 063: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 064: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 065: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 066: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 067: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 068: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 069: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 070: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 071: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 072: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 073: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 074: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 075: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 076: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 077: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 078: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 079: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 080: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 081: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 082: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 083: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 084: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 085: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 004 Device 086: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

maintainer
#1 lore raw
Quoted 4 lines · Tobias Winter

Hi there,

since my propblem is with usb to serial adapters I was unsure if this is the right place. If not, please let me know.

Not really, linux-usb@ is the proper one, I've included that on the cc:

Quoted 11 lines

After equipping a server with a lot of ftdi singleport usb2serial devices, I ran into a serial device limit that is included in include/linux/usb/serial.h .

The limit of devices seems to be 255, resulting in ttyUSB254 to be the last supported device.

The codesnippet in question is:

#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ #define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */

Yes, that's the limit of usb-serial devices in the system at the moment. In 10+ years, no one has complained yet, so it's been a good number :)

Quoted 2 lines

Output of lsusb | sort with 256 usb2serial devices connected:
http://pastebin.com/wqrYUbwZ

Nice job.

Quoted 3 lines

In case you end up agreeing with me that there are no reasons to limit the devices to 255, would you be inclined to fix this in the main kernel tree? Do I have to open up a bug somewhere?

You can send a patch making the number dynamic, that would be great to have.

Quoted 3 lines

I also tried increasing the numbers further but I run into rollover issues as the kernel tries to reassign ttyUSB0 ttyUSB1 which is already taken. It seems without some other modification 256 devices is the limit?

Yes, there might be some limits in the tty layer as well for only 256 tty devices, but I haven't looked there in a long time, perhaps that is now no longer the case.

Quoted 1 line

Bus 001 Device 091: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

I'm just glad to see we can support 91 different devices on a single root hub, that's good to see, as I don't think anyone has tested that in a very long time :)

thanks,

greg k-h

#2 lore raw

PATCH 1/1 Raise the maximum number of usb-serial devices to 256

Raise the maximum number of usb-serial devices to 256, which is the actual limit supported by the codebase.

---
 include/linux/usb/serial.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/usb/serial.h +1 -1
index 302ddf5..c0ce5ed 100644
@@ -20,7 +20,7 @@
 #include <linux/kfifo.h>
 
 #define SERIAL_TTY_MAJOR       188     /* Nice legal number now */
-#define SERIAL_TTY_MINORS      254     /* loads of devices :) */
+#define SERIAL_TTY_MINORS      256     /* loads of devices :) */
 #define SERIAL_TTY_NO_MINOR    255     /* No minor was assigned */
 
 /* The maximum number of ports one device can grab at once */
Signature · 1 line
1.7.10.4
#3 lore raw

Re: [PATCH] Raise the maximum number of usb-serial devices to 256

Quoted 15 lines · Tobias Winter

Raise the maximum number of usb-serial devices to 256, which is the actual limit supported by the codebase.

---
 include/linux/usb/serial.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/usb/serial.h +0 -0
index 302ddf5..c0ce5ed 100644

include/linux/usb/serial.h line 24

Quoted 6 lines
include/linux/usb/serial.h +1 -1
@@ -20,7 +20,7 @@
 #include <linux/kfifo.h>
 
 #define SERIAL_TTY_MAJOR       188     /* Nice legal number now */
-#define SERIAL_TTY_MINORS      254     /* loads of devices :) */
+#define SERIAL_TTY_MINORS      256     /* loads of devices :) */
 #define SERIAL_TTY_NO_MINOR    255     /* No minor was assigned */

So SERIAL_TTY_NO_MINOR is now a valid minor?

Rob

#4 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

Quoted 3 lines · Bjørn Mork

But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by about a decade or so), because I thought we needed the "rage" logic that the usb-serial minor reservation does.

But I'm not so sure anymore, so here's a patch to change to use the idr code, and should remove all minor number limitations (well 65k is the limit the tty core should be setting I think.)

Tobias, can you test this patch out? Note, I only compiled it, did not get the chance to actually run it, so it might not work at all.

thanks,

greg k-h

Subject: [PATCH] usb: serial: remove minor number limitation of 255

 drivers/usb/serial/usb-serial.c |   86 +++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 48 deletions(-)
drivers/usb/serial/usb-serial.c +38 -48
index 4753c00..74b6f08 100644
@@ -37,6 +37,7 @@
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
 #include <linux/kfifo.h>
+#include <linux/idr.h>
 #include "pl2303.h"
 
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <[email protected]>"
@@ -49,7 +50,7 @@
    drivers depend on it.
 */
 
-static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
+static DEFINE_IDR(serial_minors);
 static DEFINE_MUTEX(table_lock);
 static LIST_HEAD(usb_serial_driver_list);
 
@@ -61,59 +62,52 @@ static LIST_HEAD(usb_serial_driver_list);
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
 	struct usb_serial *serial;
+	struct usb_serial_port *port;
 
 	mutex_lock(&table_lock);
-	serial = serial_table[index];
-
-	if (serial) {
-		mutex_lock(&serial->disc_mutex);
-		if (serial->disconnected) {
-			mutex_unlock(&serial->disc_mutex);
-			serial = NULL;
-		} else {
-			kref_get(&serial->kref);
-		}
-	}
+	port = idr_find(&serial_minors, index);
 	mutex_unlock(&table_lock);
+	if (!port)
+		return NULL;
+
+	serial = port->serial;
+	kref_get(&serial->kref);
 	return serial;
 }
 
-static struct usb_serial *get_free_serial(struct usb_serial *serial,
-					int num_ports, unsigned int *minor)
+static int get_free_port(struct usb_serial_port *port)
 {
-	unsigned int i, j;
-	int good_spot;
-
-	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+	int i;
 
-	*minor = 0;
 	mutex_lock(&table_lock);
-	for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
-		if (serial_table[i])
-			continue;
+	i = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL);
+	if (i < 0)
+		return -EEXIST;
+	port->number = i;
+	mutex_unlock(&table_lock);
+	return i;
+}
 
-		good_spot = 1;
-		for (j = 1; j <= num_ports-1; ++j)
-			if ((i+j >= SERIAL_TTY_MINORS) || (serial_table[i+j])) {
-				good_spot = 0;
-				i += j;
-				break;
-			}
-		if (good_spot == 0)
-			continue;
+static int get_free_serial(struct usb_serial *serial, int num_ports,
+			   unsigned int *minor)
+{
+	unsigned int i;
+	unsigned int x;
 
-		*minor = i;
-		j = 0;
-		dev_dbg(&serial->interface->dev, "%s - minor base = %d\n", __func__, *minor);
-		for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
-			serial_table[i] = serial;
-			serial->port[j++]->number = i;
-		}
-		mutex_unlock(&table_lock);
-		return serial;
+	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+
+	*minor = 0xffffffff;
+	for (i = 0; i < num_ports; ++i) {
+		x = get_free_port(serial->port[i]);
+		if (x < 0)
+			goto error;
+		if (*minor == 0xffffffff)
+			*minor = x;
 	}
-	mutex_unlock(&table_lock);
-	return NULL;
+	return 0;
+error:
+	// FIXME unwind the already allocated minors
+	return -ENODEV;
 }
 
 static void return_serial(struct usb_serial *serial)
@@ -122,7 +116,7 @@ static void return_serial(struct usb_serial *serial)
 
 	mutex_lock(&table_lock);
 	for (i = 0; i < serial->num_ports; ++i)
-		serial_table[serial->minor + i] = NULL;
+		idr_remove(&serial_minors, serial->port[i]->number);
 	mutex_unlock(&table_lock);
 }
 
@@ -1041,7 +1035,7 @@ static int usb_serial_probe(struct usb_interface *interface,
 	 */
 	serial->disconnected = 1;
 
-	if (get_free_serial(serial, num_ports, &minor) == NULL) {
+	if (get_free_serial(serial, num_ports, &minor)) {
 		dev_err(ddev, "No more free serial devices\n");
 		goto probe_error;
 	}
@@ -1225,7 +1219,6 @@ static struct usb_driver usb_serial_driver = {
 
 static int __init usb_serial_init(void)
 {
-	int i;
 	int result;
 
 	usb_serial_tty_driver = alloc_tty_driver(SERIAL_TTY_MINORS);
@@ -1233,9 +1226,6 @@ static int __init usb_serial_init(void)
 		return -ENOMEM;
 
 	/* Initialize our global data */
-	for (i = 0; i < SERIAL_TTY_MINORS; ++i)
-		serial_table[i] = NULL;
-
 	result = bus_register(&usb_serial_bus_type);
 	if (result) {
 		pr_err("%s - registering bus driver failed\n", __func__);
#5 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

Quoted 8 lines · Greg Kroah-Hartman
Quoted 3 lines · Bjørn Mork

But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by about a decade or so), because I thought we needed the "rage" logic that the usb-serial minor reservation does.

Rage logic sounds like my kinda code.

Quoted 10 lines
drivers/usb/serial/usb-serial.c +2 -5
+static int get_free_port(struct usb_serial_port *port)
 {
-	unsigned int i, j;
-	int good_spot;
-
-	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+	int i;
 
-	*minor = 0;
 	mutex_lock(&table_lock);

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 89

Quoted 10 lines
drivers/usb/serial/usb-serial.c +7 -3
-	for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
-		if (serial_table[i])
-			continue;
+	i = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL);
+	if (i < 0)
+		return -EEXIST;
+	port->number = i;
+	mutex_unlock(&table_lock);
+	return i;
+}

-EEXIST case misses the mutex unlock.

Dave

#6 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

Quoted 11 lines · Dave Jones
Quoted 8 lines · Greg Kroah-Hartman
Quoted 3 lines · Bjørn Mork

But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by about a decade or so), because I thought we needed the "rage" logic that the usb-serial minor reservation does.

Rage logic sounds like my kinda code.

Late nite typo :)

Quoted 8 lines
Quoted 8 lines
drivers/usb/serial/usb-serial.c +2 -4
+static int get_free_port(struct usb_serial_port *port)
 {
-	unsigned int i, j;
-	int good_spot;
-
-	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+	int i;
Quoted 14 lines

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 89

Quoted 12 lines
drivers/usb/serial/usb-serial.c +7 -4
-	*minor = 0;
 	mutex_lock(&table_lock);
-	for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
-		if (serial_table[i])
-			continue;
+	i = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL);
+	if (i < 0)
+		return -EEXIST;
+	port->number = i;
+	mutex_unlock(&table_lock);
+	return i;
+}

-EEXIST case misses the mutex unlock.

Thanks, now fixed.

greg k-h

#7 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

In reply to Greg KH
Quoted 9 lines · Greg KH
Quoted 3 lines · Bjørn Mork

But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by about a decade or so), because I thought we needed the "rage" logic that the usb-serial minor reservation does.

Quoted 6 lines

But I'm not so sure anymore, so here's a patch to change to use the idr code, and should remove all minor number limitations (well 65k is the limit the tty core should be setting I think.)

Tobias, can you test this patch out? Note, I only compiled it, did not get the chance to actually run it, so it might not work at all.

I'm afraid this won't work in it's current form. Several drivers and parts of usb-serial core still depend on the minor numbers being consecutive for multi-port devices. There are also still references to SERIAL_TTY_NO_MINOR (255) as well as SERIAL_TTY_MINORS that need to be addressed.

Quoted 51 lines

thanks,

greg k-h

Subject: [PATCH] usb: serial: remove minor number limitation of 255

 drivers/usb/serial/usb-serial.c |   86 +++++++++++++++++-----------------------
 1 file changed, 38 insertions(+), 48 deletions(-)
drivers/usb/serial/usb-serial.c +3 -11
index 4753c00..74b6f08 100644
@@ -37,6 +37,7 @@
 #include <linux/usb.h>
 #include <linux/usb/serial.h>
 #include <linux/kfifo.h>
+#include <linux/idr.h>
 #include "pl2303.h"
 
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <[email protected]>"
@@ -49,7 +50,7 @@
    drivers depend on it.
 */
 
-static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
+static DEFINE_IDR(serial_minors);
 static DEFINE_MUTEX(table_lock);
 static LIST_HEAD(usb_serial_driver_list);
 
@@ -61,59 +62,52 @@ static LIST_HEAD(usb_serial_driver_list);
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
 	struct usb_serial *serial;
+	struct usb_serial_port *port;
 
 	mutex_lock(&table_lock);
-	serial = serial_table[index];
-
-	if (serial) {
-		mutex_lock(&serial->disc_mutex);
-		if (serial->disconnected) {
-			mutex_unlock(&serial->disc_mutex);
-			serial = NULL;
-		} else {
-			kref_get(&serial->kref);
-		}

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 76

Quoted 10 lines
drivers/usb/serial/usb-serial.c +6 -1
-	}
+	port = idr_find(&serial_minors, index);
 	mutex_unlock(&table_lock);
+	if (!port)
+		return NULL;
+
+	serial = port->serial;
+	kref_get(&serial->kref);
 	return serial;
 }

We would still need to handle disconnect, and make sure to return with the disc_mutex held unless disconnected.

Quoted 8 lines
drivers/usb/serial/usb-serial.c +1 -5
-static struct usb_serial *get_free_serial(struct usb_serial *serial,
-					int num_ports, unsigned int *minor)
+static int get_free_port(struct usb_serial_port *port)
 {
-	unsigned int i, j;
-	int good_spot;
-

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 84

Quoted 10 lines
drivers/usb/serial/usb-serial.c +3 -5
-	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+	int i;
 
-	*minor = 0;
 	mutex_lock(&table_lock);
-	for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
-		if (serial_table[i])
-			continue;
+	i = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL);
+	if (i < 0)

Missing mutex unlock (as already Dave noted).

Quoted 37 lines
drivers/usb/serial/usb-serial.c +17 -18
+		return -EEXIST;
+	port->number = i;
+	mutex_unlock(&table_lock);
+	return i;
+}
 
-		good_spot = 1;
-		for (j = 1; j <= num_ports-1; ++j)
-			if ((i+j >= SERIAL_TTY_MINORS) || (serial_table[i+j])) {
-				good_spot = 0;
-				i += j;
-				break;
-			}
-		if (good_spot == 0)
-			continue;
+static int get_free_serial(struct usb_serial *serial, int num_ports,
+			   unsigned int *minor)
+{
+	unsigned int i;
+	unsigned int x;
 
-		*minor = i;
-		j = 0;
-		dev_dbg(&serial->interface->dev, "%s - minor base = %d\n", __func__, *minor);
-		for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
-			serial_table[i] = serial;
-			serial->port[j++]->number = i;
-		}
-		mutex_unlock(&table_lock);
-		return serial;
+	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+
+	*minor = 0xffffffff;
+	for (i = 0; i < num_ports; ++i) {
+		x = get_free_port(serial->port[i]);
+		if (x < 0)
+			goto error;

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 111

Quoted 10 lines
drivers/usb/serial/usb-serial.c +6 -2
+		if (*minor == 0xffffffff)
+			*minor = x;
 	}
-	mutex_unlock(&table_lock);
-	return NULL;
+	return 0;
+error:
+	// FIXME unwind the already allocated minors
+	return -ENODEV;
 }

As mentioned above, usb-serial core and several drivers currently depend on us returning the first minor in a consecutive range. It's mostly used to determine the per device port index, so storing that index in the port structure could possibly be sufficient.

Quoted 29 lines
drivers/usb/serial/usb-serial.c +2 -3
 static void return_serial(struct usb_serial *serial)
@@ -122,7 +116,7 @@ static void return_serial(struct usb_serial *serial)
 
 	mutex_lock(&table_lock);
 	for (i = 0; i < serial->num_ports; ++i)
-		serial_table[serial->minor + i] = NULL;
+		idr_remove(&serial_minors, serial->port[i]->number);
 	mutex_unlock(&table_lock);
 }
 
@@ -1041,7 +1035,7 @@ static int usb_serial_probe(struct usb_interface *interface,
 	 */
 	serial->disconnected = 1;
 
-	if (get_free_serial(serial, num_ports, &minor) == NULL) {
+	if (get_free_serial(serial, num_ports, &minor)) {
 		dev_err(ddev, "No more free serial devices\n");
 		goto probe_error;
 	}
@@ -1225,7 +1219,6 @@ static struct usb_driver usb_serial_driver = {
 
 static int __init usb_serial_init(void)
 {
-	int i;
 	int result;
 
 	usb_serial_tty_driver = alloc_tty_driver(SERIAL_TTY_MINORS);

drivers/usb/serial/usb-serial.c static int __init usb_serial_init(void) · line 1228

Quoted 3 lines
drivers/usb/serial/usb-serial.c +0 -0
@@ -1233,9 +1226,6 @@ static int __init usb_serial_init(void)
 		return -ENOMEM;
 
 	/* Initialize our global data */

You could remove the above comment as well.

drivers/usb/serial/usb-serial.c static int __init usb_serial_init(void) · line 1231

Quoted 6 lines
drivers/usb/serial/usb-serial.c +0 -3
-	for (i = 0; i < SERIAL_TTY_MINORS; ++i)
-		serial_table[i] = NULL;
-
 	result = bus_register(&usb_serial_bus_type);
 	if (result) {
 		pr_err("%s - registering bus driver failed\n", __func__);

Thanks,
Johan

#8 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

Quoted 14 lines · Johan Hovold
Quoted 13 lines · Greg KH
Quoted 3 lines · Bjørn Mork

But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by about a decade or so), because I thought we needed the "rage" logic that the usb-serial minor reservation does.

But I'm not so sure anymore, so here's a patch to change to use the idr code, and should remove all minor number limitations (well 65k is the limit the tty core should be setting I think.)

Quoted 6 lines
Quoted 2 lines

Tobias, can you test this patch out? Note, I only compiled it, did not get the chance to actually run it, so it might not work at all.

I'm afraid this won't work in it's current form. Several drivers and parts of usb-serial core still depend on the minor numbers being consecutive for multi-port devices.

You are right, let me go fix up the "port->number" assumption first, which will let this become easier. That should have been fixed a long time ago.

Quoted 2 lines

There are also still references to SERIAL_TTY_NO_MINOR (255) as well as SERIAL_TTY_MINORS that need to be addressed.

Yeah, I knew it was too good to be true that a simple 45 line patch would solve this properly :)

Quoted 4 lines
Quoted 4 lines
drivers/usb/serial/usb-serial.c +3 -0
+	port = idr_find(&serial_minors, index);
 	mutex_unlock(&table_lock);
+	if (!port)
+		return NULL;
Quoted 8 lines

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 76

Quoted 5 lines
drivers/usb/serial/usb-serial.c +3 -0
+
+	serial = port->serial;
+	kref_get(&serial->kref);
 	return serial;
 }

We would still need to handle disconnect, and make sure to return with the disc_mutex held unless disconnected.

Alan noticed this as well, I've now fixed that, thanks.

Quoted 14 lines
Quoted 14 lines
drivers/usb/serial/usb-serial.c +11 -2
+	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
+
+	*minor = 0xffffffff;
+	for (i = 0; i < num_ports; ++i) {
+		x = get_free_port(serial->port[i]);
+		if (x < 0)
+			goto error;
+		if (*minor == 0xffffffff)
+			*minor = x;
 	}
-	mutex_unlock(&table_lock);
-	return NULL;
+	return 0;
+error:
Quoted 8 lines

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 111

Quoted 3 lines
drivers/usb/serial/usb-serial.c +2 -0
+	// FIXME unwind the already allocated minors
+	return -ENODEV;
 }

As mentioned above, usb-serial core and several drivers currently depend on us returning the first minor in a consecutive range. It's mostly used to determine the per device port index, so storing that index in the port structure could possibly be sufficient.

Yes, I'll go fix that up first, before making these changes, as it's independant.

Quoted 11 lines

drivers/usb/serial/usb-serial.c static int __init usb_serial_init(void) · line 1228

Quoted 4 lines
drivers/usb/serial/usb-serial.c +0 -0
@@ -1233,9 +1226,6 @@ static int __init usb_serial_init(void)
 		return -ENOMEM;
 
 	/* Initialize our global data */

You could remove the above comment as well.

drivers/usb/serial/usb-serial.c static int __init usb_serial_init(void) · line 1229

Quoted 4 lines
drivers/usb/serial/usb-serial.c +0 -3
-	for (i = 0; i < SERIAL_TTY_MINORS; ++i)
-		serial_table[i] = NULL;
-
 	result = bus_register(&usb_serial_bus_type);

I thought about it, but we also register the bus variables, and some other things here as well, so I left it in.

thanks for the review.

greg k-h

#9 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

In reply to Greg KH
Quoted 38 lines · Greg KH
Quoted 3 lines · Bj�rn Mork

But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by about a decade or so), because I thought we needed the "rage" logic that the usb-serial minor reservation does.

But I'm not so sure anymore, so here's a patch to change to use the idr code, and should remove all minor number limitations (well 65k is the limit the tty core should be setting I think.)

Tobias, can you test this patch out? Note, I only compiled it, did not get the chance to actually run it, so it might not work at all.

thanks,

greg k-h

drivers/usb/serial/usb-serial.c +1 -10
@@ -61,59 +62,52 @@ static LIST_HEAD(usb_serial_driver_list);
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
 	struct usb_serial *serial;
+	struct usb_serial_port *port;
 
 	mutex_lock(&table_lock);
-	serial = serial_table[index];
-
-	if (serial) {
-		mutex_lock(&serial->disc_mutex);
-		if (serial->disconnected) {
-			mutex_unlock(&serial->disc_mutex);
-			serial = NULL;
-		} else {
-			kref_get(&serial->kref);
-		}

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 76

Quoted 10 lines
drivers/usb/serial/usb-serial.c +6 -1
-	}
+	port = idr_find(&serial_minors, index);
 	mutex_unlock(&table_lock);
+	if (!port)
+		return NULL;
+
+	serial = port->serial;
+	kref_get(&serial->kref);
 	return serial;
 }

The test for serial->disconnected got lost. And the locking isn't right; the routine is documented to return with serial->disc_mutex held (in the case where the device hasn't been disconnected).

Also, the kref_get() needs to occur within the scope of the table_lock.

I didn't check the rest of the patch for similar errors. Finding three in the first function seemed like enough. :-)

Alan Stern

#10 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

Quoted 55 lines · Alan Stern
Quoted 38 lines · Greg KH
Quoted 3 lines · Bj?rn Mork

But, IMHO, a nicer approach would be to make the allocation completely dynamic, using e.g. the idr subsystem. Static tables are always feel like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by about a decade or so), because I thought we needed the "rage" logic that the usb-serial minor reservation does.

But I'm not so sure anymore, so here's a patch to change to use the idr code, and should remove all minor number limitations (well 65k is the limit the tty core should be setting I think.)

Tobias, can you test this patch out? Note, I only compiled it, did not get the chance to actually run it, so it might not work at all.

thanks,

greg k-h

drivers/usb/serial/usb-serial.c +1 -10
@@ -61,59 +62,52 @@ static LIST_HEAD(usb_serial_driver_list);
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
 	struct usb_serial *serial;
+	struct usb_serial_port *port;
 
 	mutex_lock(&table_lock);
-	serial = serial_table[index];
-
-	if (serial) {
-		mutex_lock(&serial->disc_mutex);
-		if (serial->disconnected) {
-			mutex_unlock(&serial->disc_mutex);
-			serial = NULL;
-		} else {
-			kref_get(&serial->kref);
-		}

drivers/usb/serial/usb-serial.c static LIST_HEAD(usb_serial_driver_list); · line 76

Quoted 10 lines
drivers/usb/serial/usb-serial.c +6 -1
-	}
+	port = idr_find(&serial_minors, index);
 	mutex_unlock(&table_lock);
+	if (!port)
+		return NULL;
+
+	serial = port->serial;
+	kref_get(&serial->kref);
 	return serial;
 }

The test for serial->disconnected got lost. And the locking isn't right; the routine is documented to return with serial->disc_mutex held (in the case where the device hasn't been disconnected).

Quoted 1 line

Also, the kref_get() needs to occur within the scope of the table_lock.

Thanks, for some reason I ignored this when converting the code, that's what I get for not even testing...

Quoted 2 lines

I didn't check the rest of the patch for similar errors. Finding three in the first function seemed like enough. :-)

Fair enough, I've now fixed this up, and will see if it runs properly.

thanks,

greg k-h

#11 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

In reply to Greg KH
Quoted 2 lines · Greg KH

Tobias, can you test this patch out? Note, I only compiled it, did not get the chance to actually run it, so it might not work at all.

Sure, I'll gladly give it a try. Seeing the comments on the code, I'm just wondering if there might be a more recent version to run?

Quoted 3 lines

But I'm not so sure anymore, so here's a patch to change to use the idr code, and should remove all minor number limitations (well 65k is the limit the tty core should be setting I think.)

That's a tough one to break :)

Tobias

#12 lore raw

Re: [RFC] raise the maximum number of usb-serial devices to 512

Quoted 6 lines · Tobias Winter
Quoted 2 lines · Greg KH

Tobias, can you test this patch out? Note, I only compiled it, did not get the chance to actually run it, so it might not work at all.

Sure, I'll gladly give it a try. Seeing the comments on the code, I'm just wondering if there might be a more recent version to run?

Give me a day, it's going to take some more reworks to get this all to work properly, I'll send a new patch series then.

thanks,

greg k-h