Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757123AbbBFMVT (ORCPT ); Fri, 6 Feb 2015 07:21:19 -0500 Received: from mail-la0-f50.google.com ([209.85.215.50]:43577 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757634AbbBFMVL (ORCPT ); Fri, 6 Feb 2015 07:21:11 -0500 Message-ID: <54D4B1B3.60001@cogentembedded.com> Date: Fri, 06 Feb 2015 15:21:07 +0300 From: Sergei Shtylyov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Peter Hung , 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, Peter Hung Subject: Re: [PATCH V5 6/8] USB: f81232: clarify f81232_ioctl() References: <1423216014-571-1-git-send-email-hpeter+linux_kernel@gmail.com> <1423216014-571-7-git-send-email-hpeter+linux_kernel@gmail.com> In-Reply-To: <1423216014-571-7-git-send-email-hpeter+linux_kernel@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2323 Lines: 80 Hello. On 2/6/2015 12:46 PM, Peter Hung wrote: > We extract TIOCGSERIAL section in f81232_ioctl() to f81232_get_serial_info() > to make it clarify You're also changing 'ser.baud_rate' from 460800 to 115200. And explicitly overriding some previously initialized to 0 fields. > The f81232_set_mctrl() replace set_control_lines() to do MCR control > so we clean-up the set_control_lines() function. I don't see where are you doing this... > Signed-off-by: Peter Hung > --- > drivers/usb/serial/f81232.c | 34 +++++++++++++++++++++++----------- > 1 file changed, 23 insertions(+), 11 deletions(-) > > diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c > index e1cdf42..4dddb44 100644 > --- a/drivers/usb/serial/f81232.c > +++ b/drivers/usb/serial/f81232.c > @@ -516,24 +516,36 @@ 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.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; > + ser.xmit_fifo_size = port->bulk_out_size; > + ser.close_delay = 5 * HZ; > + ser.closing_wait = 30 * HZ; > + 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; > } WBR, Sergei -- 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/