Blob Blame History Raw
From ec67fba92ebf6249b8155613063e403c695696c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
Date: Thu, 29 Apr 2021 15:32:18 +0200
Subject: [PATCH] pwm: tiecap: Drop .free() callback
Mime-version: 1.0
Content-type: text/plain; charset=UTF-8
Content-transfer-encoding: 8bit
Git-commit: ec67fba92ebf6249b8155613063e403c695696c6
Patch-mainline: v5.14-rc1
References: git-fixes

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>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Takashi Iwai <tiwai@suse.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 f40975fcb195..027dd0142558 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,
-- 
2.31.1