Re: [PATCH 1/7] clk: imx: clk-pll14xx: Switch to clk_hw based API

From: Leonard Crestez
Date: Mon Dec 02 2019 - 00:07:54 EST


On 2019-12-02 4:26 AM, Peng Fan wrote:
>> Subject: Re: [PATCH 1/7] clk: imx: clk-pll14xx: Switch to clk_hw based API
>> On Tue, Oct 29, 2019 at 01:40:54PM +0000, Peng Fan wrote:
>>> From: Peng Fan <peng.fan@xxxxxxx>
>>>
>>> Switch the imx_clk_pll14xx function to clk_hw based API, rename
>>> accordingly and add a macro for clk based legacy. This allows us to
>>> move closer to a clear split between consumer and provider clk APIs.
>>>
>>> diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index
>>> bc5bb6ac8636..5038622f1a72 100644
>>> --- a/drivers/clk/imx/clk.h
>>> +++ b/drivers/clk/imx/clk.h
>>> @@ -97,8 +97,12 @@ extern struct imx_pll14xx_clk imx_1443x_pll;
>>> #define imx_clk_mux(name, reg, shift, width, parents, num_parents) \
>>> imx_clk_hw_mux(name, reg, shift, width, parents, num_parents)->clk
>>>
>>> -struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
>>> - void __iomem *base, const struct imx_pll14xx_clk *pll_clk);
>>> +#define imx_clk_pll14xx(name, parent_name, base, pll_clk) \
>>> + imx_clk_hw_pll14xx(name, parent_name, base, pll_clk)->clk
>>> +
>>
>> I would suggest to use an inline function for this, which will be more readable
>> and complying to kernel coding style.
>
> ok, I'll send out v2.

Blindly dereferencing ->clk will crash instead of propagating errors so
you might want to use the to_clk helper from here:

https://patchwork.kernel.org/patch/11257811/

--
Regards,
Leonard