Re: [PATCH v1 3/6] pwm: tegra: Use devm function for pm_runtime_enable()
Mikko Perttunen <[email protected]> Wed, 15 Jul 2026 13:31:47 +0900
| Newsgroups | org.kernel.vger.linux-pwm,org.kernel.vger.linux-tegra |
|---|---|
| Message-ID | <[email protected]> |
On Tuesday, July 14, 2026 9:02 PM Uwe Kleine-König wrote: > This simplifies the error paths as pwm_runtime_disable() is called > automatatically by the driver core. Typo, s/ta// > > Note that pwm_runtime_disable() is the right function to undo > pm_runtime_enable(); pm_runtime_force_suspend() "should only be used > during system-wide PM transitions to sleep states". > > Signed-off-by: Uwe Kleine-König <[email protected]> > --- > drivers/pwm/pwm-tegra.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c > index dba9a05675e3..e99e1c5b18c3 100644 > --- a/drivers/pwm/pwm-tegra.c > +++ b/drivers/pwm/pwm-tegra.c > @@ -361,7 +361,10 @@ static int tegra_pwm_probe(struct platform_device *pdev) > */ > return ret; > > - pm_runtime_enable(dev); > + ret = devm_pm_runtime_enable(dev); > + if (ret) > + return dev_err_probe(dev, ret, "Failed to enable runtime PM\n"); > + > ret = pm_runtime_resume_and_get(dev); > if (ret) > return dev_err_probe(dev, ret, "Failed to runtime resume device\n"); > @@ -410,7 +413,6 @@ static int tegra_pwm_probe(struct platform_device *pdev) > return 0; > put_pm: > pm_runtime_put_sync_suspend(dev); > - pm_runtime_force_suspend(dev); > return ret; > } > > @@ -422,8 +424,6 @@ static void tegra_pwm_remove(struct platform_device *pdev) > pwmchip_remove(chip); > > reset_control_assert(pc->rst); > - > - pm_runtime_force_suspend(&pdev->dev); I'm guessing the pm_runtime_force_suspend was there to runtime_suspend the device if it was on. I agree that pm_runtime_force_suspend is not the right way to do that, but some replacement would be needed. Thank you Mikko > } > > static int __maybe_unused tegra_pwm_runtime_suspend(struct device *dev) > -- > 2.55.0.11.g153666a7d9bb > >