lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161128101036.GS14217@n2100.armlinux.org.uk>
Date:   Mon, 28 Nov 2016 10:10:36 +0000
From:   Russell King - ARM Linux <linux@...linux.org.uk>
To:     Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Cc:     Stephen Boyd <sboyd@...eaurora.org>, Rob Herring <robh@...nel.org>,
        Linux-ALSA <alsa-devel@...a-project.org>,
        Linux-DT <devicetree@...r.kernel.org>,
        Michael Turquette <mturquette@...libre.com>,
        Linux-Kernel <linux-kernel@...r.kernel.org>,
        Mark Brown <broonie@...nel.org>, linux-clk@...r.kernel.org,
        Linux-ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v3] clkdev: add devm_of_clk_get()

On Mon, Nov 28, 2016 at 09:32:51AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
> 
> Current Linux has of_clk_get(), but doesn't have devm_of_clk_get().
> This patch adds it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
> ---
> v2 -> v3
> 
>  - implement in clk-devres.c, and reused existing devm_clk_release()
> 
>  drivers/clk/clk-devres.c | 21 +++++++++++++++++++++
>  include/linux/clk.h      |  7 +++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
> index 8f57154..2449b25 100644
> --- a/drivers/clk/clk-devres.c
> +++ b/drivers/clk/clk-devres.c
> @@ -53,3 +53,24 @@ void devm_clk_put(struct device *dev, struct clk *clk)
>  	WARN_ON(ret);
>  }
>  EXPORT_SYMBOL(devm_clk_put);
> +
> +struct clk *devm_of_clk_get(struct device *dev,
> +			    struct device_node *np, int index)
> +{
> +	struct clk **ptr, *clk;
> +
> +	ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL);
> +	if (!ptr)
> +		return ERR_PTR(-ENOMEM);
> +
> +	clk = of_clk_get(np, index);
> +	if (!IS_ERR(clk)) {
> +		*ptr = clk;
> +		devres_add(dev, ptr);
> +	} else {
> +		devres_free(ptr);
> +	}
> +
> +	return clk;
> +}
> +EXPORT_SYMBOL(devm_of_clk_get);
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 123c027..1b713db 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -506,6 +506,8 @@ static inline void clk_disable_unprepare(struct clk *clk)
>  
>  #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK)
>  struct clk *of_clk_get(struct device_node *np, int index);
> +struct clk *devm_of_clk_get(struct device *dev,
> +			    struct device_node *np, int index);

No need for this to be within the ifdef.

>  struct clk *of_clk_get_by_name(struct device_node *np, const char *name);
>  struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec);
>  #else
> @@ -513,6 +515,11 @@ static inline struct clk *of_clk_get(struct device_node *np, int index)
>  {
>  	return ERR_PTR(-ENOENT);
>  }
> +static inline struct clk *devm_of_clk_get(struct device *dev,
> +			    struct device_node *np, int index)
> +{
> +	return ERR_PTR(-ENOENT);
> +}

and so no need for this either.  In any case, this will cause !OF ||
!COMMON_CLK builds to fail because this definition will conflict with
that in clk-devres.c

>  static inline struct clk *of_clk_get_by_name(struct device_node *np,
>  					     const char *name)
>  {
> -- 
> 1.9.1
> 

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ