diff options
| author | Uwe Kleine-König <[email protected]> | 2022-12-02 18:35:09 +0000 |
|---|---|---|
| committer | Thierry Reding <[email protected]> | 2022-12-06 11:46:05 +0000 |
| commit | e51b156b18fb6d34a1e409d153040a02adb5c7e0 (patch) | |
| tree | 0d7f641a6ec829902d8185ed15e915bd9d49a2e5 | |
| parent | pwm: mediatek: always use bus clock for PWM on MT7622 (diff) | |
| download | kernel-e51b156b18fb6d34a1e409d153040a02adb5c7e0.tar.gz kernel-e51b156b18fb6d34a1e409d153040a02adb5c7e0.zip | |
pwm: Document variables protected by pwm_lock
To simplify validation of the used locking, document for the global pwm
mutex what it actually protects against concurrent access. Also note for
two functions modifying these that pwm_lock is held by the caller.
Reviewed-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
| -rw-r--r-- | drivers/pwm/core.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index d333e7422f4a..ebe06efe9de5 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -27,7 +27,10 @@ static DEFINE_MUTEX(pwm_lookup_lock); static LIST_HEAD(pwm_lookup_list); + +/* protects access to pwm_chips, allocated_pwms, and pwm_tree */ static DEFINE_MUTEX(pwm_lock); + static LIST_HEAD(pwm_chips); static DECLARE_BITMAP(allocated_pwms, MAX_PWMS); static RADIX_TREE(pwm_tree, GFP_KERNEL); @@ -37,6 +40,7 @@ static struct pwm_device *pwm_to_device(unsigned int pwm) return radix_tree_lookup(&pwm_tree, pwm); } +/* Called with pwm_lock held */ static int alloc_pwms(unsigned int count) { unsigned int start; @@ -50,6 +54,7 @@ static int alloc_pwms(unsigned int count) return start; } +/* Called with pwm_lock held */ static void free_pwms(struct pwm_chip *chip) { unsigned int i; |
