All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: bcm-kona: Don't modify HW state in .remove callback
@ 2021-03-26  8:18 Uwe Kleine-König
  2021-04-09 12:43 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2021-03-26  8:18 UTC (permalink / raw)
  To: Thierry Reding, Lee Jones
  Cc: Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, linux-pwm, kernel

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-bcm-kona.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c
index f09a31042859..800b9edf2e71 100644
--- a/drivers/pwm/pwm-bcm-kona.c
+++ b/drivers/pwm/pwm-bcm-kona.c
@@ -310,11 +310,6 @@ static int kona_pwmc_probe(struct platform_device *pdev)
 static int kona_pwmc_remove(struct platform_device *pdev)
 {
 	struct kona_pwmc *kp = platform_get_drvdata(pdev);
-	unsigned int chan;
-
-	for (chan = 0; chan < kp->chip.npwm; chan++)
-		if (pwm_is_enabled(&kp->chip.pwms[chan]))
-			clk_disable_unprepare(kp->clk);
 
 	return pwmchip_remove(&kp->chip);
 }
-- 
2.30.2


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

* Re: [PATCH] pwm: bcm-kona: Don't modify HW state in .remove callback
  2021-03-26  8:18 [PATCH] pwm: bcm-kona: Don't modify HW state in .remove callback Uwe Kleine-König
@ 2021-04-09 12:43 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2021-04-09 12:43 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Lee Jones, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, linux-pwm, kernel

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

On Fri, Mar 26, 2021 at 09:18:04AM +0100, 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-bcm-kona.c | 5 -----
>  1 file changed, 5 deletions(-)

It'd be better to somehow WARN about this instead of silently leaking
the clock reference, but I can't think of a good way to do that, which
would also work in the case where the consumer intentionally left the
PWM enabled, so:

Applied, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-04-09 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26  8:18 [PATCH] pwm: bcm-kona: Don't modify HW state in .remove callback Uwe Kleine-König
2021-04-09 12:43 ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.