mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: sh-msiof: propagate setup runtime-PM errors
@ 2026-08-30 14:01 Pengpeng Hou
  2026-08-30 23:37 ` Mark Brown
  2026-09-02  7:17 ` Geert Uytterhoeven
  0 siblings, 2 replies; 4+ messages in thread
From: Pengpeng Hou @ 2026-08-30 14:01 UTC (permalink / raw)
  To: Mark Brown; +Cc: Pengpeng Hou, linux-spi, linux-kernel

sh_msiof_spi_setup() ignores pm_runtime_get_sync() before programming
native chip-select registers and marking the configuration initialized.

Use the checked runtime-PM helper and return failure before register
access.

Fixes: 7ff0b53c4051 ("spi: sh-msiof: Avoid writing to registers from spi_master.setup()")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/spi/spi-sh-msiof.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 1aeab7ec0bc8d..4c425ec627767 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -453,6 +453,7 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
 	struct sh_msiof_spi_priv *p =
 		spi_controller_get_devdata(spi->controller);
 	u32 clr, set, tmp;
+	int ret;
 
 	if (spi_get_csgpiod(spi, 0) || spi_controller_is_target(p->ctlr))
 		return 0;
@@ -468,7 +469,9 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
 		clr |= SIMDR1_SYNCAC;
 	else
 		set |= SIMDR1_SYNCAC;
-	pm_runtime_get_sync(&p->pdev->dev);
+	ret = pm_runtime_resume_and_get(&p->pdev->dev);
+	if (ret < 0)
+		return ret;
 	tmp = sh_msiof_read(p, SITMDR1) & ~clr;
 	sh_msiof_write(p, SITMDR1, tmp | set | SIMDR1_TRMD | SITMDR1_PCON);
 	tmp = sh_msiof_read(p, SIRMDR1) & ~clr;

base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
-- 
2.50.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: sh-msiof: propagate setup runtime-PM errors
  2026-08-30 14:01 [PATCH] spi: sh-msiof: propagate setup runtime-PM errors Pengpeng Hou
@ 2026-08-30 23:37 ` Mark Brown
  2026-09-02  7:17 ` Geert Uytterhoeven
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-08-30 23:37 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: linux-spi, linux-kernel

On Sun, 30 Aug 2026 22:01:33 +0800, Pengpeng Hou wrote:
> spi: sh-msiof: propagate setup runtime-PM errors

Applied to

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

Thanks!

[1/1] spi: sh-msiof: propagate setup runtime-PM errors
      https://git.kernel.org/broonie/spi/c/152867998da9

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: sh-msiof: propagate setup runtime-PM errors
  2026-08-30 14:01 [PATCH] spi: sh-msiof: propagate setup runtime-PM errors Pengpeng Hou
  2026-08-30 23:37 ` Mark Brown
@ 2026-09-02  7:17 ` Geert Uytterhoeven
  2026-09-20  3:07   ` Pengpeng Hou
  1 sibling, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2026-09-02  7:17 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: Mark Brown, linux-spi, linux-kernel

On Sun, 30 Aug 2026 at 16:10, Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:
> sh_msiof_spi_setup() ignores pm_runtime_get_sync() before programming
> native chip-select registers and marking the configuration initialized.
>
> Use the checked runtime-PM helper and return failure before register
> access.
>
> Fixes: 7ff0b53c4051 ("spi: sh-msiof: Avoid writing to registers from spi_master.setup()")

FTR, this is the wrong commit, please follow moved code.

> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: sh-msiof: propagate setup runtime-PM errors
  2026-09-02  7:17 ` Geert Uytterhoeven
@ 2026-09-20  3:07   ` Pengpeng Hou
  0 siblings, 0 replies; 4+ messages in thread
From: Pengpeng Hou @ 2026-09-20  3:07 UTC (permalink / raw)
  To: geert; +Cc: broonie, linux-spi, linux-kernel, hppiscas

Hi Geert, Mark,

Following the code before the move confirms that the unchecked runtime-PM
get was introduced by:

Fixes: 015760563ec7 ("spi: sh-msiof: Add runtime PM lock in initializing")

7ff0b53c4051 moved that operation rather than introducing it. Please use
the tag above for the applied fix if the metadata has not already been
corrected.

Thanks,
Pengpeng


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-20  3:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-30 14:01 [PATCH] spi: sh-msiof: propagate setup runtime-PM errors Pengpeng Hou
2026-08-30 23:37 ` Mark Brown
2026-09-02  7:17 ` Geert Uytterhoeven
2026-09-20  3:07   ` Pengpeng Hou

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®