USB: serial: make minor allocation dynamic
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Jun 2013 18:04:28 +0000 (11:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 20:30:02 +0000 (13:30 -0700)
commite5b1e2062e0535e8ffef79bb34d857e21380d101
tree75376f4cb69f6a1cd05b323803ae6a1a8fc4db90
parent1508124d8a4e0995362d93d82e5555a74bfc998f
USB: serial: make minor allocation dynamic

This moves the allocation of minor device numbers from a static array to
be dynamic, using the idr interface.  This means that you could
potentially get "gaps" in a minor number range for a single USB serial
device with multiple ports, but all should still work properly.

We remove the 'minor' field from the usb_serial structure, as it no
longer makes any sense for it (use the field in the usb_serial_port
structure if you really want to know this number), and take the fact
that we were overloading a number in this field to determine if we had
initialized the minor numbers or not, and just use a flag variable
instead.

Note, we still have the limitation of 255 USB to serial devices in the
system, as that is all we are registering with the TTY layer at this
point in time.

Tested-by: Tobias Winter <tobias@linuxdingsda.de>
Reviewed-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 files changed:
drivers/staging/serqt_usb2/serqt_usb2.c
drivers/usb/serial/ark3116.c
drivers/usb/serial/console.c
drivers/usb/serial/f81232.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_ti.c
drivers/usb/serial/mos7720.c
drivers/usb/serial/mos7840.c
drivers/usb/serial/opticon.c
drivers/usb/serial/pl2303.c
drivers/usb/serial/quatech2.c
drivers/usb/serial/ssu100.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/usb-serial.c
drivers/usb/serial/usb_wwan.c
drivers/usb/serial/whiteheat.c
include/linux/usb/serial.h