mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiawen Liu <1298662399@qq.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] spi: pci1xxxx: propagate controller resume failures
Date: Sun, 29 Nov 2026 16:33:47 +0400	[thread overview]
Message-ID: <tencent_015F90CAC1FAFF2227C828DD26A74D40AD07@qq.com> (raw)

pci1xxxx_spi_resume() ignores the result of spi_controller_resume() and
always reports success. If a previous suspend timed out waiting for the
SPI queue to drain, the next queue restart returns -EBUSY, but device
resume completes without recording the failure.

Keep the first controller error while restoring every hardware instance,
then return it after all instances have been processed.

Fixes: 7ba63521a1e9 ("spi: microchip: pci1xxxx: Add suspend and resume support for PCI1XXXX SPI driver")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/spi/spi-pci1xxxx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c
index e00b59ed823ab..e6e71358d9235 100644
--- a/drivers/spi/spi-pci1xxxx.c
+++ b/drivers/spi/spi-pci1xxxx.c
@@ -1041,11 +1041,14 @@ static int pci1xxxx_spi_resume(struct device *dev)
 	struct pci1xxxx_spi *spi_ptr = dev_get_drvdata(dev);
 	struct pci1xxxx_spi_internal *spi_sub_ptr;
 	u32 regval = SPI_RESUME_CONFIG;
+	int ret = 0, err;
 	u8 iter;
 
 	for (iter = 0; iter < spi_ptr->total_hw_instances; iter++) {
 		spi_sub_ptr = spi_ptr->spi_int[iter];
-		spi_controller_resume(spi_sub_ptr->spi_host);
+		err = spi_controller_resume(spi_sub_ptr->spi_host);
+		if (err && !ret)
+			ret = err;
 		writel(regval, spi_ptr->reg_base +
 		       SPI_MST_EVENT_MASK_REG_OFFSET(iter));
 
@@ -1053,7 +1056,7 @@ static int pci1xxxx_spi_resume(struct device *dev)
 		store_restore_config(spi_ptr, spi_sub_ptr, iter, 0);
 	}
 
-	return 0;
+	return ret;
 }
 
 static int pci1xxxx_spi_suspend(struct device *dev)
-- 
2.34.1


                 reply	other threads:[~2026-11-29 14:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=tencent_015F90CAC1FAFF2227C828DD26A74D40AD07@qq.com \
    --to=1298662399@qq.com \
    --cc=broonie@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

all inboxes | Powered by JetHome®