linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	krzk@kernel.org, Lukasz Majewski <lukma@denx.de>
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	[thread overview]
Message-ID: <20190925091143.15468-2-lukma@denx.de> (raw)
In-Reply-To: <20190925091143.15468-1-lukma@denx.de>

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 <lukma@denx.de>
Link: https://lore.kernel.org/r/20190924110547.14770-2-lukma@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Reported-by: kbuild test robot <lkp@intel.com>

---
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

  reply	other threads:[~2019-09-25  9:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 11:05 [PATCH 0/2] spi: Fix problem with interrupted slave transmission Lukasz Majewski
2019-09-24 11:05 ` [PATCH 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Lukasz Majewski
2019-09-24 20:08   ` Applied "spi: Add call to spi_slave_abort() function when spidev driver is released" to the spi tree Mark Brown
2019-09-26  6:52   ` [PATCH 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Geert Uytterhoeven
2019-09-26  7:59     ` Lukasz Majewski
2019-09-24 11:05 ` [PATCH 2/2] spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver Lukasz Majewski
2019-10-01 11:41   ` Applied "spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver" to the spi tree Mark Brown
2019-09-25  9:11 ` [PATCH v2 0/2] spi: Fix problem with interrupted slave transmission Lukasz Majewski
2019-09-25  9:11   ` Lukasz Majewski [this message]
2019-09-25 16:45     ` [PATCH v2 1/2] spi: Add call to spi_slave_abort() function when spidev driver is released Mark Brown
2019-09-25 19:57       ` Lukasz Majewski
2019-09-25 16:47     ` Applied "spi: Add call to spi_slave_abort() function when spidev driver is released" to the spi tree Mark Brown
2019-09-25  9:11   ` [PATCH v2 2/2] spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190925091143.15468-2-lukma@denx.de \
    --to=lukma@denx.de \
    --cc=broonie@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).