Re: [PATCH 4.14 056/109] clk: ti: clkctrl: add support for retrying failed init

From: Dan Rue
Date: Sun Mar 18 2018 - 23:44:17 EST


On Fri, Mar 16, 2018 at 04:23:25PM +0100, Greg Kroah-Hartman wrote:
> 4.14-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Tero Kristo <t-kristo@xxxxxx>
>
>
> [ Upstream commit 729e13bf58e643b9accd2a14c55b555958702fb0 ]
>
> In case the clkctrl node contains assigned-clock-* entries, registering
> the provider can fail with -EPROBE_DEFER. In this case, add the
> provider to the retry_init clock list so it will be cleaned up later.
>
> Signed-off-by: Tero Kristo <t-kristo@xxxxxx>
> Acked-by: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

This fails to build for me on arm32:

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=build-arm multi_v7_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=build-arm

...

../drivers/clk/ti/clkctrl.c: In function â_ti_omap4_clkctrl_setupâ:
../drivers/clk/ti/clkctrl.c:497:27: error: passing argument 2 of âti_clk_retry_initâ from incompatible pointer type
[-Werror=incompatible-pointer-types]
ti_clk_retry_init(node, provider, _clkctrl_add_provider);
^~~~~~~~
In file included from ../drivers/clk/ti/clkctrl.c:24:0:
../drivers/clk/ti/clock.h:265:5: note: expected âstruct clk_hw *â but argument is of type âstruct omap_clkctrl_prov
ider *â
int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
^~~~~~~~~~~~~~~~~ ../drivers/clk/ti/clkctrl.c:497:37: error: passing argument 3 of âti_clk_retry_initâ from incompatible pointer type
[-Werror=incompatible-pointer-types]
ti_clk_retry_init(node, provider, _clkctrl_add_provider);
^~~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/clk/ti/clkctrl.c:24:0: ../drivers/clk/ti/clock.h:265:5: note: expected âti_of_clk_init_cb_t {aka void (*)(struct clk_hw *, struct device_n
ode *)}â but argument is of type âvoid (*)(void *, struct device_node *)â
int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [../scripts/Makefile.build:329: drivers/clk/ti/clkctrl.o] Error 1
make[3]: *** [../scripts/Makefile.build:587: drivers/clk/ti] Error 2
make[2]: *** [../scripts/Makefile.build:587: drivers/clk] Error 2
make[1]: *** [/home/drue/src/linux/4.14-rc/Makefile:1031: drivers] Error 2
make[1]: Leaving directory '/home/drue/src/linux/4.14-rc/build-arm'
make: *** [Makefile:146: sub-make] Error 2

> ---
> drivers/clk/ti/clkctrl.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> --- a/drivers/clk/ti/clkctrl.c
> +++ b/drivers/clk/ti/clkctrl.c
> @@ -400,6 +400,12 @@ _ti_clkctrl_setup_subclks(struct omap_cl
> }
> }
>
> +static void __init _clkctrl_add_provider(void *data,
> + struct device_node *np)
> +{
> + of_clk_add_hw_provider(np, _ti_omap4_clkctrl_xlate, data);
> +}
> +
> static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
> {
> struct omap_clkctrl_provider *provider;
> @@ -411,6 +417,7 @@ static void __init _ti_omap4_clkctrl_set
> struct omap_clkctrl_clk *clkctrl_clk;
> const __be32 *addrp;
> u32 addr;
> + int ret;
>
> addrp = of_get_address(node, 0, NULL, NULL);
> addr = (u32)of_translate_address(node, addrp);
> @@ -485,7 +492,10 @@ static void __init _ti_omap4_clkctrl_set
> reg_data++;
> }
>
> - of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);
> + ret = of_clk_add_hw_provider(node, _ti_omap4_clkctrl_xlate, provider);
> + if (ret == -EPROBE_DEFER)
> + ti_clk_retry_init(node, provider, _clkctrl_add_provider);
> +
> return;
>
> cleanup:
>
>