Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1796316imm; Thu, 12 Jul 2018 08:00:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfLYNaLJsYX68AqAv/PIw70FNmlNAwonoZKGIuCTdxjcj3CeV1zKYJEeoW40hhtDBXCRTKI X-Received: by 2002:a62:1603:: with SMTP id 3-v6mr2560438pfw.245.1531407640450; Thu, 12 Jul 2018 08:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531407640; cv=none; d=google.com; s=arc-20160816; b=JaZoP/sL6PSc8PpG8z6YsDEIA355UMslO4lUY7Xyq6MvOqWe3HvLyQgHnQiSaFwkJI Cqj3+uu1RUx48qlOuh23GS6tMBsPI1F+HBV92TZwMWPDQ/5M5wh5yfd6L1/alg0KJWMO oTjnOgpMMzEWTgVWxAdACPMMCiEJy8jy/HWbTn8V7CciCjHppzBATrIMqnCyuED6tYId m8Z6ByKOA3WeE5DK0xOyFRuIKPqwBiihOwCClKfk7YyPBYoBTXhX2wC+HC0Jv8FLyKPB 0muNu1pXAcClLHllJ1DhUMWN9+jh4RkrKenetdGoWfYmduiltwtYM5yx2Yu/yOGPey95 rWIg== 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=HNIqXj2bUCoo+ISFL+yzxXcA/2eiYl0RNM/+8s5+If8=; b=gFDpMPoXoT/6IVAIubH6VT+yoLrRXrYhSJWGCylpaLRP9aOMZKyn7s/xhq9IMMHtJR FZewKX5HvcD5hTdt4JdfzVWWCm3FmxSVtluj5uCnByJCB6g1sx7JU9O3sR1zhL5j1Y4r y1kNTvRns6zX12eTBg0w11/poReka6+YKT32s/Jda0iJKxX5eAIiS4433YnEuqd3HCZw NWTrgmtjBFZid15tLhQI5/iGJX2Y/twsNlEQtnWzOj25SBAG3/65VcNXr8CE6DtcQCfQ VKqTmZ3jsFYnTAmL41VTiZUoV6FZMnvWvQiFIqdG+0ncIl3tKuw1F/7iEbbfXMMgGJVk cZ4w== 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 20-v6si23662309pfr.242.2018.07.12.08.00.25; Thu, 12 Jul 2018 08:00:40 -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 S1732669AbeGLPJR (ORCPT + 99 others); Thu, 12 Jul 2018 11:09:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50676 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732373AbeGLPJR (ORCPT ); Thu, 12 Jul 2018 11:09:17 -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 D365BD4F; Thu, 12 Jul 2018 14:59:20 +0000 (UTC) Date: Thu, 12 Jul 2018 16:59:18 +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 3/3] tty/serial: atmel: manage shutdown in case of RS485 or ISO7816 mode Message-ID: <20180712145918.GC22502@kroah.com> References: <20180711131638.12622-1-ludovic.desroches@microchip.com> <20180711131638.12622-4-ludovic.desroches@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711131638.12622-4-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:38PM +0200, Ludovic Desroches wrote: > From: Nicolas Ferre > > In atmel_shutdown() we call atmel_stop_rx() and atmel_stop_tx() functions. > Prevent the rx restart that is implemented in RS485 or ISO7816 modes when > calling atmel_stop_tx() by using the atomic information tasklet_shutdown > that is already in place for this purpose. > > Signed-off-by: Nicolas Ferre No signed-off-by from you? > --- > drivers/tty/serial/atmel_serial.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 0118b219f3a8..e4f877e1f3c6 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -617,7 +617,9 @@ static void atmel_stop_tx(struct uart_port *port) > if (((port->rs485.flags & SER_RS485_ENABLED) && > !(port->rs485.flags & SER_RS485_RX_DURING_TX)) || > port->iso7816.flags & SER_ISO7816_ENABLED) > - atmel_start_rx(port); > + if (!atomic_read(&atmel_port->tasklet_shutdown)) > + atmel_start_rx(port); Is this really ok? No locking needed? What happens if that value is set right after this? thanks, greg k-h