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: <53BDA21D.3070504@gmail.com>
Date:	Wed, 09 Jul 2014 22:12:13 +0200
From:	Tomasz Figa <tomasz.figa@...il.com>
To:	Tomeu Vizoso <tomeu.vizoso@...labora.com>,
	Stephen Warren <swarren@...dotorg.org>,
	Thierry Reding <thierry.reding@...il.com>,
	Mike Turquette <mturquette@...aro.org>, rabin@....in,
	linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
CC:	Rabin Vincent <rabin.vincent@...ricsson.com>,
	Javier Martinez Canillas <javier.martinez@...labora.co.uk>
Subject: Re: [RFC v2 3/5] clk: use struct clk only for external API

Actually few more comments, see inline.

On 03.07.2014 16:38, Tomeu Vizoso wrote:
> From: Rabin Vincent <rabin.vincent@...ricsson.com>
> 
> In order to provide per-user accounting, this separates the struct clk
> used in the common clock framework into two structures 'struct clk_core'
> and 'struct clk'.  struct clk_core will be used for internal
> manipulation and struct clk will be used in the clock API
> implementation.

[snip]

> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
> index 8f57154..5f2aba9 100644
> --- a/drivers/clk/clk-devres.c
> +++ b/drivers/clk/clk-devres.c
> @@ -5,6 +5,7 @@
>   */
>  
>  #include <linux/clk.h>
> +#include <linux/clk-provider.h>
>  #include <linux/device.h>
>  #include <linux/export.h>
>  #include <linux/gfp.h>
> @@ -14,15 +15,15 @@ static void devm_clk_release(struct device *dev, void *res)
>  	clk_put(*(struct clk **)res);

This function still expects to get a (struct clk *) here, but...

>  }
>  
> -struct clk *devm_clk_get(struct device *dev, const char *id)
> +struct clk_core *devm_clk_provider_get(struct device *dev, const char *id)
>  {
> -	struct clk **ptr, *clk;
> +	struct clk_core **ptr, *clk;
>  
>  	ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL);
>  	if (!ptr)
>  		return ERR_PTR(-ENOMEM);
>  
> -	clk = clk_get(dev, id);
> +	clk = clk_provider_get(dev, id);
>  	if (!IS_ERR(clk)) {
>  		*ptr = clk;

...here a (struct clk_core *) is stored.

>  		devres_add(dev, ptr);

[snip]

> diff --git a/drivers/clk/clk.h b/drivers/clk/clk.h
> index d278572..c69f4fe 100644
> --- a/drivers/clk/clk.h
> +++ b/drivers/clk/clk.h
> @@ -15,3 +15,7 @@ struct clk_core *__of_clk_get_from_provider(struct of_phandle_args *clkspec);
>  void of_clk_lock(void);
>  void of_clk_unlock(void);
>  #endif
> +
> +#if defined(CONFIG_COMMON_CLK)
> +#define clk_to_clk_core(clk)	(clk->core)

Making this a static inline will benefit you with type checking at
compilation time.

> +#endif

[snip]

> +
> +#define clk_core_to_clk(core)	((struct clk *)(core))

Hmm, I'm not following. clk_to_clk_core() returns clk->core, while
clk_core_to_clk() simply casts whatever the former returns into a
pointer to struct clk?

Also this should be a static inline to benefit from compiler type checking.

Best regards,
Tomasz
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ