Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1866154ybn; Thu, 26 Sep 2019 03:26:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkZgiYhDqM60eOgQnDBx7eId7bc/i9cOKXuUhn4cGiXFo9g6iJGaQa+VitfaGMJq55Cbaq X-Received: by 2002:a50:9eee:: with SMTP id a101mr2644241edf.128.1569493595399; Thu, 26 Sep 2019 03:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569493595; cv=none; d=google.com; s=arc-20160816; b=hvLCks3edviovvv9sowxFMf2i9yiDxxQBwYO+0H3BZsuZyaKgKlK2z/TjXpqbfaeaR hdcIZtT00+vewetvlRUEwPE1PaH6tcfQqjI/lyrRlR8jdvd8iUtGiOt01bkLPb8qW2Zd 1Ick0r45EzrMqRR7iTnCNhbpYThPRlSc2Xum5yVCx6dlzDPXfNKLHGWEZznvrREygwYf xYXhzzdbNyun94faM14NrXduoMt0I1daSAeJbinfvccLLaccxLkHGUXWqo2oPJggA9/m YKuilUUFa56PDgD6AGxBSx8o6TZA8foicWNHQOfPItyr7UV+MUlMtu6VBKt40JxLP9ox kEXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=bolFQFFYTyovdnQhTpyYVJVkIVgSg8msHr31bbQ1Uzg=; b=fleR88IaV2S5yQ/YZSGEaAdtD8cILGkLCpaZGWSstyPA2lCUper0FhvaKWra0WICbh /Vf/KW51XDblP2PtGidLSSAZH7DQNsfZ8fXrGkD+vkHNufm58/erKkMHFD/Qw/JAzQb9 Y07u9wr7b15MGyikG5T/toplXdoiq1xepLgDiIXe0slz0Dx7GeqC6XWyjr0E9maNpzU9 lXlhLRTx2QM+U++VTNPTJEP1vHyYtWigsfYIere8YV9pwH0KhCzbCnNWeUL2HcEfDgQj CO5X8ndl6TnR58bc6LKnUWqi0F5cHoA1ZrkfmQKoUok9cVuE1vtD8ANR5/nzc+IPq5MV FOcA== 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 by16si957171edb.30.2019.09.26.03.26.12; Thu, 26 Sep 2019 03:26:35 -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 S1728047AbfIZH7s (ORCPT + 99 others); Thu, 26 Sep 2019 03:59:48 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:54771 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727701AbfIZH7r (ORCPT ); Thu, 26 Sep 2019 03:59:47 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46f6lh06K4z1rQYn; Thu, 26 Sep 2019 09:59:43 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46f6lg6YKtz1qqkL; Thu, 26 Sep 2019 09:59:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 0ZxA9ZV_k4tv; Thu, 26 Sep 2019 09:59:42 +0200 (CEST) X-Auth-Info: HfnPDiM+3Ll2KMuyM8YcqLFRGVX3LUDByNYxi9mVV+w= Received: from jawa (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 26 Sep 2019 09:59:42 +0200 (CEST) Date: Thu, 26 Sep 2019 09:59:41 +0200 From: Lukasz Majewski To: Geert Uytterhoeven Cc: Mark Brown , linux-spi , Linux Kernel Mailing List , Krzysztof Kozlowski Subject: Re: [PATCH 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Message-ID: <20190926095941.0615f335@jawa> In-Reply-To: References: <20190924110547.14770-1-lukma@denx.de> <20190924110547.14770-2-lukma@denx.de> Organization: denx.de X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/5s0ODXtpIoabspOUcWPgLRh"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/5s0ODXtpIoabspOUcWPgLRh Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Geert, > Hi Lukasz, >=20 > On Thu, Sep 26, 2019 at 3:33 AM Lukasz Majewski wrote: > > This change is necessary for spidev devices (e.g. /dev/spidev3.0) > > working in the slave mode (like NXP's dspi driver for Vybrid SoC). > > > > When SPI HW works in this mode - the master is responsible for > > providing CS and CLK signals. However, when some fault happens - > > like for example distortion on SPI lines - the SPI Linux driver > > needs a chance to recover from this abnormal situation and prepare > > itself for next (correct) transmission. > > > > This change doesn't pose any threat on drivers working in master > > mode as spi_slave_abort() function checks if SPI slave mode is > > supported. > > > > Signed-off-by: Lukasz Majewski =20 >=20 > Thanks for your patch! >=20 > Yesterday I saw this appear on spi/for-next, but I couldn't find the > email in my mbox. Today it has arrived. Looks like gmail had some > troubles ("Delivered after 138401 seconds", ugh). I've already sent v2 of this patch, as Intel Linux test setup spot the error with lack of #define guards. >=20 > > --- a/drivers/spi/spidev.c > > +++ b/drivers/spi/spidev.c > > @@ -627,6 +627,7 @@ static int spidev_release(struct inode *inode, > > struct file *filp) if (dofree) > > kfree(spidev); > > } > > + spi_slave_abort(spidev->spi); =20 >=20 > Looks good to me. Just wondering if this should be done for the last > user only, i.e. in the "if" block above, like resetting speed_hz? I also thought about this. However, from my use case the user must end the transmission with CTRL+C on his user space program, which in turn communicate via SPI with /dev/spidev3.0. There might be many (potential) programs using the /dev/spidev3.0 at the same time, so the usage count may be not one. For the above reason I've moved it outside the above if(). >=20 > > mutex_unlock(&device_list_lock); > > > > return 0; =20 >=20 > Gr{oetje,eeting}s, >=20 > Geert >=20 Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/5s0ODXtpIoabspOUcWPgLRh Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAl2Mb+0ACgkQAR8vZIA0 zr18ogf+Nkm6YALkd0PZS43sKVKplV00GjN15f39tfe1iYqHDzToQk2HTKQgJYFJ q713F216HIdJTpNDTpc+EZkMARIlPAAse5HphE0WIUUk41ZW6Gi038tJtzrgJFRF xkgQSVPFy3mIfheTBenYzYgvF0CKCDl0hOScBsmXoYQ4A6doQXZoniENZp1f3ybc vb+ruj9PjepQyp/jHjYO7KiQC9nPY+azM3qkp8AHkYXY9iN3SnIrFg5hqCE2zSnZ NyCgt+380i6WlXpLua0oxvp5ypxSbufWFkKjIo0mjU67A/cgWe1WUZWCIkrG+J+y Y/g3fKvcaeW6LwWO5Jc67yBQ3HQm2g== =cdef -----END PGP SIGNATURE----- --Sig_/5s0ODXtpIoabspOUcWPgLRh--