summaryrefslogtreecommitdiff
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorPeter Hung <hpeter@gmail.com>2015-03-17 17:48:26 +0800
committerJohan Hovold <johan@kernel.org>2015-03-27 17:29:27 +0100
commit88d35cffff83cc0b11d6e7a2bef73b602f156da0 (patch)
treed57ff8797840ba3afd206d2294823295cead4933 /drivers/usb/serial
parent8bb4ca6b56bdf65944d0848561ea8dcf53a87507 (diff)
USB: f81232: clarify f81232_ioctl() and fix
We extract TIOCGSERIAL section in f81232_ioctl() to f81232_get_serial_info() to make it clarify. Also we fix device type from 16654 to 16550A, and set it's baud_base to 115200 (1.8432MHz/16). Signed-off-by: Peter Hung <hpeter+linux_kernel@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/f81232.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index c00ced1ed281..fd4b7cc29c8a 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -600,24 +600,32 @@ static int f81232_carrier_raised(struct usb_serial_port *port)
return 0;
}
+static int f81232_get_serial_info(struct usb_serial_port *port,
+ unsigned long arg)
+{
+ struct serial_struct ser;
+
+ memset(&ser, 0, sizeof(ser));
+
+ ser.type = PORT_16550A;
+ ser.line = port->minor;
+ ser.port = port->port_number;
+ ser.baud_base = F81232_MAX_BAUDRATE;
+
+ if (copy_to_user((void __user *)arg, &ser, sizeof(ser)))
+ return -EFAULT;
+
+ return 0;
+}
+
static int f81232_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
{
- struct serial_struct ser;
struct usb_serial_port *port = tty->driver_data;
switch (cmd) {
case TIOCGSERIAL:
- memset(&ser, 0, sizeof ser);
- ser.type = PORT_16654;
- ser.line = port->minor;
- ser.port = port->port_number;
- ser.baud_base = 460800;
-
- if (copy_to_user((void __user *)arg, &ser, sizeof ser))
- return -EFAULT;
-
- return 0;
+ return f81232_get_serial_info(port, arg);
default:
break;
}