Linux-PWM Archive mirror
 help / color / mirror / Atom feed
* [PATCH] pwm: tiecap: Drop .free() callback
@ 2021-04-29 13:32 Uwe Kleine-König
  2021-04-30  6:48 ` Uwe Kleine-König
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2021-04-29 13:32 UTC (permalink / raw)
  To: Thierry Reding, Lee Jones, Vaibhav Bedia, Avinash Philip
  Cc: linux-pwm, kernel, Franklin S Cooper Jr

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(-)

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,

base-commit: a6efb35019d00f483a0e5f188747723371d659fe
-- 
2.30.2


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

* Re: [PATCH] pwm: tiecap: Drop .free() callback
  2021-04-29 13:32 [PATCH] pwm: tiecap: Drop .free() callback Uwe Kleine-König
@ 2021-04-30  6:48 ` Uwe Kleine-König
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2021-04-30  6:48 UTC (permalink / raw)
  To: Thierry Reding, Lee Jones; +Cc: linux-pwm, Franklin S Cooper Jr, kernel

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

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

end of thread, other threads:[~2021-04-30  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 13:32 [PATCH] pwm: tiecap: Drop .free() callback Uwe Kleine-König
2021-04-30  6:48 ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).