mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Felix Gu" <ustc.gu@gmail.com>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH] spi: meson-spifc: use devm_pm_runtime_set_active_enabled
Date: Wed, 22 Jul 2026 12:23:01 +0000	[thread overview]
Message-ID: <20260722122301.EEA3C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260722-spifc-v1-1-e4462a4c6a06@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Removing `meson_spifc_remove()` introduces a clock enable count underflow (double-disable) when the device is unbound.
--

--- Patch [1]: [PATCH] spi: meson-spifc: use devm_pm_runtime_set_active_enabled ---
commit 8bdf0818e31891c7533aa22fdb8392acb6154567
Author: Felix Gu <ustc.gu@gmail.com>

spi: meson-spifc: use devm_pm_runtime_set_active_enabled

This commit replaces pm_runtime_set_active() and pm_runtime_enable() with
devm_pm_runtime_set_active_enabled(). It also drops the out_pm error path
and entirely removes the meson_spifc_remove() function.

> diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c
> --- a/drivers/spi/spi-meson-spifc.c
> +++ b/drivers/spi/spi-meson-spifc.c
[ ... ]
> -static void meson_spifc_remove(struct platform_device *pdev)
> -{
> -	pm_runtime_get_sync(&pdev->dev);
> -	pm_runtime_disable(&pdev->dev);
> -	pm_runtime_put_noidle(&pdev->dev);
> -}

[Severity: Medium]
Does removing this function introduce a clock enable count underflow during
driver unbind?

When the driver is unbound, the driver core calls pm_runtime_put_sync() in
__device_release_driver(). Since the driver does not use autosuspend, this
synchronously suspends the device by invoking meson_spifc_runtime_suspend(),
which disables the clock.

Subsequently, the devres cleanup for devm_clk_get_enabled() executes and
calls clk_disable_unprepare() a second time on the already disabled clock.

The removed meson_spifc_remove() function prevented this by calling
pm_runtime_get_sync() to wake the device and keep the clock active until
the devres teardown runs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-spifc-v1-1-e4462a4c6a06@gmail.com?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

      reply	other threads:[~2026-07-22 12:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 12:09 Felix Gu
2026-07-22 12:23 ` sashiko-bot [this message]

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=20260722122301.EEA3C1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=ustc.gu@gmail.com \
    /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

Powered by JetHome