[PATCH 1/1] clk: imx: scu: remove the calling of device_is_bound

Aisheng Dong aisheng.dong at nxp.com
Tue Nov 24 05:33:30 EST 2020


Hi Shawn,

> From: Aisheng Dong <aisheng.dong at nxp.com>
> Sent: Thursday, November 19, 2020 7:43 PM
> 
> The device_is_bound() is unvisable to drivers when built as modules.
> It's also not aimed to be used by drivers according to Greg K.H.
> Let's remove it from clk-scu driver and find another way to do proper driver
> loading sequence.
> 
> Cc: Shawn Guo <shawnguo at kernel.org>
> Cc: Sascha Hauer <kernel at pengutronix.de>
> Cc: Stephen Boyd <sboyd at kernel.org>
> Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support")
> Reported-by: Sudip Mukherjee <sudipm.mukherjee at gmail.com>
> Signed-off-by: Dong Aisheng <aisheng.dong at nxp.com>

Could you apply this fix first as clk-scu has COMPILE_TEST enabled and may affect other
platforms build test?

config MXC_CLK_SCU
        tristate "IMX SCU clock"
        depends on ARCH_MXC || COMPILE_TEST
        depends on IMX_SCU && HAVE_ARM_SMCCC

BTW, I've sent another patch series [1] to support defer probe without calling device_is_bound
per the last discussion with Greg K.H. [2].

1. https://patchwork.kernel.org/project/linux-clk/cover/20201124100802.22775-1-aisheng.dong@nxp.com/
2. https://lore.kernel.org/patchwork/patch/1334670/

Regards
Aisheng

> ---
>  drivers/clk/imx/clk-scu.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index
> d10f60e48ece..1f5518b7ab39 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -153,7 +153,6 @@ static inline struct clk_scu *to_clk_scu(struct clk_hw
> *hw)
> 
>  int imx_clk_scu_init(struct device_node *np)  {
> -	struct platform_device *pd_dev;
>  	u32 clk_cells;
>  	int ret, i;
> 
> @@ -166,17 +165,11 @@ int imx_clk_scu_init(struct device_node *np)
>  	if (clk_cells == 2) {
>  		for (i = 0; i < IMX_SC_R_LAST; i++)
>  			INIT_LIST_HEAD(&imx_scu_clks[i]);
> -		/*
> -		 * Note: SCU clock driver depends on SCU power domain to be ready
> -		 * first. As there're no power domains under scu clock node in dts,
> -		 * we can't use PROBE_DEFER automatically.
> -		 */
> +
> +		/* pd_np will be used to attach power domains later */
>  		pd_np = of_find_compatible_node(NULL, NULL, "fsl,scu-pd");
> -		pd_dev = of_find_device_by_node(pd_np);
> -		if (!pd_dev || !device_is_bound(&pd_dev->dev)) {
> -			of_node_put(pd_np);
> -			return -EPROBE_DEFER;
> -		}
> +		if (!pd_np)
> +			return -EINVAL;
>  	}
> 
>  	return platform_driver_register(&imx_clk_scu_driver);
> --
> 2.23.0



More information about the linux-arm-kernel mailing list