diff mbox series

[1/3] pwm: lpss: Don't modify HW state in .remove callback

Message ID 20210407080155.55004-1-u.kleine-koenig@pengutronix.de
State Accepted
Headers show
Series [1/3] pwm: lpss: Don't modify HW state in .remove callback | expand

Commit Message

Uwe Kleine-König April 7, 2021, 8:01 a.m. UTC
A consumer is expected to disable a PWM before calling pwm_put(). And if
they didn't there is hopefully a good reason (or the consumer needs
fixing). Also if disabling an enabled PWM was the right thing to do,
this should better be done in the framework instead of in each low level
driver.

So drop the hardware modification from the .remove() callback.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-lpss.c | 6 ------
 1 file changed, 6 deletions(-)


base-commit: a38fd8748464831584a19438cbb3082b5a2dab15

Comments

Thierry Reding April 9, 2021, 1:21 p.m. UTC | #1
On Wed, Apr 07, 2021 at 10:01:53AM +0200, Uwe Kleine-König wrote:
> A consumer is expected to disable a PWM before calling pwm_put(). And if
> they didn't there is hopefully a good reason (or the consumer needs
> fixing). Also if disabling an enabled PWM was the right thing to do,
> this should better be done in the framework instead of in each low level
> driver.
> 
> So drop the hardware modification from the .remove() callback.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/pwm-lpss.c | 6 ------
>  1 file changed, 6 deletions(-)

Applied, thanks.

Thierry
Uwe Kleine-König April 10, 2021, 1:46 p.m. UTC | #2
On Fri, Apr 09, 2021 at 03:21:40PM +0200, Thierry Reding wrote:
> On Wed, Apr 07, 2021 at 10:01:53AM +0200, Uwe Kleine-König wrote:
> > A consumer is expected to disable a PWM before calling pwm_put(). And if
> > they didn't there is hopefully a good reason (or the consumer needs
> > fixing). Also if disabling an enabled PWM was the right thing to do,
> > this should better be done in the framework instead of in each low level
> > driver.
> > 
> > So drop the hardware modification from the .remove() callback.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/pwm/pwm-lpss.c | 6 ------
> >  1 file changed, 6 deletions(-)
> 
> Applied, thanks.

Great, but you didn't push yet. Is this still going through your own CI,
or did you forget to push?

Best regards
Uwe
Uwe Kleine-König April 10, 2021, 9:26 p.m. UTC | #3
On Sat, Apr 10, 2021 at 03:46:01PM +0200, Uwe Kleine-König wrote:
> On Fri, Apr 09, 2021 at 03:21:40PM +0200, Thierry Reding wrote:
> > On Wed, Apr 07, 2021 at 10:01:53AM +0200, Uwe Kleine-König wrote:
> > > A consumer is expected to disable a PWM before calling pwm_put(). And if
> > > they didn't there is hopefully a good reason (or the consumer needs
> > > fixing). Also if disabling an enabled PWM was the right thing to do,
> > > this should better be done in the framework instead of in each low level
> > > driver.
> > > 
> > > So drop the hardware modification from the .remove() callback.
> > > 
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > ---
> > >  drivers/pwm/pwm-lpss.c | 6 ------
> > >  1 file changed, 6 deletions(-)
> > 
> > Applied, thanks.
> 
> Great, but you didn't push yet. Is this still going through your own CI,
> or did you forget to push?

Oh, I thought you took the devm_pwmchip_add patch. I withdraw my
question.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
index 939de93c157b..c81cb0ef984a 100644
--- a/drivers/pwm/pwm-lpss.c
+++ b/drivers/pwm/pwm-lpss.c
@@ -255,12 +255,6 @@  EXPORT_SYMBOL_GPL(pwm_lpss_probe);
 
 int pwm_lpss_remove(struct pwm_lpss_chip *lpwm)
 {
-	int i;
-
-	for (i = 0; i < lpwm->info->npwm; i++) {
-		if (pwm_is_enabled(&lpwm->chip.pwms[i]))
-			pm_runtime_put(lpwm->chip.dev);
-	}
 	return pwmchip_remove(&lpwm->chip);
 }
 EXPORT_SYMBOL_GPL(pwm_lpss_remove);