Re: [PATCH] clk: imx8mm: Switch to platform driver

From: Stephen Boyd
Date: Tue Jun 25 2019 - 16:39:44 EST


Quoting Abel Vesa (2019-06-24 03:54:32)
> In order to make the clock provider a platform driver
> all the data and code needs to be outside of .init section.

Yes, but why are you making this change in general?

>
> Signed-off-by: Abel Vesa <abel.vesa@xxxxxxx>
[...]
> @@ -480,7 +481,7 @@ static int __init imx8mm_clocks_init(struct device_node *ccm_node)
> clks[IMX8MM_SYS_PLL2_500M] = imx_clk_fixed_factor("sys_pll2_500m", "sys_pll2_out", 1, 2);
> clks[IMX8MM_SYS_PLL2_1000M] = imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
>
> - np = ccm_node;
> + np = dev->of_node;
> base = of_iomap(np, 0);

If we're using platform device here it would be nice to also use
platform device APIs to map memory and request resources, etc.

> if (WARN_ON(!base))
> return -ENOMEM;
> @@ -682,4 +683,19 @@ static int __init imx8mm_clocks_init(struct device_node *ccm_node)
>
> return 0;
> }
> -CLK_OF_DECLARE_DRIVER(imx8mm, "fsl,imx8mm-ccm", imx8mm_clocks_init);
> +
> +static const struct of_device_id imx8mm_clk_of_match[] = {
> + { .compatible = "fsl,imx8mm-ccm" },
> + { /* Sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, imx8mm_clk_of_match);
> +
> +

Nitpick: Drop the second newline.

> +static struct platform_driver imx8mm_clk_driver = {
> + .probe = imx8mm_clocks_probe,
> + .driver = {
> + .name = "imx8mm-ccm",
> + .of_match_table = of_match_ptr(imx8mm_clk_of_match),
> + },
> +};
> +module_platform_driver(imx8mm_clk_driver);