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 <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221117211143.3817381-2-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
aa3c668f2f
commit
e51b156b18
@ -27,7 +27,10 @@
|
|||||||
|
|
||||||
static DEFINE_MUTEX(pwm_lookup_lock);
|
static DEFINE_MUTEX(pwm_lookup_lock);
|
||||||
static LIST_HEAD(pwm_lookup_list);
|
static LIST_HEAD(pwm_lookup_list);
|
||||||
|
|
||||||
|
/* protects access to pwm_chips, allocated_pwms, and pwm_tree */
|
||||||
static DEFINE_MUTEX(pwm_lock);
|
static DEFINE_MUTEX(pwm_lock);
|
||||||
|
|
||||||
static LIST_HEAD(pwm_chips);
|
static LIST_HEAD(pwm_chips);
|
||||||
static DECLARE_BITMAP(allocated_pwms, MAX_PWMS);
|
static DECLARE_BITMAP(allocated_pwms, MAX_PWMS);
|
||||||
static RADIX_TREE(pwm_tree, GFP_KERNEL);
|
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);
|
return radix_tree_lookup(&pwm_tree, pwm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Called with pwm_lock held */
|
||||||
static int alloc_pwms(unsigned int count)
|
static int alloc_pwms(unsigned int count)
|
||||||
{
|
{
|
||||||
unsigned int start;
|
unsigned int start;
|
||||||
@ -50,6 +54,7 @@ static int alloc_pwms(unsigned int count)
|
|||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Called with pwm_lock held */
|
||||||
static void free_pwms(struct pwm_chip *chip)
|
static void free_pwms(struct pwm_chip *chip)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user