Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1795083imm; Thu, 12 Jul 2018 07:59:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd47zMaZ+A+jqY8EYG2kK2eHUVnNMi/t63ep+aiumD1jTJm2A0oTfqr8nWd6mh05B3Tf75V X-Received: by 2002:a63:161a:: with SMTP id w26-v6mr2484914pgl.257.1531407584164; Thu, 12 Jul 2018 07:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531407584; cv=none; d=google.com; s=arc-20160816; b=qJddQ7U8TUJO14FuP2S54unm/6iDu4lkIHc3kvKgkXfXsndVUClD97cZh4zcz9hhuA i8P+TUUo00xWgsByJQ31AKcmJUGejD09dsAbs8f/wvdmVutMNB5qcjr4bBLMNjEOqpmo EMUj4YF2FF39osi2Y5A753hJHuWCQsL7EN+ie0k52X2zY/5+bDzrE15FDd1Q5PLIkH4f IU2asN7UfwAGZ8iTRfBxjWSDL97F24+K2aktVzjBWUkVmBmIMiWjgS0V/Sdf09XOct+/ HbJzRf9CWCSozJsGYMeEoUFLXlAvHk7iQ/2Psfw7ivD9ZGcfFTYTx6TmTyW503GOptK3 Oe4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=OdxW+nWeQby3AzmJn0PreyLQBPOlyQzkMZzABF1drso=; b=z0HXTJrfztXwzh7PcWfz8Gvk06N8XVvvjzrQIMGXKwty7v3PPqnNfFO+jQSb2e3kkv hmIosvTlnS6Bz/fjxuiXIbwB15g2ctrlhMfJovoVyMlahyv40f12n9QwKhxbZJuNRfK1 m7LlaZrhz57k2SXgGmFxaLRw5ct5gfFtz3yRCjFJhY8gybtv7pDyrbJsirulkQJDaIV1 T6pUn5WpwQpI4l0szWemQeQtqwck04aQgFHOa5gi4vbu5LXo2lklxswR9JiKlWLcH5Cn FrpVF/jUCHbwTBg+pcNeGvT2uzq2Bg3USypIigF5v6JDVKIp5G8tnPCniTUyJqxs746M jNrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9-v6si160837pll.255.2018.07.12.07.59.28; Thu, 12 Jul 2018 07:59:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732601AbeGLPIH (ORCPT + 99 others); Thu, 12 Jul 2018 11:08:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50618 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732362AbeGLPIH (ORCPT ); Thu, 12 Jul 2018 11:08:07 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D751BD4F; Thu, 12 Jul 2018 14:58:10 +0000 (UTC) Date: Thu, 12 Jul 2018 16:58:08 +0200 From: Greg KH To: Ludovic Desroches Cc: linux-serial@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jslaby@suse.com, arnd@arndb.de, richard.genoud@gmail.com, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] tty/serial_core: add ISO7816 infrastructure Message-ID: <20180712145808.GA22502@kroah.com> References: <20180711131638.12622-1-ludovic.desroches@microchip.com> <20180711131638.12622-2-ludovic.desroches@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711131638.12622-2-ludovic.desroches@microchip.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 11, 2018 at 03:16:36PM +0200, Ludovic Desroches wrote: > From: Nicolas Ferre > > 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 > [ludovic.desroches@microchip.com: squash and rebase, removal of gpios, checkpatch fixes] > Signed-off-by: Ludovic Desroches > --- > 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