[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180712145808.GA22502@kroah.com>
Date: Thu, 12 Jul 2018 16:58:08 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Ludovic Desroches <ludovic.desroches@...rochip.com>
Cc: linux-serial@...r.kernel.org, linux-arch@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, jslaby@...e.com,
arnd@...db.de, richard.genoud@...il.com,
nicolas.ferre@...rochip.com, alexandre.belloni@...tlin.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] tty/serial_core: add ISO7816 infrastructure
On Wed, Jul 11, 2018 at 03:16:36PM +0200, Ludovic Desroches wrote:
> From: Nicolas Ferre <nicolas.ferre@...rochip.com>
>
> Add the ISO7816 ioctl and associated accessors and data structure.
> Drivers can then use this common implementation to handle ISO7816.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@...rochip.com>
> [ludovic.desroches@...rochip.com: squash and rebase, removal of gpios, checkpatch fixes]
> Signed-off-by: Ludovic Desroches <ludovic.desroches@...rochip.com>
> ---
> drivers/tty/serial/serial_core.c | 49 +++++++++++++++++++++++++++++++++++++++
> include/linux/serial_core.h | 3 +++
> include/uapi/asm-generic/ioctls.h | 2 ++
> include/uapi/linux/serial.h | 17 ++++++++++++++
> 4 files changed, 71 insertions(+)
Note, kbuild found build issues with this, please fix up.
Also, here's some comments:
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 9c14a453f73c..c89ac59f6f8c 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1301,6 +1301,47 @@ static int uart_set_rs485_config(struct uart_port *port,
> return 0;
> }
>
> +static int uart_get_iso7816_config(struct uart_port *port,
> + struct serial_iso7816 __user *iso7816)
> +{
> + unsigned long flags;
> + struct serial_iso7816 aux;
> +
> + spin_lock_irqsave(&port->lock, flags);
> + aux = port->iso7816;
Don't you want to check to see if there is a function for iso7816 before
copying it? Otherwise it's just empty, right?
> + if (!port->iso7816_config)
> + return -ENOIOCTLCMD;
Why this error value?
> --- a/include/uapi/asm-generic/ioctls.h
> +++ b/include/uapi/asm-generic/ioctls.h
> @@ -66,6 +66,8 @@
> #ifndef TIOCSRS485
> #define TIOCSRS485 0x542F
> #endif
> +#define TIOCGISO7816 0x5430
> +#define TIOCSISO7816 0x5431
Where did you get these numbers from?
thanks,
greg k-h
Powered by blists - more mailing lists