diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-06 10:32:00 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-10 14:46:40 -0700 |
commit | 1143832eca8f1d64da7d85642c956ae9d25c69e1 (patch) | |
tree | e8ed5dedb8673c57d90f59c6e47df5cbc6986711 /drivers/staging/serqt_usb2 | |
parent | 141dc40ee343ab532717b235dd645e2d25ae3092 (diff) | |
download | linux-1143832eca8f1d64da7d85642c956ae9d25c69e1.tar.bz2 |
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/staging/serqt_usb2')
-rw-r--r-- | drivers/staging/serqt_usb2/serqt_usb2.c | 21 |
1 files changed, 7 insertions, 14 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, result = qt_get_device(serial, &port0->DeviceData); /* Port specific setups */ - result = qt_open_channel(serial, port->number, &ChannelData); + result = qt_open_channel(serial, port->port_number, &ChannelData); if (result < 0) { dev_dbg(&port->dev, "qt_open_channel failed\n"); return result; @@ -888,7 +888,7 @@ static int qt_open(struct tty_struct *tty, (SERIAL_MSR_CTS | SERIAL_MSR_DSR | SERIAL_MSR_RI | SERIAL_MSR_CD); /* Set Baud rate to default and turn off (default)flow control here */ - result = qt_setuart(serial, port->number, DEFAULT_DIVISOR, DEFAULT_LCR); + result = qt_setuart(serial, port->port_number, DEFAULT_DIVISOR, DEFAULT_LCR); if (result < 0) { dev_dbg(&port->dev, "qt_setuart failed\n"); return result; @@ -906,7 +906,6 @@ static int qt_open(struct tty_struct *tty, qt_submit_urb_from_open(serial, port); } - dev_dbg(&port->dev, "port number is %d\n", port->number); dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor); dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress); @@ -1022,14 +1021,11 @@ static void qt_close(struct usb_serial_port *port) /* Close uart channel */ status = qt_close_channel(serial, index); if (status < 0) - dev_dbg(&port->dev, - "%s - port %d qt_close_channel failed.\n", - __func__, port->number); + dev_dbg(&port->dev, "%s - qt_close_channel failed.\n", __func__); port0->open_ports--; - dev_dbg(&port->dev, "qt_num_open_ports in close%d:in port%d\n", - port0->open_ports, port->number); + dev_dbg(&port->dev, "qt_num_open_ports in close%d\n", port0->open_ports); if (port0->open_ports == 0) { if (serial->port[0]->interrupt_in_urb) { @@ -1169,8 +1165,7 @@ static int qt_ioctl(struct tty_struct *tty, return 0; } - dev_dbg(&port->dev, "%s -No ioctl for that one. port = %d\n", - __func__, port->number); + dev_dbg(&port->dev, "%s -No ioctl for that one.\n", __func__); return -ENOIOCTLCMD; } @@ -1245,8 +1240,7 @@ static void qt_set_termios(struct tty_struct *tty, /* Now determine flow control */ if (cflag & CRTSCTS) { - dev_dbg(&port->dev, "%s - Enabling HW flow control port %d\n", - __func__, port->number); + dev_dbg(&port->dev, "%s - Enabling HW flow control\n", __func__); /* Enable RTS/CTS flow control */ status = BoxSetHW_FlowCtrl(port->serial, index, 1); @@ -1258,8 +1252,7 @@ static void qt_set_termios(struct tty_struct *tty, } else { /* Disable RTS/CTS flow control */ dev_dbg(&port->dev, - "%s - disabling HW flow control port %d\n", - __func__, port->number); + "%s - disabling HW flow control\n", __func__); status = BoxSetHW_FlowCtrl(port->serial, index, 0); if (status < 0) { |