diff mbox series

pwm: tiecap: Drop .free() callback

Message ID 20210429133218.66971-1-u.kleine-koenig@pengutronix.de
State Accepted
Headers show
Series pwm: tiecap: Drop .free() callback | expand

Commit Message

Uwe Kleine-König April 29, 2021, 1:32 p.m. UTC
ecap_pwm_free is only called when a consumer releases the PWM (using
pwm_put() or pwm_free()). The consumer is expected to disable the PWM
before doing that. It's not clear if a warning about that is justified, but
if it is this is independent of the actual driver and can better be done in
the core. Also if there is a good reason it's wrong to disable the hardware
and so the call to pm_runtime_put_sync() should be dropped. Moreover there
is no matching pwm_runtime_get call and so the runtime usage counter might
become negative.

Fixes: 8e0cb05b3b75 ("pwm: pwm-tiecap: PWM driver support for ECAP APWM")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-tiecap.c | 9 ---------
 1 file changed, 9 deletions(-)


base-commit: a6efb35019d00f483a0e5f188747723371d659fe

Comments

Uwe Kleine-König April 30, 2021, 6:48 a.m. UTC | #1
Hello,

On Thu, Apr 29, 2021 at 03:32:18PM +0200, Uwe Kleine-König wrote:
> ecap_pwm_free is only called when a consumer releases the PWM (using
> pwm_put() or pwm_free()). The consumer is expected to disable the PWM
> before doing that. It's not clear if a warning about that is justified, but
> if it is this is independent of the actual driver and can better be done in
> the core. Also if there is a good reason it's wrong to disable the hardware
> and so the call to pm_runtime_put_sync() should be dropped. Moreover there
> is no matching pwm_runtime_get call and so the runtime usage counter might
> become negative.

For the record: The two people from TI (Vaibhav Bedia
<vaibhav.bedia@ti.com>, Avinash Philip <avinashphilip@ti.com>) I
addressed with that patch (because they were involved previously with
this driver) didn't receive my mail. The addresses don't exist according
to TI's mail server. I dropped them from To: for this reply.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
index b9a17ab0c202..134f0db28870 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -168,16 +168,7 @@  static void ecap_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 	pm_runtime_put_sync(pc->chip.dev);
 }
 
-static void ecap_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
-{
-	if (pwm_is_enabled(pwm)) {
-		dev_warn(chip->dev, "Removing PWM device without disabling\n");
-		pm_runtime_put_sync(chip->dev);
-	}
-}
-
 static const struct pwm_ops ecap_pwm_ops = {
-	.free = ecap_pwm_free,
 	.config = ecap_pwm_config,
 	.set_polarity = ecap_pwm_set_polarity,
 	.enable = ecap_pwm_enable,