Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932119AbbBZKCp (ORCPT ); Thu, 26 Feb 2015 05:02:45 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:45815 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753695AbbBZKCl (ORCPT ); Thu, 26 Feb 2015 05:02:41 -0500 From: Peter Hung X-Google-Original-From: Peter Hung To: johan@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, tom_tsai@fintek.com.tw, peter_hong@fintek.com.tw, hpeter@gmail.com, Peter Hung Subject: [PATCH V8 08/10] USB: f81232: clarify f81232_ioctl() and fix Date: Thu, 26 Feb 2015 18:02:14 +0800 Message-Id: <1424944936-7117-9-git-send-email-hpeter+linux_kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424944936-7117-1-git-send-email-hpeter+linux_kernel@gmail.com> References: <1424944936-7117-1-git-send-email-hpeter+linux_kernel@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1785 Lines: 67 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 --- drivers/usb/serial/f81232.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 0580195..21f2342 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -596,24 +596,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 = 115200; + + 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; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/