linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Abel Vesa <abel.vesa@nxp.com>, Shawn Guo <shawnguo@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>
Cc: Aisheng Dong <aisheng.dong@nxp.com>,
	Sascha Hauer <kernel@pengutronix.de>,
	Jacky Bai <ping.bai@nxp.com>, Peng Fan <peng.fan@nxp.com>,
	dl-linux-imx <linux-imx@nxp.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/9] clk: imx: Replace all the clk based helpers with macros
Date: Tue, 19 Nov 2019 16:28:59 +0000	[thread overview]
Message-ID: <VI1PR04MB70231C5BC647FE63815C194AEE4C0@VI1PR04MB7023.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 1574172496-12987-2-git-send-email-abel.vesa@nxp.com

On 2019-11-19 4:08 PM, Abel Vesa wrote:
> Replacing with macros all the clk based API helpers we reduce the code
> duplication. The end goal is to get rid of all these macros when there
> will be no more users of the clk based API, that is, when all the i.MX
> clock provider drivers will be switched completely to the clk_hw based
> API.

I personally prefer inline functions to macros whenever possible (so 
everything other than for_each and similar).

BTW: All of these macros will crash if the underlying clk_hw 
registration returns null or error.

> This is another step in moving away from the non clk_hw based API usage
> throughout the i.MX clock drivers. The reason for doing that is to
> have a clear split between the clock provider and the clock consumer API.
> 
> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
> ---
>   drivers/clk/imx/clk.h | 39 ++++++++++++---------------------------
>   1 file changed, 12 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
> index bc5bb6a..945ce4d 100644
> --- a/drivers/clk/imx/clk.h
> +++ b/drivers/clk/imx/clk.h
> @@ -73,9 +73,18 @@ extern struct imx_pll14xx_clk imx_1443x_pll;
>   #define imx_clk_fixed_factor(name, parent, mult, div) \
>   	imx_clk_hw_fixed_factor(name, parent, mult, div)->clk
>   
> +#define imx_clk_divider(name, parent, reg, shift, width) \
> +	imx_clk_hw_divider(name, parent, reg, shift, width)->clk
> +
>   #define imx_clk_divider2(name, parent, reg, shift, width) \
>   	imx_clk_hw_divider2(name, parent, reg, shift, width)->clk
>   
> +#define imx_clk_divider_flags(name, parent, reg, shift, width, flags) \
> +	imx_clk_hw_divider_flags(name, parent, reg, shift, width, flags)->clk
> +
> +#define imx_clk_gate(name, parent, reg, shift) \
> +	imx_clk_hw_gate(name, parent, reg, shift)->clk
> +
>   #define imx_clk_gate_dis(name, parent, reg, shift) \
>   	imx_clk_hw_gate_dis(name, parent, reg, shift)->clk
>   
> @@ -97,6 +106,9 @@ 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
>   
> +#define imx_clk_fixed(name, rate) \
> +	imx_clk_hw_fixed(name, rate)->clk
> +
>   struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
>   		 void __iomem *base, const struct imx_pll14xx_clk *pll_clk);
>   
> @@ -198,11 +210,6 @@ struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg,
>   			      u8 shift, u8 width, const char * const *parents,
>   			      int num_parents, void (*fixup)(u32 *val));
>   
> -static inline struct clk *imx_clk_fixed(const char *name, int rate)
> -{
> -	return clk_register_fixed_rate(NULL, name, NULL, 0, rate);
> -}
> -
>   static inline struct clk_hw *imx_clk_hw_fixed(const char *name, int rate)
>   {
>   	return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
> @@ -224,13 +231,6 @@ static inline struct clk_hw *imx_clk_hw_fixed_factor(const char *name,
>   			CLK_SET_RATE_PARENT, mult, div);
>   }
>   
> -static inline struct clk *imx_clk_divider(const char *name, const char *parent,
> -		void __iomem *reg, u8 shift, u8 width)
> -{
> -	return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
> -			reg, shift, width, 0, &imx_ccm_lock);
> -}
> -
>   static inline struct clk_hw *imx_clk_hw_divider(const char *name,
>   						const char *parent,
>   						void __iomem *reg, u8 shift,
> @@ -240,14 +240,6 @@ static inline struct clk_hw *imx_clk_hw_divider(const char *name,
>   				       reg, shift, width, 0, &imx_ccm_lock);
>   }
>   
> -static inline struct clk *imx_clk_divider_flags(const char *name,
> -		const char *parent, void __iomem *reg, u8 shift, u8 width,
> -		unsigned long flags)
> -{
> -	return clk_register_divider(NULL, name, parent, flags,
> -			reg, shift, width, 0, &imx_ccm_lock);
> -}
> -
>   static inline struct clk_hw *imx_clk_hw_divider_flags(const char *name,
>   						   const char *parent,
>   						   void __iomem *reg, u8 shift,
> @@ -274,13 +266,6 @@ static inline struct clk *imx_clk_divider2_flags(const char *name,
>   			reg, shift, width, 0, &imx_ccm_lock);
>   }
>   
> -static inline struct clk *imx_clk_gate(const char *name, const char *parent,
> -		void __iomem *reg, u8 shift)
> -{
> -	return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
> -			shift, 0, &imx_ccm_lock);
> -}
> -
>   static inline struct clk_hw *imx_clk_hw_gate_flags(const char *name, const char *parent,
>   		void __iomem *reg, u8 shift, unsigned long flags)
>   {
> 


  reply	other threads:[~2019-11-19 16:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 14:08 [PATCH 0/9] clk: imx: Trivial cleanups for clk_hw based API Abel Vesa
2019-11-19 14:08 ` [PATCH 1/9] clk: imx: Replace all the clk based helpers with macros Abel Vesa
2019-11-19 16:28   ` Leonard Crestez [this message]
2019-11-19 14:08 ` [PATCH 2/9] clk: imx: pllv1: Switch to clk_hw based API Abel Vesa
2019-11-19 14:08 ` [PATCH 3/9] clk: imx: pllv2: " Abel Vesa
2019-11-19 14:08 ` [PATCH 4/9] clk: imx: imx7ulp composite: Rename to show is clk_hw based Abel Vesa
2019-11-19 14:08 ` [PATCH 5/9] clk: imx: Rename sccg and frac pll register to suggest clk_hw Abel Vesa
2019-11-19 16:32   ` Leonard Crestez
2019-11-19 14:08 ` [PATCH 6/9] clk: imx: Rename the imx_clk_pllv4 to imply it's clk_hw based Abel Vesa
2019-11-19 14:08 ` [PATCH 7/9] clk: imx: Rename the imx_clk_pfdv2 " Abel Vesa
2019-11-19 14:08 ` [PATCH 8/9] clk: imx: Rename the imx_clk_divider_gate " Abel Vesa
2019-11-19 14:08 ` [PATCH 9/9] clk: imx7up: Rename the clks to hws Abel Vesa
2019-11-22  7:56 ` [PATCH 0/9] clk: imx: Trivial cleanups for clk_hw based API Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR04MB70231C5BC647FE63815C194AEE4C0@VI1PR04MB7023.eurprd04.prod.outlook.com \
    --to=leonard.crestez@nxp.com \
    --cc=abel.vesa@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).