diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-07 14:04:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 16:30:02 -0400 |
commit | e5b1e2062e0535e8ffef79bb34d857e21380d101 (patch) | |
tree | 75376f4cb69f6a1cd05b323803ae6a1a8fc4db90 /drivers/usb/serial/mos7840.c | |
parent | 1508124d8a4e0995362d93d82e5555a74bfc998f (diff) |
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/mos7840.c')
-rw-r--r-- | drivers/usb/serial/mos7840.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index f981b08ff32f..0a818b238508 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -1057,7 +1057,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1057 | * structures were not set up at that time.) */ | 1057 | * structures were not set up at that time.) */ |
1058 | 1058 | ||
1059 | dev_dbg(&port->dev, "port number is %d\n", port->port_number); | 1059 | dev_dbg(&port->dev, "port number is %d\n", port->port_number); |
1060 | dev_dbg(&port->dev, "minor number is %d\n", port->serial->minor); | 1060 | dev_dbg(&port->dev, "minor number is %d\n", port->minor); |
1061 | dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress); | 1061 | dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress); |
1062 | dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress); | 1062 | dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress); |
1063 | dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress); | 1063 | dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress); |
@@ -2068,7 +2068,7 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port, | |||
2068 | memset(&tmp, 0, sizeof(tmp)); | 2068 | memset(&tmp, 0, sizeof(tmp)); |
2069 | 2069 | ||
2070 | tmp.type = PORT_16550A; | 2070 | tmp.type = PORT_16550A; |
2071 | tmp.line = mos7840_port->port->serial->minor; | 2071 | tmp.line = mos7840_port->port->minor; |
2072 | tmp.port = mos7840_port->port->port_number; | 2072 | tmp.port = mos7840_port->port->port_number; |
2073 | tmp.irq = 0; | 2073 | tmp.irq = 0; |
2074 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | 2074 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; |
@@ -2246,9 +2246,8 @@ static int mos7840_port_probe(struct usb_serial_port *port) | |||
2246 | * usb-serial.c:get_free_serial() and cannot therefore be used | 2246 | * usb-serial.c:get_free_serial() and cannot therefore be used |
2247 | * to index device instances */ | 2247 | * to index device instances */ |
2248 | mos7840_port->port_num = pnum + 1; | 2248 | mos7840_port->port_num = pnum + 1; |
2249 | dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor); | 2249 | dev_dbg(&port->dev, "port->minor = %d\n", port->minor); |
2250 | dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); | 2250 | dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); |
2251 | dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor); | ||
2252 | 2251 | ||
2253 | if (mos7840_port->port_num == 1) { | 2252 | if (mos7840_port->port_num == 1) { |
2254 | mos7840_port->SpRegOffset = 0x0; | 2253 | mos7840_port->SpRegOffset = 0x0; |