linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] pwm: Drop two strange API functions
@ 2023-12-09 23:00 Uwe Kleine-König
  2023-12-09 23:00 ` [PATCH 1/2] pwm: lpc18xx-sct: Don't modify the cached period of other PWM outputs Uwe Kleine-König
  2023-12-09 23:00 ` [PATCH 2/2] pwm: Drop two unused API functions Uwe Kleine-König
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2023-12-09 23:00 UTC (permalink / raw)
  To: Thierry Reding, Vladimir Zapolskiy; +Cc: linux-pwm, linux-arm-kernel, kernel

Hello,

while working on another change I noticed these two functions, found
them strange and no valid user. So this patch series drops them.

Best regards
Uwe

Uwe Kleine-König (2):
  pwm: lpc18xx-sct: Don't modify the cached period of other PWM outputs
  pwm: Drop two unused API functions

 drivers/pwm/pwm-lpc18xx-sct.c |  4 +---
 include/linux/pwm.h           | 12 ------------
 2 files changed, 1 insertion(+), 15 deletions(-)

base-commit: bc63de6e6ba0b16652c5fb4b9c9916b9e7ca1f23
-- 
2.42.0


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

* [PATCH 1/2] pwm: lpc18xx-sct: Don't modify the cached period of other PWM outputs
  2023-12-09 23:00 [PATCH 0/2] pwm: Drop two strange API functions Uwe Kleine-König
@ 2023-12-09 23:00 ` Uwe Kleine-König
  2023-12-09 23:00 ` [PATCH 2/2] pwm: Drop two unused API functions Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2023-12-09 23:00 UTC (permalink / raw)
  To: Thierry Reding, Vladimir Zapolskiy; +Cc: linux-pwm, linux-arm-kernel, kernel

Even though the hardware only supports a single period for all PWM
outputs, modifying the other (disabled) outputs's period is strange and
wrong. Only the pwm core is supposed to update these values.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-lpc18xx-sct.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index b3d4a955aa31..fe891fa71a1d 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -194,7 +194,7 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 			      int duty_ns, int period_ns)
 {
 	struct lpc18xx_pwm_chip *lpc18xx_pwm = to_lpc18xx_pwm_chip(chip);
-	int requested_events, i;
+	int requested_events;
 
 	if (period_ns < lpc18xx_pwm->min_period_ns ||
 	    period_ns > lpc18xx_pwm->max_period_ns) {
@@ -223,8 +223,6 @@ static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	if ((requested_events <= 2 && lpc18xx_pwm->period_ns != period_ns) ||
 	    !lpc18xx_pwm->period_ns) {
 		lpc18xx_pwm->period_ns = period_ns;
-		for (i = 0; i < chip->npwm; i++)
-			pwm_set_period(&chip->pwms[i], period_ns);
 		lpc18xx_pwm_config_period(chip, period_ns);
 	}
 
-- 
2.42.0


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

* [PATCH 2/2] pwm: Drop two unused API functions
  2023-12-09 23:00 [PATCH 0/2] pwm: Drop two strange API functions Uwe Kleine-König
  2023-12-09 23:00 ` [PATCH 1/2] pwm: lpc18xx-sct: Don't modify the cached period of other PWM outputs Uwe Kleine-König
@ 2023-12-09 23:00 ` Uwe Kleine-König
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2023-12-09 23:00 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, kernel

These functions are unused. Also I think there is no valid use case
where these are correct to be called. So drop them.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 include/linux/pwm.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index f87655c06c82..20363da3e6ef 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -111,12 +111,6 @@ static inline bool pwm_is_enabled(const struct pwm_device *pwm)
 	return state.enabled;
 }
 
-static inline void pwm_set_period(struct pwm_device *pwm, u64 period)
-{
-	if (pwm)
-		pwm->state.period = period;
-}
-
 static inline u64 pwm_get_period(const struct pwm_device *pwm)
 {
 	struct pwm_state state;
@@ -126,12 +120,6 @@ static inline u64 pwm_get_period(const struct pwm_device *pwm)
 	return state.period;
 }
 
-static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty)
-{
-	if (pwm)
-		pwm->state.duty_cycle = duty;
-}
-
 static inline u64 pwm_get_duty_cycle(const struct pwm_device *pwm)
 {
 	struct pwm_state state;
-- 
2.42.0


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

end of thread, other threads:[~2023-12-09 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-09 23:00 [PATCH 0/2] pwm: Drop two strange API functions Uwe Kleine-König
2023-12-09 23:00 ` [PATCH 1/2] pwm: lpc18xx-sct: Don't modify the cached period of other PWM outputs Uwe Kleine-König
2023-12-09 23:00 ` [PATCH 2/2] pwm: Drop two unused API functions 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 NNTP newsgroup(s).