diff mbox series

pwm: Drop unused function pwm_apply_args()

Message ID 20250922094327.1143944-2-u.kleine-koenig@baylibre.com
State Accepted
Headers show
Series pwm: Drop unused function pwm_apply_args() | expand

Commit Message

Uwe Kleine-König Sept. 22, 2025, 9:43 a.m. UTC
The function pwm_apply_args() was introduced with the concept of atomic
PWM configuration and needed for drivers not using this concept yet. Now
all drivers are converted accordingly and so no callers are left which
allows to remove this function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

as of v6.17-rc7 there is still one caller left
(drivers/video/backlight/mp3309c.c), but commit 2720c87b7621
("backlight: mp3309c: Drop pwm_apply_args()") that is currently in next
scheduled to go into v6.18-rc1 removes that last user. So this patch
isn't ready for the upcoming merge window yet.

Best regards
Uwe

 include/linux/pwm.h | 33 ---------------------------------
 1 file changed, 33 deletions(-)


base-commit: 07e27ad16399afcd693be20211b0dfae63e0615f
prerequisite-patch-id: cda85684d26aeec0471141f107a0978da7190aae

Comments

Uwe Kleine-König Oct. 20, 2025, 9:10 a.m. UTC | #1
Hello,

On Mon, Sep 22, 2025 at 11:43:28AM +0200, Uwe Kleine-König wrote:
> The function pwm_apply_args() was introduced with the concept of atomic
> PWM configuration and needed for drivers not using this concept yet. Now
> all drivers are converted accordingly and so no callers are left which
> allows to remove this function.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> as of v6.17-rc7 there is still one caller left
> (drivers/video/backlight/mp3309c.c), but commit 2720c87b7621
> ("backlight: mp3309c: Drop pwm_apply_args()") that is currently in next
> scheduled to go into v6.18-rc1 removes that last user. So this patch
> isn't ready for the upcoming merge window yet.

2720c87b7621 is in v6.18-rc1, so I applied this now. Find it in

https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next

.

Best regards
Uwe
diff mbox series

Patch

diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 8cafc483db53..164d82cca215 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -608,39 +608,6 @@  devm_fwnode_pwm_get(struct device *dev, struct fwnode_handle *fwnode,
 }
 #endif
 
-static inline void pwm_apply_args(struct pwm_device *pwm)
-{
-	struct pwm_state state = { };
-
-	/*
-	 * PWM users calling pwm_apply_args() expect to have a fresh config
-	 * where the polarity and period are set according to pwm_args info.
-	 * The problem is, polarity can only be changed when the PWM is
-	 * disabled.
-	 *
-	 * PWM drivers supporting hardware readout may declare the PWM device
-	 * as enabled, and prevent polarity setting, which changes from the
-	 * existing behavior, where all PWM devices are declared as disabled
-	 * at startup (even if they are actually enabled), thus authorizing
-	 * polarity setting.
-	 *
-	 * To fulfill this requirement, we apply a new state which disables
-	 * the PWM device and set the reference period and polarity config.
-	 *
-	 * Note that PWM users requiring a smooth handover between the
-	 * bootloader and the kernel (like critical regulators controlled by
-	 * PWM devices) will have to switch to the atomic API and avoid calling
-	 * pwm_apply_args().
-	 */
-
-	state.enabled = false;
-	state.polarity = pwm->args.polarity;
-	state.period = pwm->args.period;
-	state.usage_power = false;
-
-	pwm_apply_might_sleep(pwm, &state);
-}
-
 struct pwm_lookup {
 	struct list_head list;
 	const char *provider;