[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEev2e_4RfHChkyvj=X8XFXC8-Tk_=SLJsMCR1M+v6sC+urxsQ@mail.gmail.com>
Date: Fri, 16 Jan 2026 14:32:21 -0600
From: Anirudh Srinivasan <asrinivasan@....tenstorrent.com>
To: Krzysztof Kozlowski <krzk@...nel.org>, Brian Masney <bmasney@...hat.com>
Cc: Drew Fustini <dfustini@....tenstorrent.com>, Joel Stanley <jms@....tenstorrent.com>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Michael Turquette <mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>, linux-riscv@...ts.infradead.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org, joel@....id.au, fustini@...nel.org, mpe@...nel.org,
mpe@....tenstorrent.com, npiggin@....tenstorrent.com, agross@...nel.org,
agross@....tenstorrent.com
Subject: Re: [PATCH 3/8] clk: tenstorrent: Add Atlantis clock controller driver
Hello Brian and Krzysztof,
On Fri, Jan 16, 2026 at 3:00 AM Krzysztof Kozlowski <krzk@...nel.org> wrote:
>
> On Thu, Jan 15, 2026 at 09:05:35PM -0500, Brian Masney wrote:
> >
> > Are these abstractions really needed? Why not just call spin_lock/unlock
> > directly?
>
> They are actually harmful - make code less readable and introduce very
> poor (lose) API accepting whatever pointer... This is exactly code which
> should notbe here.
Some of the clocks use a regmap for register accesses, while the
others use the devm_clk_hw_register_xxx functions which require a
pointer to the control register and a lock. My above implementation
sets the regmap's lock and ensures that the same lock is used across
both types of clocks.
I tried setting the regmap_lock/unlock functions to
spin_lock/spin_unlock like you suggested Brian, but that throws a
compile time error
error: initialization of 'void (*)(void *)' from incompatible pointer
type 'void (*)(spinlock_t *)' {aka 'void (*)(struct spinlock *)'}
[-Wincompatible-pointer-types]
This pattern is used by other drivers when they want to override the
regmap's lock [1] [2] [3]. Should I be doing this in a different
manner? Please let me know.
[1] https://elixir.bootlin.com/linux/v6.18.5/source/drivers/soc/sunxi/sunxi_sram.c#L338
[2] https://elixir.bootlin.com/linux/v6.18.5/source/drivers/mfd/atc260x-core.c#L47
[3] https://elixir.bootlin.com/linux/v6.18.5/source/drivers/net/ethernet/microchip/encx24j600-regmap.c#L46
Powered by blists - more mailing lists