Applied "spi: abort spi_sync if failed to prepare_transfer_hardware" to the spi tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch

   spi: abort spi_sync if failed to prepare_transfer_hardware

has been applied to the spi tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From f3440d9a0da292dc4998d9393162fcfb996fd671 Mon Sep 17 00:00:00 2001
From: Super Liu <supercjliu@xxxxxxxxxx>
Date: Wed, 22 May 2019 14:30:14 +0800
Subject: [PATCH] spi: abort spi_sync if failed to prepare_transfer_hardware

There is no chance to wait spi message complete if failed to
prepare_transfer_hardware(). Therefore, finalize this message and abort
transfer with corresponding return status to release this block case.

Logs:

[17400.283005] c7   3267 PM: PM: suspend entry 2019-05-04 03:01:14.403097147 UTC
[17400.283013] c7   3267 PM: suspend entry (deep)
[17400.283016] c6   3267 PM: Syncing filesystems ... done.
[17400.584395] c1    753 spi_geni 890000.spi: spi_geni_prepare_transfer_hardware:Error enabling SE resources -13
[17400.584404] c1    753 spi_master spi1: failed to prepare transfer hardware
[17400.664611] c4   3267 PM: PM: suspend exit 2019-05-04 03:01:15.235273018 UTC

Flow:

__spi_sync@spi.c
|    if (status == 0) {
|        /* Push out the messages in the calling context if we
|         * can.
|         */
|        if (ctlr->transfer == spi_queued_transfer) {
|            SPI_STATISTICS_INCREMENT_FIELD(&ctlr->statistics,
|		spi_sync_immediate);
|            SPI_STATISTICS_INCREMENT_FIELD(&spi->statistics,
|		spi_sync_immediate);
|		__spi_pump_messages(ctlr, false);
|        }
|
|        wait_for_completion(&done);	<== stuck here!!!
|        status = message->status;
|    }
|    message->context = NULL;
|    return status;
|
-->	__spi_pump_messages@spi.c
	|    if (!was_busy && ctlr->prepare_transfer_hardware) {
	|        ret = ctlr->prepare_transfer_hardware(ctlr);
	|        if (ret) {
	|            dev_err(&ctlr->dev,
	|		"failed to prepare transfer hardware\n");
	|
	|        if (ctlr->auto_runtime_pm)
	|            pm_runtime_put(ctlr->dev.parent);
	|            mutex_unlock(&ctlr->io_mutex);
	|            return;
	|        }
	|    }
	|
	-->	spi_geni_prepare_transfer_hardware@spi-geni-qcom.c
		|    ret = pm_runtime_get_sync(mas->dev);
		|    if (ret < 0) {
		|        dev_err(mas->dev,
		|		"%s:Error enabling SE resources %d\n",
		|		__func__, ret);
		|    pm_runtime_put_noidle(mas->dev);
		|    goto exit_prepare_transfer_hardware;

Signed-off-by: Super Liu <supercjliu@xxxxxxxxxx>
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
---
 drivers/spi/spi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8eb7460dd744..5e4654032bfa 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1307,10 +1307,15 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
 		ret = ctlr->prepare_transfer_hardware(ctlr);
 		if (ret) {
 			dev_err(&ctlr->dev,
-				"failed to prepare transfer hardware\n");
+				"failed to prepare transfer hardware: %d\n",
+				ret);
 
 			if (ctlr->auto_runtime_pm)
 				pm_runtime_put(ctlr->dev.parent);
+
+			ctlr->cur_msg->status = ret;
+			spi_finalize_current_message(ctlr);
+
 			mutex_unlock(&ctlr->io_mutex);
 			return;
 		}
-- 
2.20.1




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux