Thread (118 messages) 118 messages, 8 authors, 2023-09-28

Re: [PATCH 12/37] clk: renesas: rzg2l: reduce the critical area

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2023-09-14 13:12:29
Also in: linux-clk, linux-devicetree, linux-gpio, linux-mmc, linux-renesas-soc, linux-serial, lkml

Hi Claudiu,

On Tue, Sep 12, 2023 at 6:52 AM Claudiu [off-list ref] wrote:
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

spinlock in rzg2l_mod_clock_endisable() is intended to protect the accesses
to hardware register. There is no need to protect the instructions that set
temporary variable which will be then written to register. Thus limit the
spinlock only to the hardware register access.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Thanks for your patch!
quoted hunk ↗ jump to hunk
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -912,13 +912,13 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)

        dev_dbg(dev, "CLK_ON %u/%pC %s\n", CLK_ON_R(reg), hw->clk,
                enable ? "ON" : "OFF");
-       spin_lock_irqsave(&priv->rmw_lock, flags);

        value = bitmask << 16;
        if (enable)
                value |= bitmask;
-       writel(value, priv->base + CLK_ON_R(reg));

+       spin_lock_irqsave(&priv->rmw_lock, flags);
+       writel(value, priv->base + CLK_ON_R(reg));
        spin_unlock_irqrestore(&priv->rmw_lock, flags);
After this, it becomes obvious there is nothing to protect at all,
so the locking can just be removed from this function?

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help