Skip to content

Commit 10e9b32

Browse files
ukleinekUwe Kleine-König
authored andcommitted
docs: pwm: Adapt Locking paragraph to reality
We have the distinction between pwm_apply_atomic() and pwm_apply_might_sleep() since commit c748a6d (pwm: Rename pwm_apply_state() to pwm_apply_might_sleep()) contained in v6.8-rc1. Locking in the core was introduced in commit 1cc2e1f ("pwm: Add more locking", contained in v6.13-rc1) to serialize per-chip callbacks and device removal. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 2c06a21 commit 10e9b32

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Documentation/driver-api/pwm.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,15 @@ Locking
173173
-------
174174

175175
The PWM core list manipulations are protected by a mutex, so pwm_get()
176-
and pwm_put() may not be called from an atomic context. Currently the
177-
PWM core does not enforce any locking to pwm_enable(), pwm_disable() and
178-
pwm_config(), so the calling context is currently driver specific. This
179-
is an issue derived from the former barebone API and should be fixed soon.
176+
and pwm_put() may not be called from an atomic context.
177+
Most functions in the PWM consumer API might sleep and so must not be called
178+
from atomic context. The notable exception is pwm_apply_atomic() which has the
179+
same semantics as pwm_apply_might_sleep() but can be called from atomic context.
180+
(The price for that is that it doesn't work for all PWM devices, use
181+
pwm_might_sleep() to check if a given PWM supports atomic operation.
182+
183+
Locking in the PWM core ensures that callbacks related to a single chip are
184+
serialized.
180185

181186
Helpers
182187
-------

0 commit comments

Comments
 (0)