[PATCH v2 2/5] clk: mediatek: Refactor pll registration to pass device

AngeloGioacchino Del Regno angelogioacchino.delregno at collabora.com
Thu Oct 9 01:09:35 PDT 2025


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 at 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.

After which:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at 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);
>   
> 





More information about the Linux-mediatek mailing list