Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp504090imm; Fri, 13 Jul 2018 01:04:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmW1Xi2j7RzY2ZAbLg/+tujR8LhCsy/pWd0d4P0umB6djXP1laLGElg+OUatYkm1toh2mo X-Received: by 2002:a17:902:5381:: with SMTP id c1-v6mr5301469pli.137.1531469050957; Fri, 13 Jul 2018 01:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531469050; cv=none; d=google.com; s=arc-20160816; b=vZxWN/JXfF+/nGSXKRPc7goIPAK6k1Wy+tTkPSSkwmV7dY1+sSl/XEFI725xt3IY7I gpWj2foleSwk8b3AEphhT3b2lSFM9RjHUb4eLodw//XxURCLoR3T1yNzbjcgJ0X7Zj0i 5qHXNVgrjnbsy+cz61voSJBDJYKUGnt2/mH0K3jn5UD/lbFASaCfdu3adD9I4hfeNRtY ctxKzWenF9HXyorQppGFCbWAvBxdnAysbMPHo3pMr3DMPt6iG++712JGevlQfghhNzT2 U+IkURD3Fwbm9rMabWFEZmIvRUukSKiU0oek+IL8IVOGpknS+8ZD7vOAtcbmJfX1ePje JCDA== 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:mail-followup-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=n6i+Eb+vq4YHbjbVwQCkIOO8WqWA+TJZbwSp7Or/Nkg=; b=zZIwCXgPnCCBTulEc8rW/olZlYJqf2ecb+UVO0yrpOtD4WagdM/x2Q/kjLBWowhxuV HN4XfQkWB0G0sZZzvIZoA3DXQ7+IjVKSfOnj3yFnw4IqoLlYULWdCieUa2ps1m+56YUF W4jaHHxOKxHluYRQlOM65z3gzLm3pN6jaMmWV6Niw14jSYdROOSCwRyHdB2Q6pI789nt ivhCyje+25a61cJqa6Cj+xXVMvJOR82gRoTzr2uyqjWVx7Cx89oOzGEKqK0nUBaYqiFq KxRUKSVnWxGYifxhdNSYvMfZy859kzvjlDQrqkP4E0M+4YGjOCHAo7Bo4Ufc+rfii9dj 6z3w== 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 c17-v6si22285647pge.273.2018.07.13.01.03.55; Fri, 13 Jul 2018 01:04:10 -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 S2387747AbeGMIQL (ORCPT + 99 others); Fri, 13 Jul 2018 04:16:11 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:49770 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729790AbeGMIQL (ORCPT ); Fri, 13 Jul 2018 04:16:11 -0400 X-IronPort-AV: E=Sophos;i="5.51,347,1526367600"; d="scan'208";a="14112885" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Jul 2018 01:02:41 -0700 Received: from localhost (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.352.0; Fri, 13 Jul 2018 01:02:39 -0700 Date: Fri, 13 Jul 2018 10:01:29 +0200 From: Ludovic Desroches To: Greg KH CC: , , , , , , , , Subject: Re: [PATCH 1/3] tty/serial_core: add ISO7816 infrastructure Message-ID: <20180713080129.2ifw7crjksvaxxpq@M43218.corp.atmel.com> Mail-Followup-To: Greg KH , 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 References: <20180711131638.12622-1-ludovic.desroches@microchip.com> <20180711131638.12622-2-ludovic.desroches@microchip.com> <20180712145808.GA22502@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180712145808.GA22502@kroah.com> User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 12, 2018 at 04:58:08PM +0200, Greg KH wrote: > 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? I'll add the check. > > > + if (!port->iso7816_config) > > + return -ENOIOCTLCMD; > > Why this error value? > It was a mimic of RS485. > > --- 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? I will use the macros to create numbers. Any rules about nr choice? Regards Ludovic > > thanks, > > greg k-h