2008-10-05 19:21:28

by Haavard Skinnemoen

[permalink] [raw]
Subject: [PATCH] Change comment in include linux/clk.h

From: Alex Raimondi <[email protected]>

clk_get and clk_put may not be used from within interrupt
context. Change comment to this function.

Signed-off-by: Alex Raimondi <[email protected]>
Signed-off-by: Haavard Skinnemoen <[email protected]>
---
I see several ARM implementation using mutexes for locking in these
functions. So I assume we never want to call them from interrupt
context, right?

include/linux/clk.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/linux/clk.h b/include/linux/clk.h
index 5ca8c6f..7787773 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -35,6 +35,8 @@ struct clk;
* clk_get may return different clock producers depending on @dev.)
*
* Drivers must assume that the clock source is not enabled.
+ *
+ * clk_get should not be called from within interrupt context.
*/
struct clk *clk_get(struct device *dev, const char *id);

@@ -76,6 +78,8 @@ unsigned long clk_get_rate(struct clk *clk);
* Note: drivers must ensure that all clk_enable calls made on this
* clock source are balanced by clk_disable calls prior to calling
* this function.
+ *
+ * clk_put should not be called from within interrupt context.
*/
void clk_put(struct clk *clk);

--
1.5.6.5


2008-10-05 19:41:17

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] Change comment in include linux/clk.h

On Sun, Oct 05, 2008 at 09:20:38PM +0200, Haavard Skinnemoen wrote:
> From: Alex Raimondi <[email protected]>
>
> clk_get and clk_put may not be used from within interrupt
> context. Change comment to this function.
>
> Signed-off-by: Alex Raimondi <[email protected]>
> Signed-off-by: Haavard Skinnemoen <[email protected]>
> ---
> I see several ARM implementation using mutexes for locking in these
> functions. So I assume we never want to call them from interrupt
> context, right?

Correct. I'm not sure why anyone would even consider doing so.

Acked-by: Russell King <[email protected]>

>
> include/linux/clk.h | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 5ca8c6f..7787773 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -35,6 +35,8 @@ struct clk;
> * clk_get may return different clock producers depending on @dev.)
> *
> * Drivers must assume that the clock source is not enabled.
> + *
> + * clk_get should not be called from within interrupt context.
> */
> struct clk *clk_get(struct device *dev, const char *id);
>
> @@ -76,6 +78,8 @@ unsigned long clk_get_rate(struct clk *clk);
> * Note: drivers must ensure that all clk_enable calls made on this
> * clock source are balanced by clk_disable calls prior to calling
> * this function.
> + *
> + * clk_put should not be called from within interrupt context.
> */
> void clk_put(struct clk *clk);
>
> --
> 1.5.6.5
>

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:

2008-10-05 19:56:23

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: [PATCH] Change comment in include linux/clk.h

Russell King <[email protected]> wrote:
> > I see several ARM implementation using mutexes for locking in these
> > functions. So I assume we never want to call them from interrupt
> > context, right?
>
> Correct. I'm not sure why anyone would even consider doing so.

I can't think of any reason to do so either, but having the comment
there makes me feel safer about having calls that might sleep or
irq-unsafe spinlocks in the implementation.

Haavard