Re: [PATCH v15 2/2] clk: clk-loongson2: add clock controller driver support

From: Stephen Boyd
Date: Wed Mar 22 2023 - 11:16:24 EST


Quoting zhuyinbo (2023-03-21 19:07:26)
>
> 在 2023/3/22 上午7:42, Stephen Boyd 写道:
> > Quoting Yinbo Zhu (2023-03-21 06:07:10)
> >> diff --git a/drivers/clk/clk-loongson2.c b/drivers/clk/clk-loongson2.c
> >> new file mode 100644
> >> index 000000000000..090810655511
> >> --- /dev/null
> >> +++ b/drivers/clk/clk-loongson2.c
> >> @@ -0,0 +1,344 @@
[....]
> >> +
> >> +static void __iomem *loongson2_pll_base;
> > Why is this a global?
>
> Normally, this should be an element in the structure, but since there is
> only one
>
> element, It is directly defined as a global variable for use by other
> function.
>

Ok. Globals are frowned upon but it's just a single pointers so I guess
it's Ok.

> >
> >> + return PTR_ERR(loongson2_pll_base);
> >> +
> >> + loongson2_clocks_init(dev);
> > Please inline this function here.
>
> The loongson2_clocks_init had inline in this version, or do you mean something else ? Need to inline the probe?

I mean get rid of the function loongson2_clocks_init() and move the code
in that function into this probe function. With this patch the probe is
split to two functions when it should be one function.