From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Chen-Yu Tsai <wenst@chromium.org>
Cc: "Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Dong Aisheng" <aisheng.dong@nxp.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Yassine Oudjana" <y.oudjana@protonmail.com>,
"Laura Nao" <laura.nao@collabora.com>,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
"Chia-I Wu" <olvaffe@gmail.com>,
kernel@collabora.com, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v2 2/5] clk: mediatek: Refactor pll registration to pass device
Date: Fri, 10 Oct 2025 22:11:20 +0200 [thread overview]
Message-ID: <6009277.31r3eYUQgx@workhorse> (raw)
In-Reply-To: <CAGXv+5FTg3VXpbav5c2Gx2vRgaC=jYURRp0b5tQGw+ScACRSew@mail.gmail.com>
On Thursday, 9 October 2025 10:18:42 Central European Summer Time Chen-Yu Tsai wrote:
> On Thu, Oct 9, 2025 at 4:09 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
> >
> > Il 08/10/25 18:05, Nicolas Frattaroli ha scritto:
> > > As it stands, mtk_clk_register_plls takes a struct device_node pointer
> > > as its first argument. This is a tragic happenstance, as it's trivial to
> > > get the device_node from a struct device, but the opposite not so much.
> > > The struct device is a much more useful thing to have passed down.
> > >
> > > Refactor mtk_clk_register_plls to take a struct device pointer instead
> > > of a struct device_node pointer, and fix up all users of this function.
> > >
> > > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > > ---
> > > drivers/clk/mediatek/clk-mt2701.c | 2 +-
> > > drivers/clk/mediatek/clk-mt2712-apmixedsys.c | 2 +-
> > > drivers/clk/mediatek/clk-mt6735-apmixedsys.c | 4 ++--
> > > drivers/clk/mediatek/clk-mt6765.c | 2 +-
> > > drivers/clk/mediatek/clk-mt6779.c | 2 +-
> > > drivers/clk/mediatek/clk-mt6797.c | 2 +-
> > > drivers/clk/mediatek/clk-mt7622-apmixedsys.c | 2 +-
> > > drivers/clk/mediatek/clk-mt7629.c | 2 +-
> > > drivers/clk/mediatek/clk-mt7981-apmixed.c | 2 +-
> > > drivers/clk/mediatek/clk-mt7986-apmixed.c | 2 +-
> > > drivers/clk/mediatek/clk-mt7988-apmixed.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8135-apmixedsys.c | 3 ++-
> > > drivers/clk/mediatek/clk-mt8167-apmixedsys.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8183-apmixedsys.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8188-apmixedsys.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8195-apusys_pll.c | 3 ++-
> > > drivers/clk/mediatek/clk-mt8196-apmixedsys.c | 3 ++-
> > > drivers/clk/mediatek/clk-mt8196-mcu.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8196-mfg.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8196-vlpckgen.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8365-apmixedsys.c | 2 +-
> > > drivers/clk/mediatek/clk-mt8516-apmixedsys.c | 2 +-
> > > drivers/clk/mediatek/clk-pll.c | 7 ++++---
> > > drivers/clk/mediatek/clk-pll.h | 6 +++---
> > > 24 files changed, 33 insertions(+), 29 deletions(-)
> > >
> >
> > ..snip..
> >
> > > diff --git a/drivers/clk/mediatek/clk-pll.h b/drivers/clk/mediatek/clk-pll.h
> > > index d71c150ce83e4bb2fe78290c2d5570a90084246d..0e2b94b9cd4b56adceee3b04e9ab24c2526471da 100644
> > > --- a/drivers/clk/mediatek/clk-pll.h
> > > +++ b/drivers/clk/mediatek/clk-pll.h
> > > @@ -78,9 +78,9 @@ struct mtk_clk_pll {
> > > const struct mtk_pll_data *data;
> > > };
> > >
> >
> > There's a forward declaration of struct device_node in this header: with this
> > change, that becomes unused.
> >
> > Please change that to a forward declaration of struct device instead.
> >
> > While at it, I'd appreciate if you could either:
> > A. Remove the forward declaration for `struct clk_hw_onecell_data` and for
> > `struct clk_ops` (as both come from clk-provider.h - which this already
> > includes);
> > ...or...
> > B. Remove the inclusion of clk-provider.h and keep the forward declarations.
>
> Prefer (B) since no APIs from clk-provider.h are referenced in the header.
> It is up to the implementation to directly include any and all headers it
> needs.
drivers/clk/mediatek/clk-pll.h:67:16: error: field has incomplete type 'struct clk_hw'
67 | struct clk_hw hw;
| ^
drivers/clk/mediatek/clk-pll.h:67:9: note: forward declaration of 'struct clk_hw'
67 | struct clk_hw hw;
| ^
The compiler needs to know the complete type here, as it's not a
pointer but a member proper, which is needed for the container_of
macro to work.
In other words, clk-provider.h is needed.
Kind regards,
Nicolas Frattaroli
>
> ChenYu
>
> > After which:
> >
> > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> >
> > > -int mtk_clk_register_plls(struct device_node *node,
> > > - const struct mtk_pll_data *plls, int num_plls,
> > > - struct clk_hw_onecell_data *clk_data);
> > > +int mtk_clk_register_plls(struct device *dev, const struct mtk_pll_data *plls,
> > > + int num_plls, struct clk_hw_onecell_data *clk_data);
> > > +
> > > void mtk_clk_unregister_plls(const struct mtk_pll_data *plls, int num_plls,
> > > struct clk_hw_onecell_data *clk_data);
> > >
> > >
> >
> >
>
next prev parent reply other threads:[~2025-10-10 20:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-08 16:05 [PATCH v2 0/5] MediaTek PLL Refactors and Fixes Nicolas Frattaroli
2025-10-08 16:05 ` [PATCH v2 1/5] clk: Respect CLK_OPS_PARENT_ENABLE during recalc Nicolas Frattaroli
2025-10-09 7:07 ` Chen-Yu Tsai
2025-10-09 8:01 ` AngeloGioacchino Del Regno
2025-10-08 16:05 ` [PATCH v2 2/5] clk: mediatek: Refactor pll registration to pass device Nicolas Frattaroli
2025-10-09 7:09 ` Chen-Yu Tsai
2025-10-09 7:19 ` Chen-Yu Tsai
2025-10-09 8:09 ` AngeloGioacchino Del Regno
2025-10-09 8:18 ` Chen-Yu Tsai
2025-10-09 8:52 ` AngeloGioacchino Del Regno
2025-10-10 20:11 ` Nicolas Frattaroli [this message]
2025-10-08 16:05 ` [PATCH v2 3/5] clk: mediatek: Pass device to clk_hw_register for PLLs Nicolas Frattaroli
2025-10-09 8:11 ` AngeloGioacchino Del Regno
2025-10-09 8:32 ` Chen-Yu Tsai
2025-10-08 16:05 ` [PATCH v2 4/5] clk: mediatek: Refactor pllfh registration to pass device Nicolas Frattaroli
2025-10-09 7:33 ` Chen-Yu Tsai
2025-10-10 20:06 ` Nicolas Frattaroli
2025-10-09 8:12 ` AngeloGioacchino Del Regno
2025-10-08 16:05 ` [PATCH v2 5/5] clk: mediatek: Add mfg_eb as parent to mt8196 mfgpll clocks Nicolas Frattaroli
2025-10-09 8:22 ` AngeloGioacchino Del Regno
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=6009277.31r3eYUQgx@workhorse \
--to=nicolas.frattaroli@collabora.com \
--cc=aisheng.dong@nxp.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=kernel@collabora.com \
--cc=laura.nao@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mturquette@baylibre.com \
--cc=nfraprado@collabora.com \
--cc=olvaffe@gmail.com \
--cc=sboyd@kernel.org \
--cc=wenst@chromium.org \
--cc=y.oudjana@protonmail.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;
as well as URLs for NNTP newsgroup(s).