[PATCH v3 01/32] clk: at91: pmc: add macros for clk_parent_data

claudiu beznea claudiu.beznea at tuxon.dev
Sat Sep 6 11:33:34 PDT 2025


Hi, Ryan,

On 7/10/25 23:06, Ryan.Wanner at microchip.com wrote:
> From: Claudiu Beznea <claudiu.beznea at tuxon.dev>
> 
> Add helpers to set parent_data objects in platform specific drivers.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea at tuxon.dev>
> [ryan.wanner at microchip.com: enclose complex macro with parentheses.]
> Signed-off-by: Ryan Wanner <Ryan.Wanner at microchip.com>
> ---
>   drivers/clk/at91/pmc.h | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
> index 4fb29ca111f7..0b721a65b77f 100644
> --- a/drivers/clk/at91/pmc.h
> +++ b/drivers/clk/at91/pmc.h
> @@ -15,6 +15,12 @@
>   
>   #include <dt-bindings/clock/at91.h>
>   
> +#define AT91_CLK_PD_NAME(n, i) ((struct clk_parent_data){ \
> +	.hw = NULL, .name = (n), .fw_name = (n), .index = (i), \

It's been a while since I worked on this. Looking again at it, having .name
and .fw_name filled with the same data may not be valid all the time.

Moreover, investigating it further I found that we cannot use struct
clk_parent_data::fw_name and struct clk_parent_data::index as the clocks
for these SoCs are registered with CLK_OF_REGISTER() and have no struct
device associated such that dev_or_parent_of_node() (called with
__clk_register()) to return a struct device_node pointer and associated
fw_name code to work properly.

It should have been something like:

#define AT91_CLK_PD_NAME(n) ((struct clk_parent_data){ \
	.hw = NULL, .name = (n), .fw_name = NULL, .index = -1, \
}

> +})
> +
> +#define AT91_CLK_PD_HW(h) ((struct clk_parent_data){ .hw = (h) })

Could you please update this one, something like:

#define AT91_CLK_PD_HW(h) ((struct clk_parent_data){ \
	.hw = (h), .name = NULL, .fw_name = NULL, .index = -1, \
}

Thank you,
Claudiu



> +
>   extern spinlock_t pmc_pcr_lock;
>   
>   struct pmc_data {




More information about the linux-arm-kernel mailing list