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: <20130315174558.GS4977@n2100.arm.linux.org.uk>
Date:	Fri, 15 Mar 2013 17:45:58 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Bill Huang <bilhuang@...dia.com>
Cc:	mturquette@...aro.org, patches@...aro.org,
	linux-kernel@...r.kernel.org, linaro-dev@...ts.linaro.org,
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [RFC v2 1/1] clk: Add notifier support in
	clk_prepare/clk_unprepare

On Thu, Mar 14, 2013 at 02:31:04AM -0700, Bill Huang wrote:
> Add the below two notifier events so drivers which are interested in
> knowing the clock status can act accordingly. This is extremely useful
> in some of the DVFS (Dynamic Voltage Frequency Scaling) design.
> 
> CLK_PREPARED
> CLK_UNPREPARED
> 
> Signed-off-by: Bill Huang <bilhuang@...dia.com>
> ---
>  drivers/clk/clk.c   |    3 +++
>  include/linux/clk.h |    2 ++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index ed87b24..3292cec 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -550,6 +550,7 @@ void clk_unprepare(struct clk *clk)
>  {
>  	mutex_lock(&prepare_lock);
>  	__clk_unprepare(clk);
> +	__clk_notify(clk, CLK_UNPREPARED, clk->rate, clk->rate);
>  	mutex_unlock(&prepare_lock);
>  }
>  EXPORT_SYMBOL_GPL(clk_unprepare);
> @@ -598,6 +599,8 @@ int clk_prepare(struct clk *clk)
>  
>  	mutex_lock(&prepare_lock);
>  	ret = __clk_prepare(clk);
> +	if (!ret)
> +		__clk_notify(clk, CLK_PREPARED, clk->rate, clk->rate);

So, on prepare, we notify after we've prepared the clock.  On unprepare,
we notify after the clock has been shut down.  Are you sure that's the
correct ordering?  Would it not be better to view it in a stack-like
fashion, iow:

get
	prepare
		notify-prepare
			enable
			disable
		notify-unprepare
	unprepare
put

?

> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index b3ac22d..16c1d92 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -43,6 +43,8 @@ struct clk;
>  #define PRE_RATE_CHANGE			BIT(0)
>  #define POST_RATE_CHANGE		BIT(1)
>  #define ABORT_RATE_CHANGE		BIT(2)
> +#define CLK_PREPARED			BIT(3)
> +#define CLK_UNPREPARED			BIT(4)

This implies that we're only going to have a maximum of 32 reason codes
here.  Is that enough?
--
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