Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1800968ybn; Thu, 26 Sep 2019 02:23:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqykV/XeBUKINA51va39tWocBrWgxrHb4FJIfTC01vLfFRUigPxh5ekrdoXCBTD2huTiyQrx X-Received: by 2002:a50:f09d:: with SMTP id v29mr2418137edl.4.1569489821139; Thu, 26 Sep 2019 02:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569489821; cv=none; d=google.com; s=arc-20160816; b=QrYgg0gs9XphGMgsLoZiwLvMDgUldeNcyraMONE2qa6Qb045ku9E68VUooplWxd8E6 R2yztcpq1W8ZIf4oz3GUDAXxbGyyyrFfKT2yS+EzaWPrcGbgjqXcAl2FmD/KY5Vbr5R6 PS4w0Ya9Aqv91V5G4fWB4xHKMqhWUXcyCacdrOIDkcTSXIv6QpKtLnQ1i3ygPxHG6f21 8CIGyht8apI+fFQrg4rLawwxe9uOWkjr5fgiAMEartlSbbKD/mJIQf8egPIPJP3kTse9 x7Ar7DPRQoZK8ZfZnBuSLOYbib478fs3VL6aZupUQZXkBaI5C8+FVgDT1ZdYxqXFVID2 avig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=tiGa9B/cPdJy693ox8QnztKztH+H03rRgVCWVjWbhfA=; b=Iy3qN3EILnwNnLk896pTl7nfkWFoBm4arfADW+95qyHRqVox9OUfOu0ttIQD7n1RKi yf+p3HrehRNYep+MWxtTIRF0caIK6eYzR9WoLndVI4/9TYpfdyRl2ZfrcFROLQtfx9c7 mODc0q/ZQpCgQFvA8+6udATpqug39vV9cjaNTNJcR/57p0Rh49LPZlExOF/Phn9C+VyY Cg8EUpZ8QZVq0xIbNl0jiWNe3y4uV5AhhjsJ8MK3/4rc3BhU0wnHJ5ndxt87V+LxNgWD gmicnudLlP5ihkV4+lwro/TYfZZNPscW6GwJiehI7qET+rJEUBaIlBobRMG1od1GKrCp wpGQ== 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 k2si950887ede.311.2019.09.26.02.23.17; Thu, 26 Sep 2019 02:23:41 -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 S2388143AbfIYJMI (ORCPT + 99 others); Wed, 25 Sep 2019 05:12:08 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:34819 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387772AbfIYJMG (ORCPT ); Wed, 25 Sep 2019 05:12:06 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46dXPc51y9z1s1VW; Wed, 25 Sep 2019 11:12:04 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46dXPc4PXrz1qqkT; Wed, 25 Sep 2019 11:12:04 +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 2EBbxmp59U0j; Wed, 25 Sep 2019 11:12:02 +0200 (CEST) X-Auth-Info: PbuO3twiSHYkDC7a/Or/NRyzLBWFn1JSjsNp6URmSb4= Received: from localhost.localdomain (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; Wed, 25 Sep 2019 11:12:02 +0200 (CEST) From: Lukasz Majewski To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, krzk@kernel.org, Lukasz Majewski Subject: [PATCH v2 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Date: Wed, 25 Sep 2019 11:11:42 +0200 Message-Id: <20190925091143.15468-2-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190925091143.15468-1-lukma@denx.de> References: <20190924110547.14770-1-lukma@denx.de> <20190925091143.15468-1-lukma@denx.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Link: https://lore.kernel.org/r/20190924110547.14770-2-lukma@denx.de Signed-off-by: Mark Brown Reported-by: kbuild test robot --- Changes for v2: - Add #ifdef CONFIG_SPI_SLAVE to not compile in spi_slave_abort() on systems which are only using master mode. (The spi_slave_abort() is 'protected' by this Kconfig define in drivers/spi.c file). This error was spotted by kbuild test robot from Intel. --- drivers/spi/spidev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 255786f2e844..3ea9d8a3e6e8 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -627,6 +627,9 @@ static int spidev_release(struct inode *inode, struct file *filp) if (dofree) kfree(spidev); } +#ifdef CONFIG_SPI_SLAVE + spi_slave_abort(spidev->spi); +#endif mutex_unlock(&device_list_lock); return 0; -- 2.20.1