diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-06 13:32:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-10 17:46:40 -0400 |
commit | 1143832eca8f1d64da7d85642c956ae9d25c69e1 (patch) | |
tree | e8ed5dedb8673c57d90f59c6e47df5cbc6986711 | |
parent | 141dc40ee343ab532717b235dd645e2d25ae3092 (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(-)
24 files changed, 133 insertions, 180 deletions
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 8a6e5ea476e1..4f891dba2faa 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c | |||
@@ -873,7 +873,7 @@ static int qt_open(struct tty_struct *tty, | |||
873 | result = qt_get_device(serial, &port0->DeviceData); | 873 | result = qt_get_device(serial, &port0->DeviceData); |
874 | 874 | ||
875 | /* Port specific setups */ | 875 | /* Port specific setups */ |
876 | result = qt_open_channel(serial, port->number, &ChannelData); | 876 | result = qt_open_channel(serial, port->port_number, &ChannelData); |
877 | if (result < 0) { | 877 | if (result < 0) { |
878 | dev_dbg(&port->dev, "qt_open_channel failed\n"); | 878 | dev_dbg(&port->dev, "qt_open_channel failed\n"); |
879 | return result; | 879 | return result; |
@@ -888,7 +888,7 @@ static int qt_open(struct tty_struct *tty, | |||
888 | (SERIAL_MSR_CTS | SERIAL_MSR_DSR | SERIAL_MSR_RI | SERIAL_MSR_CD); | 888 | (SERIAL_MSR_CTS | SERIAL_MSR_DSR | SERIAL_MSR_RI | SERIAL_MSR_CD); |
889 | 889 | ||
890 | /* Set Baud rate to default and turn off (default)flow control here */ | 890 | /* Set Baud rate to default and turn off (default)flow control here */ |
891 | result = qt_setuart(serial, port->number, DEFAULT_DIVISOR, DEFAULT_LCR); | 891 | result = qt_setuart(serial, port->port_number, DEFAULT_DIVISOR, DEFAULT_LCR); |
892 | if (result < 0) { | 892 | if (result < 0) { |
893 | dev_dbg(&port->dev, "qt_setuart failed\n"); | 893 | dev_dbg(&port->dev, "qt_setuart failed\n"); |
894 | return result; | 894 | return result; |
@@ -906,7 +906,6 @@ static int qt_open(struct tty_struct *tty, | |||
906 | qt_submit_urb_from_open(serial, port); | 906 | qt_submit_urb_from_open(serial, port); |
907 | } | 907 | } |
908 | 908 | ||
909 | dev_dbg(&port->dev, "port number is %d\n", port->number); | ||
910 | dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor); | 909 | dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor); |
911 | dev_dbg(&port->dev, | 910 | dev_dbg(&port->dev, |
912 | "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress); | 911 | "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress); |
@@ -1022,14 +1021,11 @@ static void qt_close(struct usb_serial_port *port) | |||
1022 | /* Close uart channel */ | 1021 | /* Close uart channel */ |
1023 | status = qt_close_channel(serial, index); | 1022 | status = qt_close_channel(serial, index); |
1024 | if (status < 0) | 1023 | if (status < 0) |
1025 | dev_dbg(&port->dev, | 1024 | dev_dbg(&port->dev, "%s - qt_close_channel failed.\n", __func__); |
1026 | "%s - port %d qt_close_channel failed.\n", | ||
1027 | __func__, port->number); | ||
1028 | 1025 | ||
1029 | port0->open_ports--; | 1026 | port0->open_ports--; |
1030 | 1027 | ||
1031 | dev_dbg(&port->dev, "qt_num_open_ports in close%d:in port%d\n", | 1028 | dev_dbg(&port->dev, "qt_num_open_ports in close%d\n", port0->open_ports); |
1032 | port0->open_ports, port->number); | ||
1033 | 1029 | ||
1034 | if (port0->open_ports == 0) { | 1030 | if (port0->open_ports == 0) { |
1035 | if (serial->port[0]->interrupt_in_urb) { | 1031 | if (serial->port[0]->interrupt_in_urb) { |
@@ -1169,8 +1165,7 @@ static int qt_ioctl(struct tty_struct *tty, | |||
1169 | return 0; | 1165 | return 0; |
1170 | } | 1166 | } |
1171 | 1167 | ||
1172 | dev_dbg(&port->dev, "%s -No ioctl for that one. port = %d\n", | 1168 | dev_dbg(&port->dev, "%s -No ioctl for that one.\n", __func__); |
1173 | __func__, port->number); | ||
1174 | return -ENOIOCTLCMD; | 1169 | return -ENOIOCTLCMD; |
1175 | } | 1170 | } |
1176 | 1171 | ||
@@ -1245,8 +1240,7 @@ static void qt_set_termios(struct tty_struct *tty, | |||
1245 | 1240 | ||
1246 | /* Now determine flow control */ | 1241 | /* Now determine flow control */ |
1247 | if (cflag & CRTSCTS) { | 1242 | if (cflag & CRTSCTS) { |
1248 | dev_dbg(&port->dev, "%s - Enabling HW flow control port %d\n", | 1243 | dev_dbg(&port->dev, "%s - Enabling HW flow control\n", __func__); |
1249 | __func__, port->number); | ||
1250 | 1244 | ||
1251 | /* Enable RTS/CTS flow control */ | 1245 | /* Enable RTS/CTS flow control */ |
1252 | status = BoxSetHW_FlowCtrl(port->serial, index, 1); | 1246 | status = BoxSetHW_FlowCtrl(port->serial, index, 1); |
@@ -1258,8 +1252,7 @@ static void qt_set_termios(struct tty_struct *tty, | |||
1258 | } else { | 1252 | } else { |
1259 | /* Disable RTS/CTS flow control */ | 1253 | /* Disable RTS/CTS flow control */ |
1260 | dev_dbg(&port->dev, | 1254 | dev_dbg(&port->dev, |
1261 | "%s - disabling HW flow control port %d\n", | 1255 | "%s - disabling HW flow control\n", __func__); |
1262 | __func__, port->number); | ||
1263 | 1256 | ||
1264 | status = BoxSetHW_FlowCtrl(port->serial, index, 0); | 1257 | status = BoxSetHW_FlowCtrl(port->serial, index, 0); |
1265 | if (status < 0) { | 1258 | if (status < 0) { |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 40e7fd94646f..293a7706ba3f 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -414,7 +414,7 @@ static int ark3116_ioctl(struct tty_struct *tty, | |||
414 | memset(&serstruct, 0, sizeof(serstruct)); | 414 | memset(&serstruct, 0, sizeof(serstruct)); |
415 | serstruct.type = PORT_16654; | 415 | serstruct.type = PORT_16654; |
416 | serstruct.line = port->serial->minor; | 416 | serstruct.line = port->serial->minor; |
417 | serstruct.port = port->number; | 417 | serstruct.port = port->port_number; |
418 | serstruct.custom_divisor = 0; | 418 | serstruct.custom_divisor = 0; |
419 | serstruct.baud_base = 460800; | 419 | serstruct.baud_base = 460800; |
420 | 420 | ||
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 3c4db6d196c6..f053b302a00d 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -43,7 +43,7 @@ static ssize_t show_port_number(struct device *dev, | |||
43 | { | 43 | { |
44 | struct usb_serial_port *port = to_usb_serial_port(dev); | 44 | struct usb_serial_port *port = to_usb_serial_port(dev); |
45 | 45 | ||
46 | return sprintf(buf, "%d\n", port->number - port->serial->minor); | 46 | return sprintf(buf, "%d\n", port->port_number); |
47 | } | 47 | } |
48 | 48 | ||
49 | static DEVICE_ATTR(port_number, S_IRUGO, show_port_number, NULL); | 49 | static DEVICE_ATTR(port_number, S_IRUGO, show_port_number, NULL); |
@@ -80,7 +80,7 @@ static int usb_serial_device_probe(struct device *dev) | |||
80 | goto exit_with_autopm; | 80 | goto exit_with_autopm; |
81 | } | 81 | } |
82 | 82 | ||
83 | minor = port->number; | 83 | minor = port->minor; |
84 | tty_register_device(usb_serial_tty_driver, minor, dev); | 84 | tty_register_device(usb_serial_tty_driver, minor, dev); |
85 | dev_info(&port->serial->dev->dev, | 85 | dev_info(&port->serial->dev->dev, |
86 | "%s converter now attached to ttyUSB%d\n", | 86 | "%s converter now attached to ttyUSB%d\n", |
@@ -106,7 +106,7 @@ static int usb_serial_device_remove(struct device *dev) | |||
106 | /* make sure suspend/resume doesn't race against port_remove */ | 106 | /* make sure suspend/resume doesn't race against port_remove */ |
107 | usb_autopm_get_interface(port->serial->interface); | 107 | usb_autopm_get_interface(port->serial->interface); |
108 | 108 | ||
109 | minor = port->number; | 109 | minor = port->minor; |
110 | tty_unregister_device(usb_serial_tty_driver, minor); | 110 | tty_unregister_device(usb_serial_tty_driver, minor); |
111 | 111 | ||
112 | device_remove_file(&port->dev, &dev_attr_port_number); | 112 | device_remove_file(&port->dev, &dev_attr_port_number); |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 5f3bcd31e204..1b811022f1a1 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -210,7 +210,7 @@ static void usb_console_write(struct console *co, | |||
210 | if (count == 0) | 210 | if (count == 0) |
211 | return; | 211 | return; |
212 | 212 | ||
213 | pr_debug("%s - port %d, %d byte(s)\n", __func__, port->number, count); | 213 | pr_debug("%s - minor %d, %d byte(s)\n", __func__, port->minor, count); |
214 | 214 | ||
215 | if (!port->port.console) { | 215 | if (!port->port.console) { |
216 | pr_debug("%s - port not opened\n", __func__); | 216 | pr_debug("%s - port not opened\n", __func__); |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 2c659553c07c..d6ef2f8da37d 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -666,8 +666,6 @@ static void cp210x_set_termios(struct tty_struct *tty, | |||
666 | unsigned int bits; | 666 | unsigned int bits; |
667 | unsigned int modem_ctl[4]; | 667 | unsigned int modem_ctl[4]; |
668 | 668 | ||
669 | dev_dbg(dev, "%s - port %d\n", __func__, port->number); | ||
670 | |||
671 | if (!tty) | 669 | if (!tty) |
672 | return; | 670 | return; |
673 | 671 | ||
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 082120198f87..e948dc02795d 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -435,7 +435,7 @@ static void cypress_set_dead(struct usb_serial_port *port) | |||
435 | spin_unlock_irqrestore(&priv->lock, flags); | 435 | spin_unlock_irqrestore(&priv->lock, flags); |
436 | 436 | ||
437 | dev_err(&port->dev, "cypress_m8 suspending failing port %d - " | 437 | dev_err(&port->dev, "cypress_m8 suspending failing port %d - " |
438 | "interval might be too short\n", port->number); | 438 | "interval might be too short\n", port->port_number); |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
@@ -667,7 +667,7 @@ static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
667 | { | 667 | { |
668 | struct cypress_private *priv = usb_get_serial_port_data(port); | 668 | struct cypress_private *priv = usb_get_serial_port_data(port); |
669 | 669 | ||
670 | dev_dbg(&port->dev, "%s - port %d, %d bytes\n", __func__, port->number, count); | 670 | dev_dbg(&port->dev, "%s - %d bytes\n", __func__, count); |
671 | 671 | ||
672 | /* line control commands, which need to be executed immediately, | 672 | /* line control commands, which need to be executed immediately, |
673 | are not put into the buffer for obvious reasons. | 673 | are not put into the buffer for obvious reasons. |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 7b807d389527..19b467fe0388 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -1304,11 +1304,7 @@ static void digi_release(struct usb_serial *serial) | |||
1304 | 1304 | ||
1305 | static int digi_port_probe(struct usb_serial_port *port) | 1305 | static int digi_port_probe(struct usb_serial_port *port) |
1306 | { | 1306 | { |
1307 | unsigned port_num; | 1307 | return digi_port_init(port, port->port_number); |
1308 | |||
1309 | port_num = port->number - port->serial->minor; | ||
1310 | |||
1311 | return digi_port_init(port, port_num); | ||
1312 | } | 1308 | } |
1313 | 1309 | ||
1314 | static int digi_port_remove(struct usb_serial_port *port) | 1310 | static int digi_port_remove(struct usb_serial_port *port) |
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 090b411d893f..350dfcb5fa62 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
@@ -288,15 +288,14 @@ static int f81232_ioctl(struct tty_struct *tty, | |||
288 | struct serial_struct ser; | 288 | struct serial_struct ser; |
289 | struct usb_serial_port *port = tty->driver_data; | 289 | struct usb_serial_port *port = tty->driver_data; |
290 | 290 | ||
291 | dev_dbg(&port->dev, "%s (%d) cmd = 0x%04x\n", __func__, | 291 | dev_dbg(&port->dev, "%s cmd = 0x%04x\n", __func__, cmd); |
292 | port->number, cmd); | ||
293 | 292 | ||
294 | switch (cmd) { | 293 | switch (cmd) { |
295 | case TIOCGSERIAL: | 294 | case TIOCGSERIAL: |
296 | memset(&ser, 0, sizeof ser); | 295 | memset(&ser, 0, sizeof ser); |
297 | ser.type = PORT_16654; | 296 | ser.type = PORT_16654; |
298 | ser.line = port->serial->minor; | 297 | ser.line = port->serial->minor; |
299 | ser.port = port->number; | 298 | ser.port = port->port_number; |
300 | ser.baud_base = 460800; | 299 | ser.baud_base = 460800; |
301 | 300 | ||
302 | if (copy_to_user((void __user *)arg, &ser, sizeof ser)) | 301 | if (copy_to_user((void __user *)arg, &ser, sizeof ser)) |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index b110c573ea85..04b5ed90ffb2 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -948,9 +948,9 @@ static void garmin_close(struct usb_serial_port *port) | |||
948 | { | 948 | { |
949 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); | 949 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); |
950 | 950 | ||
951 | dev_dbg(&port->dev, "%s - port %d - mode=%d state=%d flags=0x%X\n", | 951 | dev_dbg(&port->dev, "%s - mode=%d state=%d flags=0x%X\n", |
952 | __func__, port->number, garmin_data_p->mode, | 952 | __func__, garmin_data_p->mode, garmin_data_p->state, |
953 | garmin_data_p->state, garmin_data_p->flags); | 953 | garmin_data_p->flags); |
954 | 954 | ||
955 | garmin_clear(garmin_data_p); | 955 | garmin_clear(garmin_data_p); |
956 | 956 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 1477e8593476..0c27ff3d2e8f 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -915,8 +915,8 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
915 | return -ENOMEM; | 915 | return -ENOMEM; |
916 | } | 916 | } |
917 | 917 | ||
918 | dev_dbg(dev, "%s(%d) - Initialize TX fifo to %d bytes\n", | 918 | dev_dbg(dev, "%s - Initialize TX fifo to %d bytes\n", |
919 | __func__, port->number, edge_port->maxTxCredits); | 919 | __func__, edge_port->maxTxCredits); |
920 | 920 | ||
921 | return 0; | 921 | return 0; |
922 | } | 922 | } |
@@ -1122,9 +1122,8 @@ static int edge_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1122 | copySize = min((unsigned int)count, | 1122 | copySize = min((unsigned int)count, |
1123 | (edge_port->txCredits - fifo->count)); | 1123 | (edge_port->txCredits - fifo->count)); |
1124 | 1124 | ||
1125 | dev_dbg(&port->dev, "%s(%d) of %d byte(s) Fifo room %d -- will copy %d bytes\n", | 1125 | dev_dbg(&port->dev, "%s of %d byte(s) Fifo room %d -- will copy %d bytes\n", |
1126 | __func__, port->number, count, | 1126 | __func__, count, edge_port->txCredits - fifo->count, copySize); |
1127 | edge_port->txCredits - fifo->count, copySize); | ||
1128 | 1127 | ||
1129 | /* catch writes of 0 bytes which the tty driver likes to give us, | 1128 | /* catch writes of 0 bytes which the tty driver likes to give us, |
1130 | and when txCredits is empty */ | 1129 | and when txCredits is empty */ |
@@ -1216,9 +1215,8 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, | |||
1216 | if (edge_port->write_in_progress || | 1215 | if (edge_port->write_in_progress || |
1217 | !edge_port->open || | 1216 | !edge_port->open || |
1218 | (fifo->count == 0)) { | 1217 | (fifo->count == 0)) { |
1219 | dev_dbg(dev, "%s(%d) EXIT - fifo %d, PendingWrite = %d\n", | 1218 | dev_dbg(dev, "%s EXIT - fifo %d, PendingWrite = %d\n", |
1220 | __func__, edge_port->port->number, | 1219 | __func__, fifo->count, edge_port->write_in_progress); |
1221 | fifo->count, edge_port->write_in_progress); | ||
1222 | goto exit_send; | 1220 | goto exit_send; |
1223 | } | 1221 | } |
1224 | 1222 | ||
@@ -1230,9 +1228,8 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, | |||
1230 | * it's better to wait for more credits so we can do a larger write. | 1228 | * it's better to wait for more credits so we can do a larger write. |
1231 | */ | 1229 | */ |
1232 | if (edge_port->txCredits < EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(edge_port->maxTxCredits, EDGE_FW_BULK_MAX_PACKET_SIZE)) { | 1230 | if (edge_port->txCredits < EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(edge_port->maxTxCredits, EDGE_FW_BULK_MAX_PACKET_SIZE)) { |
1233 | dev_dbg(dev, "%s(%d) Not enough credit - fifo %d TxCredit %d\n", | 1231 | dev_dbg(dev, "%s Not enough credit - fifo %d TxCredit %d\n", |
1234 | __func__, edge_port->port->number, fifo->count, | 1232 | __func__, fifo->count, edge_port->txCredits); |
1235 | edge_port->txCredits); | ||
1236 | goto exit_send; | 1233 | goto exit_send; |
1237 | } | 1234 | } |
1238 | 1235 | ||
@@ -1256,10 +1253,8 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, | |||
1256 | edge_port->write_in_progress = false; | 1253 | edge_port->write_in_progress = false; |
1257 | goto exit_send; | 1254 | goto exit_send; |
1258 | } | 1255 | } |
1259 | buffer[0] = IOSP_BUILD_DATA_HDR1(edge_port->port->number | 1256 | buffer[0] = IOSP_BUILD_DATA_HDR1(edge_port->port->port_number, count); |
1260 | - edge_port->port->serial->minor, count); | 1257 | buffer[1] = IOSP_BUILD_DATA_HDR2(edge_port->port->port_number, count); |
1261 | buffer[1] = IOSP_BUILD_DATA_HDR2(edge_port->port->number | ||
1262 | - edge_port->port->serial->minor, count); | ||
1263 | 1258 | ||
1264 | /* now copy our data */ | 1259 | /* now copy our data */ |
1265 | bytesleft = fifo->size - fifo->tail; | 1260 | bytesleft = fifo->size - fifo->tail; |
@@ -1377,8 +1372,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty) | |||
1377 | edge_port->txfifo.count; | 1372 | edge_port->txfifo.count; |
1378 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 1373 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
1379 | if (num_chars) { | 1374 | if (num_chars) { |
1380 | dev_dbg(&port->dev, "%s(port %d) - returns %d\n", __func__, | 1375 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, num_chars); |
1381 | port->number, num_chars); | ||
1382 | } | 1376 | } |
1383 | 1377 | ||
1384 | return num_chars; | 1378 | return num_chars; |
@@ -1576,7 +1570,7 @@ static int get_serial_info(struct edgeport_port *edge_port, | |||
1576 | 1570 | ||
1577 | tmp.type = PORT_16550A; | 1571 | tmp.type = PORT_16550A; |
1578 | tmp.line = edge_port->port->serial->minor; | 1572 | tmp.line = edge_port->port->serial->minor; |
1579 | tmp.port = edge_port->port->number; | 1573 | tmp.port = edge_port->port->port_number; |
1580 | tmp.irq = 0; | 1574 | tmp.irq = 0; |
1581 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | 1575 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; |
1582 | tmp.xmit_fifo_size = edge_port->maxTxCredits; | 1576 | tmp.xmit_fifo_size = edge_port->maxTxCredits; |
@@ -1601,15 +1595,15 @@ static int edge_ioctl(struct tty_struct *tty, | |||
1601 | DEFINE_WAIT(wait); | 1595 | DEFINE_WAIT(wait); |
1602 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 1596 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
1603 | 1597 | ||
1604 | dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd); | 1598 | dev_dbg(&port->dev, "%s - cmd = 0x%x\n", __func__, cmd); |
1605 | 1599 | ||
1606 | switch (cmd) { | 1600 | switch (cmd) { |
1607 | case TIOCSERGETLSR: | 1601 | case TIOCSERGETLSR: |
1608 | dev_dbg(&port->dev, "%s (%d) TIOCSERGETLSR\n", __func__, port->number); | 1602 | dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__); |
1609 | return get_lsr_info(edge_port, (unsigned int __user *) arg); | 1603 | return get_lsr_info(edge_port, (unsigned int __user *) arg); |
1610 | 1604 | ||
1611 | case TIOCGSERIAL: | 1605 | case TIOCGSERIAL: |
1612 | dev_dbg(&port->dev, "%s (%d) TIOCGSERIAL\n", __func__, port->number); | 1606 | dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__); |
1613 | return get_serial_info(edge_port, (struct serial_struct __user *) arg); | 1607 | return get_serial_info(edge_port, (struct serial_struct __user *) arg); |
1614 | } | 1608 | } |
1615 | return -ENOIOCTLCMD; | 1609 | return -ENOIOCTLCMD; |
@@ -2181,9 +2175,8 @@ static int send_iosp_ext_cmd(struct edgeport_port *edge_port, | |||
2181 | 2175 | ||
2182 | currentCommand = buffer; | 2176 | currentCommand = buffer; |
2183 | 2177 | ||
2184 | MAKE_CMD_EXT_CMD(¤tCommand, &length, | 2178 | MAKE_CMD_EXT_CMD(¤tCommand, &length, edge_port->port->port_number, |
2185 | edge_port->port->number - edge_port->port->serial->minor, | 2179 | command, param); |
2186 | command, param); | ||
2187 | 2180 | ||
2188 | status = write_cmd_usb(edge_port, buffer, length); | 2181 | status = write_cmd_usb(edge_port, buffer, length); |
2189 | if (status) { | 2182 | if (status) { |
@@ -2266,18 +2259,16 @@ static int send_cmd_write_baud_rate(struct edgeport_port *edge_port, | |||
2266 | int cmdLen = 0; | 2259 | int cmdLen = 0; |
2267 | int divisor; | 2260 | int divisor; |
2268 | int status; | 2261 | int status; |
2269 | unsigned char number = | 2262 | u32 number = edge_port->port->port_number; |
2270 | edge_port->port->number - edge_port->port->serial->minor; | ||
2271 | 2263 | ||
2272 | if (edge_serial->is_epic && | 2264 | if (edge_serial->is_epic && |
2273 | !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) { | 2265 | !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) { |
2274 | dev_dbg(dev, "SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d\n", | 2266 | dev_dbg(dev, "SendCmdWriteBaudRate - NOT Setting baud rate for port, baud = %d\n", |
2275 | edge_port->port->number, baudRate); | 2267 | baudRate); |
2276 | return 0; | 2268 | return 0; |
2277 | } | 2269 | } |
2278 | 2270 | ||
2279 | dev_dbg(dev, "%s - port = %d, baud = %d\n", __func__, | 2271 | dev_dbg(dev, "%s - baud = %d\n", __func__, baudRate); |
2280 | edge_port->port->number, baudRate); | ||
2281 | 2272 | ||
2282 | status = calc_baud_rate_divisor(dev, baudRate, &divisor); | 2273 | status = calc_baud_rate_divisor(dev, baudRate, &divisor); |
2283 | if (status) { | 2274 | if (status) { |
@@ -2388,9 +2379,8 @@ static int send_cmd_write_uart_register(struct edgeport_port *edge_port, | |||
2388 | currCmd = cmdBuffer; | 2379 | currCmd = cmdBuffer; |
2389 | 2380 | ||
2390 | /* Build a cmd in the buffer to write the given register */ | 2381 | /* Build a cmd in the buffer to write the given register */ |
2391 | MAKE_CMD_WRITE_REG(&currCmd, &cmdLen, | 2382 | MAKE_CMD_WRITE_REG(&currCmd, &cmdLen, edge_port->port->port_number, |
2392 | edge_port->port->number - edge_port->port->serial->minor, | 2383 | regNum, regValue); |
2393 | regNum, regValue); | ||
2394 | 2384 | ||
2395 | status = write_cmd_usb(edge_port, cmdBuffer, cmdLen); | 2385 | status = write_cmd_usb(edge_port, cmdBuffer, cmdLen); |
2396 | if (status) { | 2386 | if (status) { |
@@ -2424,8 +2414,6 @@ static void change_port_settings(struct tty_struct *tty, | |||
2424 | __u8 txFlow; | 2414 | __u8 txFlow; |
2425 | int status; | 2415 | int status; |
2426 | 2416 | ||
2427 | dev_dbg(dev, "%s - port %d\n", __func__, edge_port->port->number); | ||
2428 | |||
2429 | if (!edge_port->open && | 2417 | if (!edge_port->open && |
2430 | !edge_port->openPending) { | 2418 | !edge_port->openPending) { |
2431 | dev_dbg(dev, "%s - port not opened\n", __func__); | 2419 | dev_dbg(dev, "%s - port not opened\n", __func__); |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 1be6ba7bee27..d32bf2b7f988 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -259,7 +259,7 @@ static int send_cmd(struct usb_device *dev, __u8 command, | |||
259 | /* clear tx/rx buffers and fifo in TI UMP */ | 259 | /* clear tx/rx buffers and fifo in TI UMP */ |
260 | static int purge_port(struct usb_serial_port *port, __u16 mask) | 260 | static int purge_port(struct usb_serial_port *port, __u16 mask) |
261 | { | 261 | { |
262 | int port_number = port->number - port->serial->minor; | 262 | int port_number = port->port_number; |
263 | 263 | ||
264 | dev_dbg(&port->dev, "%s - port %d, mask %x\n", __func__, port_number, mask); | 264 | dev_dbg(&port->dev, "%s - port %d, mask %x\n", __func__, port_number, mask); |
265 | 265 | ||
@@ -1392,7 +1392,8 @@ stayinbootmode: | |||
1392 | 1392 | ||
1393 | static int ti_do_config(struct edgeport_port *port, int feature, int on) | 1393 | static int ti_do_config(struct edgeport_port *port, int feature, int on) |
1394 | { | 1394 | { |
1395 | int port_number = port->port->number - port->port->serial->minor; | 1395 | int port_number = port->port->port_number; |
1396 | |||
1396 | on = !!on; /* 1 or 0 not bitmask */ | 1397 | on = !!on; /* 1 or 0 not bitmask */ |
1397 | return send_cmd(port->port->serial->dev, | 1398 | return send_cmd(port->port->serial->dev, |
1398 | feature, (__u8)(UMPM_UART1_PORT + port_number), | 1399 | feature, (__u8)(UMPM_UART1_PORT + port_number), |
@@ -1637,7 +1638,7 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
1637 | return; | 1638 | return; |
1638 | } | 1639 | } |
1639 | 1640 | ||
1640 | port_number = edge_port->port->number - edge_port->port->serial->minor; | 1641 | port_number = edge_port->port->port_number; |
1641 | 1642 | ||
1642 | if (edge_port->lsr_event) { | 1643 | if (edge_port->lsr_event) { |
1643 | edge_port->lsr_event = 0; | 1644 | edge_port->lsr_event = 0; |
@@ -1730,7 +1731,7 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1730 | if (edge_port == NULL) | 1731 | if (edge_port == NULL) |
1731 | return -ENODEV; | 1732 | return -ENODEV; |
1732 | 1733 | ||
1733 | port_number = port->number - port->serial->minor; | 1734 | port_number = port->port_number; |
1734 | switch (port_number) { | 1735 | switch (port_number) { |
1735 | case 0: | 1736 | case 0: |
1736 | edge_port->uart_base = UMPMEM_BASE_UART1; | 1737 | edge_port->uart_base = UMPMEM_BASE_UART1; |
@@ -1908,7 +1909,7 @@ static void edge_close(struct usb_serial_port *port) | |||
1908 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); | 1909 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
1909 | 1910 | ||
1910 | dev_dbg(&port->dev, "%s - send umpc_close_port\n", __func__); | 1911 | dev_dbg(&port->dev, "%s - send umpc_close_port\n", __func__); |
1911 | port_number = port->number - port->serial->minor; | 1912 | port_number = port->port_number; |
1912 | send_cmd(serial->dev, UMPC_CLOSE_PORT, | 1913 | send_cmd(serial->dev, UMPC_CLOSE_PORT, |
1913 | (__u8)(UMPM_UART1_PORT + port_number), 0, NULL, 0); | 1914 | (__u8)(UMPM_UART1_PORT + port_number), 0, NULL, 0); |
1914 | 1915 | ||
@@ -2137,10 +2138,7 @@ static void change_port_settings(struct tty_struct *tty, | |||
2137 | int baud; | 2138 | int baud; |
2138 | unsigned cflag; | 2139 | unsigned cflag; |
2139 | int status; | 2140 | int status; |
2140 | int port_number = edge_port->port->number - | 2141 | int port_number = edge_port->port->port_number; |
2141 | edge_port->port->serial->minor; | ||
2142 | |||
2143 | dev_dbg(dev, "%s - port %d\n", __func__, edge_port->port->number); | ||
2144 | 2142 | ||
2145 | config = kmalloc (sizeof (*config), GFP_KERNEL); | 2143 | config = kmalloc (sizeof (*config), GFP_KERNEL); |
2146 | if (!config) { | 2144 | if (!config) { |
@@ -2284,7 +2282,6 @@ static void edge_set_termios(struct tty_struct *tty, | |||
2284 | tty->termios.c_cflag, tty->termios.c_iflag); | 2282 | tty->termios.c_cflag, tty->termios.c_iflag); |
2285 | dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, | 2283 | dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, |
2286 | old_termios->c_cflag, old_termios->c_iflag); | 2284 | old_termios->c_cflag, old_termios->c_iflag); |
2287 | dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); | ||
2288 | 2285 | ||
2289 | if (edge_port == NULL) | 2286 | if (edge_port == NULL) |
2290 | return; | 2287 | return; |
@@ -2367,7 +2364,7 @@ static int get_serial_info(struct edgeport_port *edge_port, | |||
2367 | 2364 | ||
2368 | tmp.type = PORT_16550A; | 2365 | tmp.type = PORT_16550A; |
2369 | tmp.line = edge_port->port->serial->minor; | 2366 | tmp.line = edge_port->port->serial->minor; |
2370 | tmp.port = edge_port->port->number; | 2367 | tmp.port = edge_port->port->port_number; |
2371 | tmp.irq = 0; | 2368 | tmp.irq = 0; |
2372 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | 2369 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; |
2373 | tmp.xmit_fifo_size = edge_port->port->bulk_out_size; | 2370 | tmp.xmit_fifo_size = edge_port->port->bulk_out_size; |
@@ -2386,7 +2383,7 @@ static int edge_ioctl(struct tty_struct *tty, | |||
2386 | struct usb_serial_port *port = tty->driver_data; | 2383 | struct usb_serial_port *port = tty->driver_data; |
2387 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 2384 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
2388 | 2385 | ||
2389 | dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd); | 2386 | dev_dbg(&port->dev, "%s - cmd = 0x%x\n", __func__, cmd); |
2390 | 2387 | ||
2391 | switch (cmd) { | 2388 | switch (cmd) { |
2392 | case TIOCGSERIAL: | 2389 | case TIOCGSERIAL: |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 28365e647168..5a979729f8ec 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -152,7 +152,7 @@ static void keyspan_set_termios(struct tty_struct *tty, | |||
152 | p_priv = usb_get_serial_port_data(port); | 152 | p_priv = usb_get_serial_port_data(port); |
153 | d_details = p_priv->device_details; | 153 | d_details = p_priv->device_details; |
154 | cflag = tty->termios.c_cflag; | 154 | cflag = tty->termios.c_cflag; |
155 | device_port = port->number - port->serial->minor; | 155 | device_port = port->port_number; |
156 | 156 | ||
157 | /* Baud rate calculation takes baud rate as an integer | 157 | /* Baud rate calculation takes baud rate as an integer |
158 | so other rates can be generated if desired. */ | 158 | so other rates can be generated if desired. */ |
@@ -234,8 +234,8 @@ static int keyspan_write(struct tty_struct *tty, | |||
234 | dataOffset = 1; | 234 | dataOffset = 1; |
235 | } | 235 | } |
236 | 236 | ||
237 | dev_dbg(&port->dev, "%s - for port %d (%d chars), flip=%d\n", | 237 | dev_dbg(&port->dev, "%s - %d chars, flip=%d\n", __func__, count, |
238 | __func__, port->number, count, p_priv->out_flip); | 238 | p_priv->out_flip); |
239 | 239 | ||
240 | for (left = count; left > 0; left -= todo) { | 240 | for (left = count; left > 0; left -= todo) { |
241 | todo = left; | 241 | todo = left; |
@@ -1041,7 +1041,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1041 | /* get the terminal config for the setup message now so we don't | 1041 | /* get the terminal config for the setup message now so we don't |
1042 | * need to send 2 of them */ | 1042 | * need to send 2 of them */ |
1043 | 1043 | ||
1044 | device_port = port->number - port->serial->minor; | 1044 | device_port = port->port_number; |
1045 | if (tty) { | 1045 | if (tty) { |
1046 | cflag = tty->termios.c_cflag; | 1046 | cflag = tty->termios.c_cflag; |
1047 | /* Baud rate calculation takes baud rate as an integer | 1047 | /* Baud rate calculation takes baud rate as an integer |
@@ -1547,7 +1547,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, | |||
1547 | s_priv = usb_get_serial_data(serial); | 1547 | s_priv = usb_get_serial_data(serial); |
1548 | p_priv = usb_get_serial_port_data(port); | 1548 | p_priv = usb_get_serial_port_data(port); |
1549 | d_details = s_priv->device_details; | 1549 | d_details = s_priv->device_details; |
1550 | device_port = port->number - port->serial->minor; | 1550 | device_port = port->port_number; |
1551 | 1551 | ||
1552 | this_urb = p_priv->outcont_urb; | 1552 | this_urb = p_priv->outcont_urb; |
1553 | 1553 | ||
@@ -1691,7 +1691,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, | |||
1691 | s_priv = usb_get_serial_data(serial); | 1691 | s_priv = usb_get_serial_data(serial); |
1692 | p_priv = usb_get_serial_port_data(port); | 1692 | p_priv = usb_get_serial_port_data(port); |
1693 | d_details = s_priv->device_details; | 1693 | d_details = s_priv->device_details; |
1694 | device_port = port->number - port->serial->minor; | 1694 | device_port = port->port_number; |
1695 | 1695 | ||
1696 | /* only do something if we have a bulk out endpoint */ | 1696 | /* only do something if we have a bulk out endpoint */ |
1697 | this_urb = p_priv->outcont_urb; | 1697 | this_urb = p_priv->outcont_urb; |
@@ -1821,17 +1821,16 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, | |||
1821 | this_urb = s_priv->glocont_urb; | 1821 | this_urb = s_priv->glocont_urb; |
1822 | 1822 | ||
1823 | /* Work out which port within the device is being setup */ | 1823 | /* Work out which port within the device is being setup */ |
1824 | device_port = port->number - port->serial->minor; | 1824 | device_port = port->port_number; |
1825 | 1825 | ||
1826 | /* Make sure we have an urb then send the message */ | 1826 | /* Make sure we have an urb then send the message */ |
1827 | if (this_urb == NULL) { | 1827 | if (this_urb == NULL) { |
1828 | dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__, port->number); | 1828 | dev_dbg(&port->dev, "%s - oops no urb for port.\n", __func__); |
1829 | return -1; | 1829 | return -1; |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | dev_dbg(&port->dev, "%s - endpoint %d port %d (%d)\n", | 1832 | dev_dbg(&port->dev, "%s - endpoint %d (%d)\n", |
1833 | __func__, usb_pipeendpoint(this_urb->pipe), | 1833 | __func__, usb_pipeendpoint(this_urb->pipe), device_port); |
1834 | port->number, device_port); | ||
1835 | 1834 | ||
1836 | /* Save reset port val for resend. | 1835 | /* Save reset port val for resend. |
1837 | Don't overwrite resend for open/close condition. */ | 1836 | Don't overwrite resend for open/close condition. */ |
@@ -1846,7 +1845,6 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, | |||
1846 | 1845 | ||
1847 | memset(&msg, 0, sizeof(struct keyspan_usa49_portControlMessage)); | 1846 | memset(&msg, 0, sizeof(struct keyspan_usa49_portControlMessage)); |
1848 | 1847 | ||
1849 | /*msg.portNumber = port->number;*/ | ||
1850 | msg.portNumber = device_port; | 1848 | msg.portNumber = device_port; |
1851 | 1849 | ||
1852 | /* Only set baud rate if it's changed */ | 1850 | /* Only set baud rate if it's changed */ |
@@ -2136,12 +2134,11 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, | |||
2136 | this_urb = s_priv->glocont_urb; | 2134 | this_urb = s_priv->glocont_urb; |
2137 | 2135 | ||
2138 | /* Work out which port within the device is being setup */ | 2136 | /* Work out which port within the device is being setup */ |
2139 | device_port = port->number - port->serial->minor; | 2137 | device_port = port->port_number; |
2140 | 2138 | ||
2141 | /* Make sure we have an urb then send the message */ | 2139 | /* Make sure we have an urb then send the message */ |
2142 | if (this_urb == NULL) { | 2140 | if (this_urb == NULL) { |
2143 | dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__, | 2141 | dev_dbg(&port->dev, "%s - oops no urb for port.\n", __func__); |
2144 | port->number); | ||
2145 | return -1; | 2142 | return -1; |
2146 | } | 2143 | } |
2147 | 2144 | ||
@@ -2382,7 +2379,7 @@ static int keyspan_port_probe(struct usb_serial_port *port) | |||
2382 | /* Setup values for the various callback routines */ | 2379 | /* Setup values for the various callback routines */ |
2383 | cback = &keyspan_callbacks[d_details->msg_format]; | 2380 | cback = &keyspan_callbacks[d_details->msg_format]; |
2384 | 2381 | ||
2385 | port_num = port->number - port->serial->minor; | 2382 | port_num = port->port_number; |
2386 | 2383 | ||
2387 | /* Do indat endpoints first, once for each flip */ | 2384 | /* Do indat endpoints first, once for each flip */ |
2388 | endp = d_details->indat_endpoints[port_num]; | 2385 | endp = d_details->indat_endpoints[port_num]; |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 47e247759eb0..40ccf6e5e318 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -224,8 +224,8 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
224 | result = metrousb_send_unidirectional_cmd(UNI_CMD_OPEN, port); | 224 | result = metrousb_send_unidirectional_cmd(UNI_CMD_OPEN, port); |
225 | if (result) { | 225 | if (result) { |
226 | dev_err(&port->dev, | 226 | dev_err(&port->dev, |
227 | "%s - failed to configure device for port number=%d, error code=%d\n", | 227 | "%s - failed to configure device, error code=%d\n", |
228 | __func__, port->number, result); | 228 | __func__, result); |
229 | goto exit; | 229 | goto exit; |
230 | } | 230 | } |
231 | 231 | ||
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index f27c621a9297..f79ae7fe37ff 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -1047,7 +1047,7 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1047 | * | 1047 | * |
1048 | * 0x08 : SP1/2 Control Reg | 1048 | * 0x08 : SP1/2 Control Reg |
1049 | */ | 1049 | */ |
1050 | port_number = port->number - port->serial->minor; | 1050 | port_number = port->port_number; |
1051 | read_mos_reg(serial, port_number, LSR, &data); | 1051 | read_mos_reg(serial, port_number, LSR, &data); |
1052 | 1052 | ||
1053 | dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); | 1053 | dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); |
@@ -1066,7 +1066,7 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1066 | 1066 | ||
1067 | write_mos_reg(serial, port_number, SP_CONTROL_REG, 0x00); | 1067 | write_mos_reg(serial, port_number, SP_CONTROL_REG, 0x00); |
1068 | read_mos_reg(serial, dummy, SP_CONTROL_REG, &data); | 1068 | read_mos_reg(serial, dummy, SP_CONTROL_REG, &data); |
1069 | data = data | (port->number - port->serial->minor + 1); | 1069 | data = data | (port->port_number + 1); |
1070 | write_mos_reg(serial, dummy, SP_CONTROL_REG, data); | 1070 | write_mos_reg(serial, dummy, SP_CONTROL_REG, data); |
1071 | mos7720_port->shadowLCR = 0x83; | 1071 | mos7720_port->shadowLCR = 0x83; |
1072 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1072 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); |
@@ -1147,8 +1147,8 @@ static void mos7720_close(struct usb_serial_port *port) | |||
1147 | usb_kill_urb(port->write_urb); | 1147 | usb_kill_urb(port->write_urb); |
1148 | usb_kill_urb(port->read_urb); | 1148 | usb_kill_urb(port->read_urb); |
1149 | 1149 | ||
1150 | write_mos_reg(serial, port->number - port->serial->minor, MCR, 0x00); | 1150 | write_mos_reg(serial, port->port_number, MCR, 0x00); |
1151 | write_mos_reg(serial, port->number - port->serial->minor, IER, 0x00); | 1151 | write_mos_reg(serial, port->port_number, IER, 0x00); |
1152 | 1152 | ||
1153 | mos7720_port->open = 0; | 1153 | mos7720_port->open = 0; |
1154 | } | 1154 | } |
@@ -1172,8 +1172,7 @@ static void mos7720_break(struct tty_struct *tty, int break_state) | |||
1172 | data = mos7720_port->shadowLCR & ~UART_LCR_SBC; | 1172 | data = mos7720_port->shadowLCR & ~UART_LCR_SBC; |
1173 | 1173 | ||
1174 | mos7720_port->shadowLCR = data; | 1174 | mos7720_port->shadowLCR = data; |
1175 | write_mos_reg(serial, port->number - port->serial->minor, | 1175 | write_mos_reg(serial, port->port_number, LCR, mos7720_port->shadowLCR); |
1176 | LCR, mos7720_port->shadowLCR); | ||
1177 | } | 1176 | } |
1178 | 1177 | ||
1179 | /* | 1178 | /* |
@@ -1304,8 +1303,8 @@ static void mos7720_throttle(struct tty_struct *tty) | |||
1304 | /* if we are implementing RTS/CTS, toggle that line */ | 1303 | /* if we are implementing RTS/CTS, toggle that line */ |
1305 | if (tty->termios.c_cflag & CRTSCTS) { | 1304 | if (tty->termios.c_cflag & CRTSCTS) { |
1306 | mos7720_port->shadowMCR &= ~UART_MCR_RTS; | 1305 | mos7720_port->shadowMCR &= ~UART_MCR_RTS; |
1307 | write_mos_reg(port->serial, port->number - port->serial->minor, | 1306 | write_mos_reg(port->serial, port->port_number, MCR, |
1308 | MCR, mos7720_port->shadowMCR); | 1307 | mos7720_port->shadowMCR); |
1309 | if (status != 0) | 1308 | if (status != 0) |
1310 | return; | 1309 | return; |
1311 | } | 1310 | } |
@@ -1336,8 +1335,8 @@ static void mos7720_unthrottle(struct tty_struct *tty) | |||
1336 | /* if we are implementing RTS/CTS, toggle that line */ | 1335 | /* if we are implementing RTS/CTS, toggle that line */ |
1337 | if (tty->termios.c_cflag & CRTSCTS) { | 1336 | if (tty->termios.c_cflag & CRTSCTS) { |
1338 | mos7720_port->shadowMCR |= UART_MCR_RTS; | 1337 | mos7720_port->shadowMCR |= UART_MCR_RTS; |
1339 | write_mos_reg(port->serial, port->number - port->serial->minor, | 1338 | write_mos_reg(port->serial, port->port_number, MCR, |
1340 | MCR, mos7720_port->shadowMCR); | 1339 | mos7720_port->shadowMCR); |
1341 | if (status != 0) | 1340 | if (status != 0) |
1342 | return; | 1341 | return; |
1343 | } | 1342 | } |
@@ -1361,7 +1360,7 @@ static int set_higher_rates(struct moschip_port *mos7720_port, | |||
1361 | * Init Sequence for higher rates | 1360 | * Init Sequence for higher rates |
1362 | ***********************************************/ | 1361 | ***********************************************/ |
1363 | dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); | 1362 | dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); |
1364 | port_number = port->number - port->serial->minor; | 1363 | port_number = port->port_number; |
1365 | 1364 | ||
1366 | write_mos_reg(serial, port_number, IER, 0x00); | 1365 | write_mos_reg(serial, port_number, IER, 0x00); |
1367 | write_mos_reg(serial, port_number, FCR, 0x00); | 1366 | write_mos_reg(serial, port_number, FCR, 0x00); |
@@ -1487,7 +1486,7 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port, | |||
1487 | port = mos7720_port->port; | 1486 | port = mos7720_port->port; |
1488 | serial = port->serial; | 1487 | serial = port->serial; |
1489 | 1488 | ||
1490 | number = port->number - port->serial->minor; | 1489 | number = port->port_number; |
1491 | dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate); | 1490 | dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate); |
1492 | 1491 | ||
1493 | /* Calculate the Divisor */ | 1492 | /* Calculate the Divisor */ |
@@ -1538,7 +1537,7 @@ static void change_port_settings(struct tty_struct *tty, | |||
1538 | 1537 | ||
1539 | port = mos7720_port->port; | 1538 | port = mos7720_port->port; |
1540 | serial = port->serial; | 1539 | serial = port->serial; |
1541 | port_number = port->number - port->serial->minor; | 1540 | port_number = port->port_number; |
1542 | 1541 | ||
1543 | if (!mos7720_port->open) { | 1542 | if (!mos7720_port->open) { |
1544 | dev_dbg(&port->dev, "%s - port not opened\n", __func__); | 1543 | dev_dbg(&port->dev, "%s - port not opened\n", __func__); |
@@ -1731,7 +1730,7 @@ static int get_lsr_info(struct tty_struct *tty, | |||
1731 | struct usb_serial_port *port = tty->driver_data; | 1730 | struct usb_serial_port *port = tty->driver_data; |
1732 | unsigned int result = 0; | 1731 | unsigned int result = 0; |
1733 | unsigned char data = 0; | 1732 | unsigned char data = 0; |
1734 | int port_number = port->number - port->serial->minor; | 1733 | int port_number = port->port_number; |
1735 | int count; | 1734 | int count; |
1736 | 1735 | ||
1737 | count = mos7720_chars_in_buffer(tty); | 1736 | count = mos7720_chars_in_buffer(tty); |
@@ -1793,8 +1792,8 @@ static int mos7720_tiocmset(struct tty_struct *tty, | |||
1793 | mcr &= ~UART_MCR_LOOP; | 1792 | mcr &= ~UART_MCR_LOOP; |
1794 | 1793 | ||
1795 | mos7720_port->shadowMCR = mcr; | 1794 | mos7720_port->shadowMCR = mcr; |
1796 | write_mos_reg(port->serial, port->number - port->serial->minor, | 1795 | write_mos_reg(port->serial, port->port_number, MCR, |
1797 | MCR, mos7720_port->shadowMCR); | 1796 | mos7720_port->shadowMCR); |
1798 | 1797 | ||
1799 | return 0; | 1798 | return 0; |
1800 | } | 1799 | } |
@@ -1838,8 +1837,8 @@ static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, | |||
1838 | } | 1837 | } |
1839 | 1838 | ||
1840 | mos7720_port->shadowMCR = mcr; | 1839 | mos7720_port->shadowMCR = mcr; |
1841 | write_mos_reg(port->serial, port->number - port->serial->minor, | 1840 | write_mos_reg(port->serial, port->port_number, MCR, |
1842 | MCR, mos7720_port->shadowMCR); | 1841 | mos7720_port->shadowMCR); |
1843 | 1842 | ||
1844 | return 0; | 1843 | return 0; |
1845 | } | 1844 | } |
@@ -1856,7 +1855,7 @@ static int get_serial_info(struct moschip_port *mos7720_port, | |||
1856 | 1855 | ||
1857 | tmp.type = PORT_16550A; | 1856 | tmp.type = PORT_16550A; |
1858 | tmp.line = mos7720_port->port->serial->minor; | 1857 | tmp.line = mos7720_port->port->serial->minor; |
1859 | tmp.port = mos7720_port->port->number; | 1858 | tmp.port = mos7720_port->port->port_number; |
1860 | tmp.irq = 0; | 1859 | tmp.irq = 0; |
1861 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | 1860 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; |
1862 | tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE; | 1861 | tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE; |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 7e998081e1cd..f981b08ff32f 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -303,15 +303,12 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
303 | /* For the UART control registers, the application number need | 303 | /* For the UART control registers, the application number need |
304 | to be Or'ed */ | 304 | to be Or'ed */ |
305 | if (port->serial->num_ports == 4) { | 305 | if (port->serial->num_ports == 4) { |
306 | val |= (((__u16) port->number - | 306 | val |= ((__u16)port->port_number + 1) << 8; |
307 | (__u16) (port->serial->minor)) + 1) << 8; | ||
308 | } else { | 307 | } else { |
309 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { | 308 | if (port->port_number == 0) { |
310 | val |= (((__u16) port->number - | 309 | val |= ((__u16)port->port_number + 1) << 8; |
311 | (__u16) (port->serial->minor)) + 1) << 8; | ||
312 | } else { | 310 | } else { |
313 | val |= (((__u16) port->number - | 311 | val |= ((__u16)port->port_number + 2) << 8; |
314 | (__u16) (port->serial->minor)) + 2) << 8; | ||
315 | } | 312 | } |
316 | } | 313 | } |
317 | dev_dbg(&port->dev, "%s application number is %x\n", __func__, val); | 314 | dev_dbg(&port->dev, "%s application number is %x\n", __func__, val); |
@@ -340,16 +337,12 @@ static int mos7840_get_uart_reg(struct usb_serial_port *port, __u16 reg, | |||
340 | 337 | ||
341 | /* Wval is same as application number */ | 338 | /* Wval is same as application number */ |
342 | if (port->serial->num_ports == 4) { | 339 | if (port->serial->num_ports == 4) { |
343 | Wval = | 340 | Wval = ((__u16)port->port_number + 1) << 8; |
344 | (((__u16) port->number - (__u16) (port->serial->minor)) + | ||
345 | 1) << 8; | ||
346 | } else { | 341 | } else { |
347 | if (((__u16) port->number - (__u16) (port->serial->minor)) == 0) { | 342 | if (port->port_number == 0) { |
348 | Wval = (((__u16) port->number - | 343 | Wval = ((__u16)port->port_number + 1) << 8; |
349 | (__u16) (port->serial->minor)) + 1) << 8; | ||
350 | } else { | 344 | } else { |
351 | Wval = (((__u16) port->number - | 345 | Wval = ((__u16)port->port_number + 2) << 8; |
352 | (__u16) (port->serial->minor)) + 2) << 8; | ||
353 | } | 346 | } |
354 | } | 347 | } |
355 | dev_dbg(&port->dev, "%s application number is %x\n", __func__, Wval); | 348 | dev_dbg(&port->dev, "%s application number is %x\n", __func__, Wval); |
@@ -631,9 +624,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
631 | 624 | ||
632 | for (i = 0; i < serial->num_ports; i++) { | 625 | for (i = 0; i < serial->num_ports; i++) { |
633 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 626 | mos7840_port = mos7840_get_port_private(serial->port[i]); |
634 | wval = | 627 | wval = ((__u16)serial->port[i]->port_number + 1) << 8; |
635 | (((__u16) serial->port[i]->number - | ||
636 | (__u16) (serial->minor)) + 1) << 8; | ||
637 | if (mos7840_port->open) { | 628 | if (mos7840_port->open) { |
638 | if (sp[i] & 0x01) { | 629 | if (sp[i] & 0x01) { |
639 | dev_dbg(&urb->dev->dev, "SP%d No Interrupt !!!\n", i); | 630 | dev_dbg(&urb->dev->dev, "SP%d No Interrupt !!!\n", i); |
@@ -1065,8 +1056,8 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1065 | * (can't set it up in mos7840_startup as the * | 1056 | * (can't set it up in mos7840_startup as the * |
1066 | * structures were not set up at that time.) */ | 1057 | * structures were not set up at that time.) */ |
1067 | 1058 | ||
1068 | dev_dbg(&port->dev, "port number is %d\n", port->number); | 1059 | dev_dbg(&port->dev, "port number is %d\n", port->port_number); |
1069 | dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor); | 1060 | dev_dbg(&port->dev, "minor number is %d\n", port->serial->minor); |
1070 | 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); |
1071 | 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); |
1072 | 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); |
@@ -1074,9 +1065,7 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1074 | mos7840_port->read_urb = port->read_urb; | 1065 | mos7840_port->read_urb = port->read_urb; |
1075 | 1066 | ||
1076 | /* set up our bulk in urb */ | 1067 | /* set up our bulk in urb */ |
1077 | if ((serial->num_ports == 2) | 1068 | if ((serial->num_ports == 2) && (((__u16)port->port_number % 2) != 0)) { |
1078 | && ((((__u16)port->number - | ||
1079 | (__u16)(port->serial->minor)) % 2) != 0)) { | ||
1080 | usb_fill_bulk_urb(mos7840_port->read_urb, | 1069 | usb_fill_bulk_urb(mos7840_port->read_urb, |
1081 | serial->dev, | 1070 | serial->dev, |
1082 | usb_rcvbulkpipe(serial->dev, | 1071 | usb_rcvbulkpipe(serial->dev, |
@@ -1199,7 +1188,7 @@ static void mos7840_close(struct usb_serial_port *port) | |||
1199 | mos7840_port->read_urb_busy = false; | 1188 | mos7840_port->read_urb_busy = false; |
1200 | 1189 | ||
1201 | port0->open_ports--; | 1190 | port0->open_ports--; |
1202 | dev_dbg(&port->dev, "%s in close%d:in port%d\n", __func__, port0->open_ports, port->number); | 1191 | dev_dbg(&port->dev, "%s in close%d\n", __func__, port0->open_ports); |
1203 | if (port0->open_ports == 0) { | 1192 | if (port0->open_ports == 0) { |
1204 | if (serial->port[0]->interrupt_in_urb) { | 1193 | if (serial->port[0]->interrupt_in_urb) { |
1205 | dev_dbg(&port->dev, "Shutdown interrupt_in_urb\n"); | 1194 | dev_dbg(&port->dev, "Shutdown interrupt_in_urb\n"); |
@@ -1435,9 +1424,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1435 | memcpy(urb->transfer_buffer, current_position, transfer_size); | 1424 | memcpy(urb->transfer_buffer, current_position, transfer_size); |
1436 | 1425 | ||
1437 | /* fill urb with data and submit */ | 1426 | /* fill urb with data and submit */ |
1438 | if ((serial->num_ports == 2) | 1427 | if ((serial->num_ports == 2) && (((__u16)port->port_number % 2) != 0)) { |
1439 | && ((((__u16)port->number - | ||
1440 | (__u16)(port->serial->minor)) % 2) != 0)) { | ||
1441 | usb_fill_bulk_urb(urb, | 1428 | usb_fill_bulk_urb(urb, |
1442 | serial->dev, | 1429 | serial->dev, |
1443 | usb_sndbulkpipe(serial->dev, | 1430 | usb_sndbulkpipe(serial->dev, |
@@ -1732,10 +1719,9 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, | |||
1732 | if (mos7840_serial_paranoia_check(port->serial, __func__)) | 1719 | if (mos7840_serial_paranoia_check(port->serial, __func__)) |
1733 | return -1; | 1720 | return -1; |
1734 | 1721 | ||
1735 | number = mos7840_port->port->number - mos7840_port->port->serial->minor; | 1722 | number = mos7840_port->port->port_number; |
1736 | 1723 | ||
1737 | dev_dbg(&port->dev, "%s - port = %d, baud = %d\n", __func__, | 1724 | dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudRate); |
1738 | mos7840_port->port->number, baudRate); | ||
1739 | /* reset clk_uart_sel in spregOffset */ | 1725 | /* reset clk_uart_sel in spregOffset */ |
1740 | if (baudRate > 115200) { | 1726 | if (baudRate > 115200) { |
1741 | #ifdef HW_flow_control | 1727 | #ifdef HW_flow_control |
@@ -2016,7 +2002,6 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2016 | tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag)); | 2002 | tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag)); |
2017 | dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, | 2003 | dev_dbg(&port->dev, "%s - old clfag %08x old iflag %08x\n", __func__, |
2018 | old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); | 2004 | old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); |
2019 | dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); | ||
2020 | 2005 | ||
2021 | /* change the port settings to the new ones specified */ | 2006 | /* change the port settings to the new ones specified */ |
2022 | 2007 | ||
@@ -2084,7 +2069,7 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port, | |||
2084 | 2069 | ||
2085 | tmp.type = PORT_16550A; | 2070 | tmp.type = PORT_16550A; |
2086 | tmp.line = mos7840_port->port->serial->minor; | 2071 | tmp.line = mos7840_port->port->serial->minor; |
2087 | tmp.port = mos7840_port->port->number; | 2072 | tmp.port = mos7840_port->port->port_number; |
2088 | tmp.irq = 0; | 2073 | tmp.irq = 0; |
2089 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | 2074 | tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; |
2090 | tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE; | 2075 | tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE; |
@@ -2240,7 +2225,7 @@ static int mos7840_port_probe(struct usb_serial_port *port) | |||
2240 | /* we set up the pointers to the endpoints in the mos7840_open * | 2225 | /* we set up the pointers to the endpoints in the mos7840_open * |
2241 | * function, as the structures aren't created yet. */ | 2226 | * function, as the structures aren't created yet. */ |
2242 | 2227 | ||
2243 | pnum = port->number - serial->minor; | 2228 | pnum = port->port_number; |
2244 | 2229 | ||
2245 | dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum); | 2230 | dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum); |
2246 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | 2231 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); |
@@ -2261,7 +2246,6 @@ static int mos7840_port_probe(struct usb_serial_port *port) | |||
2261 | * usb-serial.c:get_free_serial() and cannot therefore be used | 2246 | * usb-serial.c:get_free_serial() and cannot therefore be used |
2262 | * to index device instances */ | 2247 | * to index device instances */ |
2263 | mos7840_port->port_num = pnum + 1; | 2248 | mos7840_port->port_num = pnum + 1; |
2264 | dev_dbg(&port->dev, "port->number = %d\n", port->number); | ||
2265 | dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor); | 2249 | dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor); |
2266 | 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); |
2267 | dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor); | 2251 | dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor); |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 5f4b0cd0f6e9..6e1ee85e44f2 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -367,7 +367,7 @@ static int opticon_ioctl(struct tty_struct *tty, | |||
367 | { | 367 | { |
368 | struct usb_serial_port *port = tty->driver_data; | 368 | struct usb_serial_port *port = tty->driver_data; |
369 | 369 | ||
370 | dev_dbg(&port->dev, "%s - port %d, cmd = 0x%x\n", __func__, port->number, cmd); | 370 | dev_dbg(&port->dev, "%s - cmd = 0x%x\n", __func__, cmd); |
371 | 371 | ||
372 | switch (cmd) { | 372 | switch (cmd) { |
373 | case TIOCGSERIAL: | 373 | case TIOCGSERIAL: |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 97c1e6a9dd4f..966c20c9ced4 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -640,7 +640,7 @@ static int pl2303_ioctl(struct tty_struct *tty, | |||
640 | memset(&ser, 0, sizeof ser); | 640 | memset(&ser, 0, sizeof ser); |
641 | ser.type = PORT_16654; | 641 | ser.type = PORT_16654; |
642 | ser.line = port->serial->minor; | 642 | ser.line = port->serial->minor; |
643 | ser.port = port->number; | 643 | ser.port = port->port_number; |
644 | ser.baud_base = 460800; | 644 | ser.baud_base = 460800; |
645 | 645 | ||
646 | if (copy_to_user((void __user *)arg, &ser, sizeof ser)) | 646 | if (copy_to_user((void __user *)arg, &ser, sizeof ser)) |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index b0a9478a8c9e..f2ca7d80c8a0 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -343,7 +343,7 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
343 | int status; | 343 | int status; |
344 | unsigned long flags; | 344 | unsigned long flags; |
345 | 345 | ||
346 | device_port = (u16) (port->number - port->serial->minor); | 346 | device_port = port->port_number; |
347 | 347 | ||
348 | serial = port->serial; | 348 | serial = port->serial; |
349 | 349 | ||
@@ -388,9 +388,8 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
388 | status = qt2_set_port_config(serial->dev, device_port, | 388 | status = qt2_set_port_config(serial->dev, device_port, |
389 | DEFAULT_BAUD_RATE, UART_LCR_WLEN8); | 389 | DEFAULT_BAUD_RATE, UART_LCR_WLEN8); |
390 | if (status < 0) { | 390 | if (status < 0) { |
391 | dev_err(&port->dev, | 391 | dev_err(&port->dev, "%s - initial setup failed (%i)\n", |
392 | "%s - initial setup failed for port %i (%i)\n", | 392 | __func__, device_port); |
393 | __func__, port->number, device_port); | ||
394 | return status; | 393 | return status; |
395 | } | 394 | } |
396 | 395 | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 8894665cd610..de958c5b52e3 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -914,7 +914,7 @@ static int sierra_port_probe(struct usb_serial_port *port) | |||
914 | /* This is really the usb-serial port number of the interface | 914 | /* This is really the usb-serial port number of the interface |
915 | * rather than the interface number. | 915 | * rather than the interface number. |
916 | */ | 916 | */ |
917 | ifnum = port->number - serial->minor; | 917 | ifnum = port->port_number; |
918 | himemoryp = &typeA_interface_list; | 918 | himemoryp = &typeA_interface_list; |
919 | } | 919 | } |
920 | 920 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index c92c5ed4e580..07e5c9bec48a 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -476,7 +476,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
476 | if (mutex_lock_interruptible(&tdev->td_open_close_lock)) | 476 | if (mutex_lock_interruptible(&tdev->td_open_close_lock)) |
477 | return -ERESTARTSYS; | 477 | return -ERESTARTSYS; |
478 | 478 | ||
479 | port_number = port->number - port->serial->minor; | 479 | port_number = port->port_number; |
480 | 480 | ||
481 | tport->tp_msr = 0; | 481 | tport->tp_msr = 0; |
482 | tport->tp_shadow_mcr |= (TI_MCR_RTS | TI_MCR_DTR); | 482 | tport->tp_shadow_mcr |= (TI_MCR_RTS | TI_MCR_DTR); |
@@ -618,7 +618,7 @@ static void ti_close(struct usb_serial_port *port) | |||
618 | kfifo_reset_out(&tport->write_fifo); | 618 | kfifo_reset_out(&tport->write_fifo); |
619 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 619 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
620 | 620 | ||
621 | port_number = port->number - port->serial->minor; | 621 | port_number = port->port_number; |
622 | 622 | ||
623 | dev_dbg(&port->dev, "%s - sending TI_CLOSE_PORT\n", __func__); | 623 | dev_dbg(&port->dev, "%s - sending TI_CLOSE_PORT\n", __func__); |
624 | status = ti_command_out_sync(tdev, TI_CLOSE_PORT, | 624 | status = ti_command_out_sync(tdev, TI_CLOSE_PORT, |
@@ -776,7 +776,7 @@ static void ti_set_termios(struct tty_struct *tty, | |||
776 | tcflag_t cflag, iflag; | 776 | tcflag_t cflag, iflag; |
777 | int baud; | 777 | int baud; |
778 | int status; | 778 | int status; |
779 | int port_number = port->number - port->serial->minor; | 779 | int port_number = port->port_number; |
780 | unsigned int mcr; | 780 | unsigned int mcr; |
781 | 781 | ||
782 | cflag = tty->termios.c_cflag; | 782 | cflag = tty->termios.c_cflag; |
@@ -1262,7 +1262,7 @@ static int ti_get_lsr(struct ti_port *tport, u8 *lsr) | |||
1262 | int size, status; | 1262 | int size, status; |
1263 | struct ti_device *tdev = tport->tp_tdev; | 1263 | struct ti_device *tdev = tport->tp_tdev; |
1264 | struct usb_serial_port *port = tport->tp_port; | 1264 | struct usb_serial_port *port = tport->tp_port; |
1265 | int port_number = port->number - port->serial->minor; | 1265 | int port_number = port->port_number; |
1266 | struct ti_port_status *data; | 1266 | struct ti_port_status *data; |
1267 | 1267 | ||
1268 | size = sizeof(struct ti_port_status); | 1268 | size = sizeof(struct ti_port_status); |
@@ -1309,7 +1309,7 @@ static int ti_get_serial_info(struct ti_port *tport, | |||
1309 | 1309 | ||
1310 | ret_serial.type = PORT_16550A; | 1310 | ret_serial.type = PORT_16550A; |
1311 | ret_serial.line = port->serial->minor; | 1311 | ret_serial.line = port->serial->minor; |
1312 | ret_serial.port = port->number - port->serial->minor; | 1312 | ret_serial.port = port->port_number; |
1313 | ret_serial.flags = tport->tp_flags; | 1313 | ret_serial.flags = tport->tp_flags; |
1314 | ret_serial.xmit_fifo_size = TI_WRITE_BUF_SIZE; | 1314 | ret_serial.xmit_fifo_size = TI_WRITE_BUF_SIZE; |
1315 | ret_serial.baud_base = tport->tp_tdev->td_is_3410 ? 921600 : 460800; | 1315 | ret_serial.baud_base = tport->tp_tdev->td_is_3410 ? 921600 : 460800; |
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 | ||
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index ece326ef63a0..eacc27dc4657 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -125,7 +125,7 @@ static int get_serial_info(struct usb_serial_port *port, | |||
125 | 125 | ||
126 | memset(&tmp, 0, sizeof(tmp)); | 126 | memset(&tmp, 0, sizeof(tmp)); |
127 | tmp.line = port->serial->minor; | 127 | tmp.line = port->serial->minor; |
128 | tmp.port = port->number; | 128 | tmp.port = port->port_number; |
129 | tmp.baud_base = tty_get_baud_rate(port->port.tty); | 129 | tmp.baud_base = tty_get_baud_rate(port->port.tty); |
130 | tmp.close_delay = port->port.close_delay / 10; | 130 | tmp.close_delay = port->port.close_delay / 10; |
131 | tmp.closing_wait = port->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? | 131 | tmp.closing_wait = port->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 347caad47a12..7eb34cd6b579 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -462,7 +462,7 @@ static int whiteheat_ioctl(struct tty_struct *tty, | |||
462 | memset(&serstruct, 0, sizeof(serstruct)); | 462 | memset(&serstruct, 0, sizeof(serstruct)); |
463 | serstruct.type = PORT_16654; | 463 | serstruct.type = PORT_16654; |
464 | serstruct.line = port->serial->minor; | 464 | serstruct.line = port->serial->minor; |
465 | serstruct.port = port->number; | 465 | serstruct.port = port->port_number; |
466 | serstruct.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; | 466 | serstruct.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; |
467 | serstruct.xmit_fifo_size = kfifo_size(&port->write_fifo); | 467 | serstruct.xmit_fifo_size = kfifo_size(&port->write_fifo); |
468 | serstruct.custom_divisor = 0; | 468 | serstruct.custom_divisor = 0; |
@@ -626,7 +626,7 @@ static int firm_open(struct usb_serial_port *port) | |||
626 | { | 626 | { |
627 | struct whiteheat_simple open_command; | 627 | struct whiteheat_simple open_command; |
628 | 628 | ||
629 | open_command.port = port->number - port->serial->minor + 1; | 629 | open_command.port = port->port_number + 1; |
630 | return firm_send_command(port, WHITEHEAT_OPEN, | 630 | return firm_send_command(port, WHITEHEAT_OPEN, |
631 | (__u8 *)&open_command, sizeof(open_command)); | 631 | (__u8 *)&open_command, sizeof(open_command)); |
632 | } | 632 | } |
@@ -636,7 +636,7 @@ static int firm_close(struct usb_serial_port *port) | |||
636 | { | 636 | { |
637 | struct whiteheat_simple close_command; | 637 | struct whiteheat_simple close_command; |
638 | 638 | ||
639 | close_command.port = port->number - port->serial->minor + 1; | 639 | close_command.port = port->port_number + 1; |
640 | return firm_send_command(port, WHITEHEAT_CLOSE, | 640 | return firm_send_command(port, WHITEHEAT_CLOSE, |
641 | (__u8 *)&close_command, sizeof(close_command)); | 641 | (__u8 *)&close_command, sizeof(close_command)); |
642 | } | 642 | } |
@@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_struct *tty) | |||
649 | struct whiteheat_port_settings port_settings; | 649 | struct whiteheat_port_settings port_settings; |
650 | unsigned int cflag = tty->termios.c_cflag; | 650 | unsigned int cflag = tty->termios.c_cflag; |
651 | 651 | ||
652 | port_settings.port = port->number - port->serial->minor + 1; | 652 | port_settings.port = port->port_number + 1; |
653 | 653 | ||
654 | /* get the byte size */ | 654 | /* get the byte size */ |
655 | switch (cflag & CSIZE) { | 655 | switch (cflag & CSIZE) { |
@@ -726,7 +726,7 @@ static int firm_set_rts(struct usb_serial_port *port, __u8 onoff) | |||
726 | { | 726 | { |
727 | struct whiteheat_set_rdb rts_command; | 727 | struct whiteheat_set_rdb rts_command; |
728 | 728 | ||
729 | rts_command.port = port->number - port->serial->minor + 1; | 729 | rts_command.port = port->port_number + 1; |
730 | rts_command.state = onoff; | 730 | rts_command.state = onoff; |
731 | return firm_send_command(port, WHITEHEAT_SET_RTS, | 731 | return firm_send_command(port, WHITEHEAT_SET_RTS, |
732 | (__u8 *)&rts_command, sizeof(rts_command)); | 732 | (__u8 *)&rts_command, sizeof(rts_command)); |
@@ -737,7 +737,7 @@ static int firm_set_dtr(struct usb_serial_port *port, __u8 onoff) | |||
737 | { | 737 | { |
738 | struct whiteheat_set_rdb dtr_command; | 738 | struct whiteheat_set_rdb dtr_command; |
739 | 739 | ||
740 | dtr_command.port = port->number - port->serial->minor + 1; | 740 | dtr_command.port = port->port_number + 1; |
741 | dtr_command.state = onoff; | 741 | dtr_command.state = onoff; |
742 | return firm_send_command(port, WHITEHEAT_SET_DTR, | 742 | return firm_send_command(port, WHITEHEAT_SET_DTR, |
743 | (__u8 *)&dtr_command, sizeof(dtr_command)); | 743 | (__u8 *)&dtr_command, sizeof(dtr_command)); |
@@ -748,7 +748,7 @@ static int firm_set_break(struct usb_serial_port *port, __u8 onoff) | |||
748 | { | 748 | { |
749 | struct whiteheat_set_rdb break_command; | 749 | struct whiteheat_set_rdb break_command; |
750 | 750 | ||
751 | break_command.port = port->number - port->serial->minor + 1; | 751 | break_command.port = port->port_number + 1; |
752 | break_command.state = onoff; | 752 | break_command.state = onoff; |
753 | return firm_send_command(port, WHITEHEAT_SET_BREAK, | 753 | return firm_send_command(port, WHITEHEAT_SET_BREAK, |
754 | (__u8 *)&break_command, sizeof(break_command)); | 754 | (__u8 *)&break_command, sizeof(break_command)); |
@@ -759,7 +759,7 @@ static int firm_purge(struct usb_serial_port *port, __u8 rxtx) | |||
759 | { | 759 | { |
760 | struct whiteheat_purge purge_command; | 760 | struct whiteheat_purge purge_command; |
761 | 761 | ||
762 | purge_command.port = port->number - port->serial->minor + 1; | 762 | purge_command.port = port->port_number + 1; |
763 | purge_command.what = rxtx; | 763 | purge_command.what = rxtx; |
764 | return firm_send_command(port, WHITEHEAT_PURGE, | 764 | return firm_send_command(port, WHITEHEAT_PURGE, |
765 | (__u8 *)&purge_command, sizeof(purge_command)); | 765 | (__u8 *)&purge_command, sizeof(purge_command)); |
@@ -770,7 +770,7 @@ static int firm_get_dtr_rts(struct usb_serial_port *port) | |||
770 | { | 770 | { |
771 | struct whiteheat_simple get_dr_command; | 771 | struct whiteheat_simple get_dr_command; |
772 | 772 | ||
773 | get_dr_command.port = port->number - port->serial->minor + 1; | 773 | get_dr_command.port = port->port_number + 1; |
774 | return firm_send_command(port, WHITEHEAT_GET_DTR_RTS, | 774 | return firm_send_command(port, WHITEHEAT_GET_DTR_RTS, |
775 | (__u8 *)&get_dr_command, sizeof(get_dr_command)); | 775 | (__u8 *)&get_dr_command, sizeof(get_dr_command)); |
776 | } | 776 | } |
@@ -780,7 +780,7 @@ static int firm_report_tx_done(struct usb_serial_port *port) | |||
780 | { | 780 | { |
781 | struct whiteheat_simple close_command; | 781 | struct whiteheat_simple close_command; |
782 | 782 | ||
783 | close_command.port = port->number - port->serial->minor + 1; | 783 | close_command.port = port->port_number + 1; |
784 | return firm_send_command(port, WHITEHEAT_REPORT_TX_DONE, | 784 | return firm_send_command(port, WHITEHEAT_REPORT_TX_DONE, |
785 | (__u8 *)&close_command, sizeof(close_command)); | 785 | (__u8 *)&close_command, sizeof(close_command)); |
786 | } | 786 | } |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 302ddf55d2da..3fa68b615ac1 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -37,7 +37,8 @@ | |||
37 | * @serial: pointer back to the struct usb_serial owner of this port. | 37 | * @serial: pointer back to the struct usb_serial owner of this port. |
38 | * @port: pointer to the corresponding tty_port for this port. | 38 | * @port: pointer to the corresponding tty_port for this port. |
39 | * @lock: spinlock to grab when updating portions of this structure. | 39 | * @lock: spinlock to grab when updating portions of this structure. |
40 | * @number: the number of the port (the minor number). | 40 | * @minor: the minor number of the port |
41 | * @port_number: the struct usb_serial port number of this port (starts at 0) | ||
41 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | 42 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. |
42 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. | 43 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. |
43 | * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe | 44 | * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe |
@@ -80,7 +81,8 @@ struct usb_serial_port { | |||
80 | struct usb_serial *serial; | 81 | struct usb_serial *serial; |
81 | struct tty_port port; | 82 | struct tty_port port; |
82 | spinlock_t lock; | 83 | spinlock_t lock; |
83 | unsigned char number; | 84 | u32 minor; |
85 | u8 port_number; | ||
84 | 86 | ||
85 | unsigned char *interrupt_in_buffer; | 87 | unsigned char *interrupt_in_buffer; |
86 | struct urb *interrupt_in_urb; | 88 | struct urb *interrupt_in_urb; |