Web lists-archives.com

Re: [PATCH v1 1/1] clk: npcm: get fixed input clks from DT




Quoting Tali Perry (2018-12-05 11:47:02)
> ---

No commit text? No Signed-off-by?

Sorry, I don't understand what this patch is for or what's going on.

>  drivers/clk/clk-npcm7xx.c | 64 +++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 53 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/clk/clk-npcm7xx.c b/drivers/clk/clk-npcm7xx.c
> index 27a86b7a34db..25f8ccaa3d2f 100644
> --- a/drivers/clk/clk-npcm7xx.c
> +++ b/drivers/clk/clk-npcm7xx.c
> @@ -8,17 +8,23 @@
>   */
>  
>  #include <linux/module.h>
> +#include <linux/clk.h>
>  #include <linux/clk-provider.h>
> +#include <linux/device.h>
>  #include <linux/io.h>
>  #include <linux/kernel.h>
>  #include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_platform.h>
>  #include <linux/of_address.h>
> +#include <linux/platform_device.h>
>  #include <linux/slab.h>
>  #include <linux/err.h>
> +#include <linux/rational.h>
>  #include <linux/bitfield.h>
> -
>  #include <dt-bindings/clock/nuvoton,npcm7xx-clock.h>
>  
> +

I don't get it. Please don't send random whitespace changes in a patch.

>  struct npcm7xx_clk_pll {
>         struct clk_hw   hw;
>         void __iomem    *pllcon;
> @@ -44,7 +50,8 @@ static unsigned long npcm7xx_clk_pll_recalc_rate(struct clk_hw *hw,
>         u64 ret;
>  
>         if (parent_rate == 0) {
> -               pr_err("%s: parent rate is zero", __func__);
> +               pr_err("%s: parent rate is zero. reg=%s\n", __func__,
> +                      hw->init->name);

Why do we care?

>                 return 0;
>         }
>  
> @@ -544,12 +552,14 @@ static void __init npcm7xx_clk_init(struct device_node *clk_np)
>         void __iomem *clk_base;
>         struct resource res;
>         struct clk_hw *hw;
> +       struct clk *clk;
>         int ret;
>         int i;
>  
> +       clk_base = NULL;
>         ret = of_address_to_resource(clk_np, 0, &res);
>         if (ret) {
> -               pr_err("%pOFn: failed to get resource, ret %d\n", clk_np,
> +               pr_err("%s: failed to get resource, ret %d\n", clk_np->name,
>                         ret);
>                 return;
>         }

Drop this change as it's making things worse.

> @@ -558,9 +568,10 @@ static void __init npcm7xx_clk_init(struct device_node *clk_np)
>         if (!clk_base)
>                 goto npcm7xx_init_error;
>  
> -       npcm7xx_clk_data = kzalloc(struct_size(npcm7xx_clk_data, hws,
> -                                  NPCM7XX_NUM_CLOCKS), GFP_KERNEL);
> -       if (!npcm7xx_clk_data)
> +       npcm7xx_clk_data = kzalloc(sizeof(*npcm7xx_clk_data->hws) *
> +               NPCM7XX_NUM_CLOCKS + sizeof(npcm7xx_clk_data), GFP_KERNEL);
> +
> +       if (!npcm7xx_clk_data->hws)
>                 goto npcm7xx_init_np_err;
>  
>         npcm7xx_clk_data->num = NPCM7XX_NUM_CLOCKS;

Drop this hunk.