summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/console.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-07 11:04:28 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-17 13:30:02 -0700
commite5b1e2062e0535e8ffef79bb34d857e21380d101 (patch)
tree75376f4cb69f6a1cd05b323803ae6a1a8fc4db90 /drivers/usb/serial/console.c
parent1508124d8a4e0995362d93d82e5555a74bfc998f (diff)
downloadblackbird-obmc-linux-e5b1e2062e0535e8ffef79bb34d857e21380d101.tar.gz
blackbird-obmc-linux-e5b1e2062e0535e8ffef79bb34d857e21380d101.zip
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>
Diffstat (limited to 'drivers/usb/serial/console.c')
-rw-r--r--drivers/usb/serial/console.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 1b811022f1a1..afb50eab2049 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -108,18 +108,18 @@ static int usb_console_setup(struct console *co, char *options)
* no need to check the index here: if the index is wrong, console
* code won't call us
*/
- serial = usb_serial_get_by_index(co->index);
- if (serial == NULL) {
+ port = usb_serial_port_get_by_minor(co->index);
+ if (port == NULL) {
/* no device is connected yet, sorry :( */
pr_err("No USB device connected to ttyUSB%i\n", co->index);
return -ENODEV;
}
+ serial = port->serial;
retval = usb_autopm_get_interface(serial->interface);
if (retval)
goto error_get_interface;
- port = serial->port[co->index - serial->minor];
tty_port_tty_set(&port->port, NULL);
info->port = port;
OpenPOWER on IntegriCloud