[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180914140247.GM1362@localhost>
Date: Fri, 14 Sep 2018 16:02:47 +0200
From: Johan Hovold <johan@...nel.org>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 25/50] mos7720: switch to ->get_serial()
On Thu, Sep 13, 2018 at 03:40:24AM +0100, Al Viro wrote:
> From: Al Viro <viro@...iv.linux.org.uk>
>
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
> drivers/usb/serial/mos7720.c | 38 ++++++++++++++++----------------------
> 1 file changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
> index 4c06357b3ef8..451fca707e04 100644
> --- a/drivers/usb/serial/mos7720.c
> +++ b/drivers/usb/serial/mos7720.c
> @@ -1786,24 +1786,22 @@ static int mos7720_tiocmset(struct tty_struct *tty,
> return 0;
> }
>
> -static int get_serial_info(struct moschip_port *mos7720_port,
> - struct serial_struct __user *retinfo)
> +static int get_serial_info(struct tty_struct *tty,
> + struct serial_struct *ss)
> {
> - struct serial_struct tmp;
> -
> - memset(&tmp, 0, sizeof(tmp));
> -
> - tmp.type = PORT_16550A;
> - tmp.line = mos7720_port->port->minor;
> - tmp.port = mos7720_port->port->port_number;
> - tmp.irq = 0;
> - tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
> - tmp.baud_base = 9600;
> - tmp.close_delay = 5*HZ;
> - tmp.closing_wait = 30*HZ;
> -
> - if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
> - return -EFAULT;
> + struct usb_serial_port *port = tty->driver_data;
> + struct moschip_port *mos7720_port;
Newline please.
> + mos7720_port = usb_get_serial_port_data(port);
> + if (mos7720_port == NULL)
> + return -ENODEV;
And no need to check for NULL, even if the current ioctl does so...
> + ss->type = PORT_16550A;
> + ss->line = mos7720_port->port->minor;
> + ss->port = mos7720_port->port->port_number;
> + ss->irq = 0;
> + ss->xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
> + ss->baud_base = 9600;
> + ss->close_delay = 5*HZ;
> + ss->closing_wait = 30*HZ;
> return 0;
> }
Reviewed-by: Johan Hovold <johan@...nel.org>
Powered by blists - more mailing lists