Message ID | 9073a6bfb7791e492156331fa8a0ea87a7c7cef6.1716975021.git.geert+renesas@glider.be (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | clk: renesas: Lock initialization cleanups | expand |
Quoting Geert Uytterhoeven (2024-05-29 02:35:09) > A global spinlock can be initialized automatically with > DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). > > Suggested-by: Ye Bin <yebin10@huawei.com> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- Shouldn't this be first so that the previous patch can use the initialized spinlock?
Hi Stephen, On Wed, May 29, 2024 at 9:56 PM Stephen Boyd <sboyd@kernel.org> wrote: > Quoting Geert Uytterhoeven (2024-05-29 02:35:09) > > A global spinlock can be initialized automatically with > > DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). > > > > Suggested-by: Ye Bin <yebin10@huawei.com> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > > --- > > Shouldn't this be first so that the previous patch can use the > initialized spinlock? Order of the patches doesn't matter. r8a77970_cpg_mssr_init() in the R-Car V3M sub-driver calls into rcar_gen3_cpg_init() in the Gen3 family sub-driver, which initialized the spinlock. Gr{oetje,eeting}s, Geert
Quoting Geert Uytterhoeven (2024-05-29 02:35:09) > A global spinlock can be initialized automatically with > DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). > > Suggested-by: Ye Bin <yebin10@huawei.com> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> > --- Reviewed-by: Stephen Boyd <sboyd@kernel.org>
diff --git a/drivers/clk/renesas/rcar-cpg-lib.c b/drivers/clk/renesas/rcar-cpg-lib.c index 5a15f8788b9227d9..42b126ea3e1337c1 100644 --- a/drivers/clk/renesas/rcar-cpg-lib.c +++ b/drivers/clk/renesas/rcar-cpg-lib.c @@ -22,7 +22,7 @@ #include "rcar-cpg-lib.h" -spinlock_t cpg_lock; +DEFINE_SPINLOCK(cpg_lock); void cpg_reg_modify(void __iomem *reg, u32 clear, u32 set) { diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c index d0129a6509411662..20b89eb6c35c1f07 100644 --- a/drivers/clk/renesas/rcar-gen3-cpg.c +++ b/drivers/clk/renesas/rcar-gen3-cpg.c @@ -551,7 +551,5 @@ int __init rcar_gen3_cpg_init(const struct rcar_gen3_cpg_pll_config *config, cpg_quirks = (uintptr_t)attr->data; pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks); - spin_lock_init(&cpg_lock); - return 0; } diff --git a/drivers/clk/renesas/rcar-gen4-cpg.c b/drivers/clk/renesas/rcar-gen4-cpg.c index 8e4559fbb0bc3352..0e2c27adcfe784a0 100644 --- a/drivers/clk/renesas/rcar-gen4-cpg.c +++ b/drivers/clk/renesas/rcar-gen4-cpg.c @@ -507,7 +507,5 @@ int __init rcar_gen4_cpg_init(const struct rcar_gen4_cpg_pll_config *config, cpg_clk_extalr = clk_extalr; cpg_mode = mode; - spin_lock_init(&cpg_lock); - return 0; }
A global spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). Suggested-by: Ye Bin <yebin10@huawei.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- drivers/clk/renesas/rcar-cpg-lib.c | 2 +- drivers/clk/renesas/rcar-gen3-cpg.c | 2 -- drivers/clk/renesas/rcar-gen4-cpg.c | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-)