diff mbox series

i3c: master: svc: Fix pm_runtime_set_suspended() with runtime pm enabled

Message ID 20240923034122.3007984-1-ruanjinjie@huawei.com (mailing list archive)
State Superseded
Headers show
Series i3c: master: svc: Fix pm_runtime_set_suspended() with runtime pm enabled | expand

Commit Message

Jinjie Ruan Sept. 23, 2024, 3:41 a.m. UTC
It is not valid to call pm_runtime_set_suspended() for devices
with runtime PM enabled because it returns -EAGAIN if it is enabled
already and working. So, call pm_runtime_disable() before to fix it.

Fixes: 05be23ef78f7 ("i3c: master: svc: add runtime pm support")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/i3c/master/svc-i3c-master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Frank Li Sept. 26, 2024, 4:53 p.m. UTC | #1
On Mon, Sep 23, 2024 at 11:41:22AM +0800, Jinjie Ruan wrote:
> It is not valid to call pm_runtime_set_suspended() for devices
> with runtime PM enabled because it returns -EAGAIN if it is enabled
> already and working. So, call pm_runtime_disable() before to fix it.
>
> Fixes: 05be23ef78f7 ("i3c: master: svc: add runtime pm support")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/i3c/master/svc-i3c-master.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index 0a68fd1b81d4..575b337a5052 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -1762,8 +1762,8 @@ static int svc_i3c_master_probe(struct platform_device *pdev)
>  rpm_disable:
>  	pm_runtime_dont_use_autosuspend(&pdev->dev);
>  	pm_runtime_put_noidle(&pdev->dev);
> -	pm_runtime_set_suspended(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> +	pm_runtime_set_suspended(&pdev->dev);
>
>  err_disable_clks:
>  	svc_i3c_master_unprepare_clks(master);
> --
> 2.34.1
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
Miquel Raynal Sept. 30, 2024, 8:30 a.m. UTC | #2
Hi,

Frank.li@nxp.com wrote on Thu, 26 Sep 2024 12:53:59 -0400:

> On Mon, Sep 23, 2024 at 11:41:22AM +0800, Jinjie Ruan wrote:
> > It is not valid to call pm_runtime_set_suspended() for devices
> > with runtime PM enabled because it returns -EAGAIN if it is enabled
> > already and working. So, call pm_runtime_disable() before to fix it.
> >
> > Fixes: 05be23ef78f7 ("i3c: master: svc: add runtime pm support")
> > Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>  

Missing Cc: stable.

> 
> Reviewed-by: Frank Li <Frank.Li@nxp.com>

With the tag added,

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl
diff mbox series

Patch

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 0a68fd1b81d4..575b337a5052 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -1762,8 +1762,8 @@  static int svc_i3c_master_probe(struct platform_device *pdev)
 rpm_disable:
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	pm_runtime_put_noidle(&pdev->dev);
-	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
+	pm_runtime_set_suspended(&pdev->dev);
 
 err_disable_clks:
 	svc_i3c_master_unprepare_clks(master);