public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Heiko Stuebner <heiko@sntech.de>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v1 1/1] clk: fractional-divider: Move mask calculations out of lock
Date: Fri, 08 Mar 2024 17:06:09 -0800	[thread overview]
Message-ID: <384bf6c936fac50042389cc5f53c3199.sboyd@kernel.org> (raw)
In-Reply-To: <20240303121410.240761-1-andy.shevchenko@gmail.com>

Quoting Andy Shevchenko (2024-03-03 04:14:10)
> There is no need to calculate masks under the lock taken.
> Move them out of it.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---

Applied to clk-next

> diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c
> index a0178182fc72..da057172cc90 100644
> --- a/drivers/clk/clk-fractional-divider.c
> +++ b/drivers/clk/clk-fractional-divider.c
> @@ -195,14 +195,14 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
>                 n--;
>         }
>  
> +       mmask = GENMASK(fd->mwidth - 1, 0) << fd->mshift;
> +       nmask = GENMASK(fd->nwidth - 1, 0) << fd->nshift;
> +
>         if (fd->lock)
>                 spin_lock_irqsave(fd->lock, flags);
>         else
>                 __acquire(fd->lock);
>  
> -       mmask = GENMASK(fd->mwidth - 1, 0) << fd->mshift;
> -       nmask = GENMASK(fd->nwidth - 1, 0) << fd->nshift;
> -
>         val = clk_fd_readl(fd);
>         val &= ~(mmask | nmask);
>         val |= (m << fd->mshift) | (n << fd->nshift);

Should we pre-calculate the mask and shift values too!?

  parent reply	other threads:[~2024-03-09  1:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03 12:14 [PATCH v1 1/1] clk: fractional-divider: Move mask calculations out of lock Andy Shevchenko
2024-03-04  3:28 ` Chen-Yu Tsai
2024-03-04  7:05 ` Heiko Stübner
2024-03-09  1:06 ` Stephen Boyd [this message]
2024-03-09 16:29   ` Andy Shevchenko
2024-03-09  7:19 ` Christophe JAILLET
2024-03-09 16:27   ` 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=384bf6c936fac50042389cc5f53c3199.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=heiko@sntech.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox