[PATCH] clk: clk-fixed-factor: compile clk of provider only if it is enabled

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Jul 29 23:23:14 PDT 2025


Hi Anis,

On 30.07.25 05:50, chalianis1 at gmail.com wrote:
> From: Chali Anis <chalianis1 at gmail.com>
> 
> This permits to not compile when it's not used, fix undefined
> reference error.

Normally undefined references are garbage collected by the linker if
the code that references them is going to be discarded as well.

We have configurations with and without OF support that make use
of clocks in CI I think, so I am curious to know what configuration
you used to provoke the error.

Cheers,
Ahma

> 
> Signed-off-by: Chali Anis <chalianis1 at gmail.com>
> ---
>  drivers/clk/clk-fixed-factor.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
> index d2c808d40c63..ea04a4bf7f0f 100644
> --- a/drivers/clk/clk-fixed-factor.c
> +++ b/drivers/clk/clk-fixed-factor.c
> @@ -97,6 +97,8 @@ struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
>  						       flags, mult, div));
>  }
>  
> +#ifdef CONFIG_COMMON_CLK_OF_PROVIDER
> +
>  /**
>   * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock
>   */
> @@ -130,3 +132,4 @@ static int of_fixed_factor_clk_setup(struct device_node *node)
>  }
>  CLK_OF_DECLARE(fixed_factor_clk, "fixed-factor-clock",
>  		of_fixed_factor_clk_setup);
> +#endif


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list