All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH 1/4] pwm: Document variables protected by pwm_lock
Date: Wed, 16 Nov 2022 10:22:18 +0200	[thread overview]
Message-ID: <Y3SdumZ7HP2Rf20u@smile.fi.intel.com> (raw)
In-Reply-To: <20221115211515.3750209-2-u.kleine-koenig@pengutronix.de>

On Tue, Nov 15, 2022 at 10:15:12PM +0100, Uwe Kleine-König wrote:
> 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>

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pwm/core.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> 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;
> -- 
> 2.38.1
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-11-16  8:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 21:15 [PATCH 0/4] pwm: Some refactoring of pwmchip_add() Uwe Kleine-König
2022-11-15 21:15 ` [PATCH 1/4] pwm: Document variables protected by pwm_lock Uwe Kleine-König
2022-11-16  8:22   ` Andy Shevchenko [this message]
2022-11-15 21:15 ` [PATCH 2/4] pwm: Reduce time the pwm_lock mutex is held in pwmchip_add() Uwe Kleine-König
2022-11-16  8:11   ` Andy Shevchenko
2022-11-17 14:00     ` Uwe Kleine-König
2022-11-17 15:33       ` Andy Shevchenko
2022-11-15 21:15 ` [PATCH 3/4] pwm: Mark free pwm IDs as used in alloc_pwms() Uwe Kleine-König
2022-11-16  8:17   ` Andy Shevchenko
2022-11-16 13:59     ` Uwe Kleine-König
2022-11-16 14:04   ` Andy Shevchenko
2022-11-15 21:15 ` [PATCH 4/4] pwm: Don't initialize list head before calling list_add() Uwe Kleine-König
2022-11-16  8:21   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3SdumZ7HP2Rf20u@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.