Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1440869ybn; Wed, 25 Sep 2019 18:35:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqykDEp/nXrMXDVN8/6LBwSAdPT0l9SL+dTCoykQrd3V+nXN+pLM4eY4tTBX4d9pxP7p8rM/ X-Received: by 2002:a17:907:215a:: with SMTP id rk26mr989201ejb.49.1569461702066; Wed, 25 Sep 2019 18:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569461702; cv=none; d=google.com; s=arc-20160816; b=r9L75uQj63V0oA2Y8PcDKQFudmoMUVRTyEoJk9izaqWosbo6OiUL7Ue296Wd516dmz T6Uj1Zpg2LTjiCLSMEZ3oGP8y3fcUAtEH3oZqBW+XhPtwKkLw1McPlTPHzYoRsuv3De1 RiHHEFYs5U703m6E7nr19S8fVIqctI8CdfjPbQvbcJOlCm0bHpLsIUuFrIU2bMvAn5U7 AjA9AWFwbYY0/xiQ7Qp8UtWcKoxWuCv6P5KU4Gnz33g7Hki4HozrWn4oog30y00+oBgj PsJhLfnvjz5SF4OdivZtPeEe0YSCMnPs/IO6rrydbBgiy4VMgAaspnzQHAVk4S2x2JV/ fdqA== 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=PlPhq5/Be42cd64yy8ei3X8X9qPxWr8w/Agc6/Orsh0=; b=MBY09DwdXzmm15p+cyVrJ0BRDRLWQOV2M0Pbfgu7dy5Y7IVYvqQ+u8xqxkym6pe+JP V/3a1ewwYyaQclJjXA59XBJd58VU3DDWP7pwCT+YBllt3Z6j4UtgI9EchGaGxvnnEBqh CSMUeAucChxEAToXrqqMMUvp+sX2U7GBUaRNODw800143qBmbIN2d1SC/Jfq2KdvPS8X oozqeGSXud6G9tU6EuKN2yBiSo9Bv6NFUI3TVeHrZm8hkIWNm1sKegXi9lNv8sobwP0K hzULP9aee7o/GSmmhSYOHm3zlKxeBOBJQQlceZdenziQWLfbk3vNHFQl8dIzjUzMfnlb P3lA== 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 s9si284012eju.298.2019.09.25.18.34.38; Wed, 25 Sep 2019 18:35:02 -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 S2504612AbfIXLGI (ORCPT + 99 others); Tue, 24 Sep 2019 07:06:08 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:41327 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438614AbfIXLGF (ORCPT ); Tue, 24 Sep 2019 07:06:05 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46cyzb4d3Mz1rfM8; Tue, 24 Sep 2019 13:06:03 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46cyzb4FWcz1qqkG; Tue, 24 Sep 2019 13:06:03 +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 mHzmAoV-eGzN; Tue, 24 Sep 2019 13:06:02 +0200 (CEST) X-Auth-Info: D8eW+ivcXXiwUT+UPKNeTEAMLUuwXA7932l9M2UwFfw= 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; Tue, 24 Sep 2019 13:06: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 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Date: Tue, 24 Sep 2019 13:05:46 +0200 Message-Id: <20190924110547.14770-2-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190924110547.14770-1-lukma@denx.de> References: <20190924110547.14770-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 --- drivers/spi/spidev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 255786f2e844..fe9ea7e55e5b 100644 --- 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); mutex_unlock(&device_list_lock); return 0; -- 2.20.1