[PATCH 02/18] CLK: Add support for composite clock from Linux kernel.

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 2 23:48:57 PST 2015


On Mon, Mar 02, 2015 at 11:21:46PM +0300, Andrey Panov wrote:
> Arch Kconfig should select CLK_NEED_COMPOSITE to have this support
> compiled in.
> 
> Signed-off-by: Andrey Panov <rockford at yandex.ru>
> ---
>  drivers/clk/Kconfig         |   3 +
>  drivers/clk/Makefile        |   1 +
>  drivers/clk/clk-composite.c | 146 ++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/clk.h         |   6 ++
>  4 files changed, 156 insertions(+)
>  create mode 100644 drivers/clk/clk-composite.c
> 
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index 1cf0ccb..6db1f33 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -8,6 +8,9 @@ config COMMON_CLK
>  	select HAVE_CLK
>  	bool
>  
> +config CLK_NEED_COMPOSITE
> +	bool
> +
>  config COMMON_CLK_OF_PROVIDER
>  	bool
>  	help
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index fa707dd..bdd93f5 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -1,6 +1,7 @@
>  obj-$(CONFIG_COMMON_CLK)	+= clk.o clk-fixed.o clk-divider.o clk-fixed-factor.o \
>  				clk-mux.o clk-gate.o
>  obj-$(CONFIG_CLKDEV_LOOKUP)	+= clkdev.o
> +obj-$(CONFIG_CLK_NEED_COMPOSITE)	+= clk-composite.o

Same here, no need for a separate option. You can add this to the
obj-$(CONFIG_COMMON_CLK) list above.

> +
> +static struct clk_ops clk_composite_ops = {
> +        .get_parent = clk_composite_get_parent,
> +        .set_parent = clk_composite_set_parent,
> +	.recalc_rate = clk_composite_recalc_rate,
> +        .round_rate = clk_composite_round_rate,

Indention broken here.

> +struct clk *clk_register_composite(const char *name,
> +			const char **parent_names, int num_parents,
> +			struct clk *mux_clk,
> +			struct clk *rate_clk,
> +			struct clk *gate_clk,
> +			unsigned long flags)
> +{
> +	struct clk_composite *composite;
> +	int ret;
> +
> +	composite = kzalloc(sizeof(*composite), GFP_KERNEL);
> +	if (!composite) {
> +		pr_err("%s: could not allocate composite clk\n", __func__);
> +		return ERR_PTR(-ENOMEM);
> +	}

Please use xzalloc here. You can skip the error check then.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list