All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] clk: renesas: r8a77970: Use DEFINE_SPINLOCK() for spinlock
@ 2021-04-09  9:51 Ye Bin
  2021-04-09 16:54 ` Stephen Boyd
  2021-04-12  9:24 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Ye Bin @ 2021-04-09  9:51 UTC (permalink / raw)
  To: yebin10, Geert Uytterhoeven, Michael Turquette, Stephen Boyd
  Cc: linux-renesas-soc, linux-clk, kernel-janitors, Hulk Robot

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 drivers/clk/renesas/r8a77970-cpg-mssr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/renesas/r8a77970-cpg-mssr.c b/drivers/clk/renesas/r8a77970-cpg-mssr.c
index 0f59c84229a8..7b153c6f299c 100644
--- a/drivers/clk/renesas/r8a77970-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c
@@ -47,7 +47,7 @@ enum clk_ids {
 	MOD_CLK_BASE
 };
 
-static spinlock_t cpg_lock;
+static DEFINE_SPINLOCK(cpg_lock);
 
 static const struct clk_div_table cpg_sd0h_div_table[] = {
 	{  0,  2 }, {  1,  3 }, {  2,  4 }, {  3,  6 },
@@ -212,8 +212,6 @@ static int __init r8a77970_cpg_mssr_init(struct device *dev)
 	if (error)
 		return error;
 
-	spin_lock_init(&cpg_lock);
-
 	cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
 
 	return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode);


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] clk: renesas: r8a77970: Use DEFINE_SPINLOCK() for spinlock
  2021-04-09  9:51 [PATCH -next] clk: renesas: r8a77970: Use DEFINE_SPINLOCK() for spinlock Ye Bin
@ 2021-04-09 16:54 ` Stephen Boyd
  2021-04-12  9:24 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2021-04-09 16:54 UTC (permalink / raw)
  To: Geert Uytterhoeven, Michael Turquette, yebin10
  Cc: linux-renesas-soc, linux-clk, kernel-janitors, Hulk Robot

Quoting Ye Bin (2021-04-09 02:51:50)
> spinlock can be initialized automatically with DEFINE_SPINLOCK()
> rather than explicitly calling spin_lock_init().
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] clk: renesas: r8a77970: Use DEFINE_SPINLOCK() for spinlock
  2021-04-09  9:51 [PATCH -next] clk: renesas: r8a77970: Use DEFINE_SPINLOCK() for spinlock Ye Bin
  2021-04-09 16:54 ` Stephen Boyd
@ 2021-04-12  9:24 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-04-12  9:24 UTC (permalink / raw)
  To: Ye Bin
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
	kernel-janitors, Hulk Robot

Hi Ye,

On Fri, Apr 9, 2021 at 11:43 AM Ye Bin <yebin10@huawei.com> wrote:
> spinlock can be initialized automatically with DEFINE_SPINLOCK()
> rather than explicitly calling spin_lock_init().
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>

Thanks for your patch, which looks correct to me.

> --- a/drivers/clk/renesas/r8a77970-cpg-mssr.c
> +++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c
> @@ -47,7 +47,7 @@ enum clk_ids {
>         MOD_CLK_BASE
>  };
>
> -static spinlock_t cpg_lock;
> +static DEFINE_SPINLOCK(cpg_lock);

I think a better fix would be to start using the common cpg_lock, by #including
rcar-cpg-lib.h.

>
>  static const struct clk_div_table cpg_sd0h_div_table[] = {
>         {  0,  2 }, {  1,  3 }, {  2,  4 }, {  3,  6 },
> @@ -212,8 +212,6 @@ static int __init r8a77970_cpg_mssr_init(struct device *dev)
>         if (error)
>                 return error;
>
> -       spin_lock_init(&cpg_lock);
> -
>         cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)];
>
>         return rcar_gen3_cpg_init(cpg_pll_config, CLK_EXTALR, cpg_mode);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-12  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09  9:51 [PATCH -next] clk: renesas: r8a77970: Use DEFINE_SPINLOCK() for spinlock Ye Bin
2021-04-09 16:54 ` Stephen Boyd
2021-04-12  9:24 ` Geert Uytterhoeven

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.