aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-06 13:32:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-10 17:46:40 -0400
commit1143832eca8f1d64da7d85642c956ae9d25c69e1 (patch)
treee8ed5dedb8673c57d90f59c6e47df5cbc6986711 /drivers/usb/serial/usb-serial.c
parent141dc40ee343ab532717b235dd645e2d25ae3092 (diff)
USB: serial: ports: add minor and port number
The usb_serial_port structure had the number field, which was the minor number for the port, which almost no one really cared about. They really wanted the number of the port within the device, which you had to subtract from the minor of the parent usb_serial_device structure. To clean this up, provide the real minor number of the port, and the number of the port within the serial device separately, as these numbers might not be related in the future. Bonus is that this cleans up a lot of logic in the drivers, and saves lines overall. Tested-by: Tobias Winter <tobias@linuxdingsda.de> Reviewed-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -- drivers/staging/serqt_usb2/serqt_usb2.c | 21 +++-------- drivers/usb/serial/ark3116.c | 2 - drivers/usb/serial/bus.c | 6 +-- drivers/usb/serial/console.c | 2 - drivers/usb/serial/cp210x.c | 2 - drivers/usb/serial/cypress_m8.c | 4 +- drivers/usb/serial/digi_acceleport.c | 6 --- drivers/usb/serial/f81232.c | 5 +- drivers/usb/serial/garmin_gps.c | 6 +-- drivers/usb/serial/io_edgeport.c | 58 ++++++++++++-------------------- drivers/usb/serial/io_ti.c | 21 ++++------- drivers/usb/serial/keyspan.c | 29 +++++++--------- drivers/usb/serial/metro-usb.c | 4 +- drivers/usb/serial/mos7720.c | 37 +++++++++----------- drivers/usb/serial/mos7840.c | 52 +++++++++------------------- drivers/usb/serial/opticon.c | 2 - drivers/usb/serial/pl2303.c | 2 - drivers/usb/serial/quatech2.c | 7 +-- drivers/usb/serial/sierra.c | 2 - drivers/usb/serial/ti_usb_3410_5052.c | 10 ++--- drivers/usb/serial/usb-serial.c | 7 ++- drivers/usb/serial/usb_wwan.c | 2 - drivers/usb/serial/whiteheat.c | 20 +++++------ include/linux/usb/serial.h | 6 ++- 24 files changed, 133 insertions(+), 180 deletions(-)
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 5f6b1ff9d29e..a47fa715aaba 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -105,9 +105,10 @@ static struct usb_serial *get_free_serial(struct usb_serial *serial,
105 *minor = i; 105 *minor = i;
106 j = 0; 106 j = 0;
107 dev_dbg(&serial->interface->dev, "%s - minor base = %d\n", __func__, *minor); 107 dev_dbg(&serial->interface->dev, "%s - minor base = %d\n", __func__, *minor);
108 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { 108 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i, ++j) {
109 serial_table[i] = serial; 109 serial_table[i] = serial;
110 serial->port[j++]->number = i; 110 serial->port[j]->minor = i;
111 serial->port[j]->port_number = i - *minor;
111 } 112 }
112 mutex_unlock(&table_lock); 113 mutex_unlock(&table_lock);
113 return serial; 114 return serial;
@@ -1048,7 +1049,7 @@ static int usb_serial_probe(struct usb_interface *interface,
1048 /* register all of the individual ports with the driver core */ 1049 /* register all of the individual ports with the driver core */
1049 for (i = 0; i < num_ports; ++i) { 1050 for (i = 0; i < num_ports; ++i) {
1050 port = serial->port[i]; 1051 port = serial->port[i];
1051 dev_set_name(&port->dev, "ttyUSB%d", port->number); 1052 dev_set_name(&port->dev, "ttyUSB%d", port->minor);
1052 dev_dbg(ddev, "registering %s", dev_name(&port->dev)); 1053 dev_dbg(ddev, "registering %s", dev_name(&port->dev));
1053 device_enable_async_suspend(&port->dev); 1054 device_enable_async_suspend(&port->dev);
1054 1055