diff mbox

[v2] at91: pmc: Fixed irq's name allocation for programmable clocks

Message ID 1391502105-24612-1-git-send-email-jjhiblot@traphandler.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jean-Jacques Hiblot Feb. 4, 2014, 8:21 a.m. UTC
The name provided to request_irq() must be valid until the irq is released.
This patch stores the name in the internal data structure.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 drivers/clk/at91/clk-programmable.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Boris BREZILLON Feb. 4, 2014, 8:29 a.m. UTC | #1
On 04/02/2014 09:21, Jean-Jacques Hiblot wrote:
> The name provided to request_irq() must be valid until the irq is released.
> This patch stores the name in the internal data structure.
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Acked-by: Boris BREZILLON <b.brezillon@overkiz.com>
> ---
>   drivers/clk/at91/clk-programmable.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
> index 8e242c7..799b75c 100644
> --- a/drivers/clk/at91/clk-programmable.c
> +++ b/drivers/clk/at91/clk-programmable.c
> @@ -44,6 +44,7 @@ struct clk_programmable {
>   	u8 css;
>   	u8 pres;
>   	u8 slckmck;
> +	char irq_name[11];
>   	const struct clk_programmable_layout *layout;
>   };
>   
> @@ -247,7 +248,6 @@ at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
>   	struct clk_programmable *prog;
>   	struct clk *clk = NULL;
>   	struct clk_init_data init;
> -	char irq_name[11];
>   
>   	if (id > PROG_ID_MAX)
>   		return ERR_PTR(-EINVAL);
> @@ -269,9 +269,9 @@ at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
>   	prog->irq = irq;
>   	init_waitqueue_head(&prog->wait);
>   	irq_set_status_flags(prog->irq, IRQ_NOAUTOEN);
> -	snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id);
> +	snprintf(prog->irq_name, sizeof(prog->irq_name), "clk-prog%d", id);
>   	ret = request_irq(prog->irq, clk_programmable_irq_handler,
> -			  IRQF_TRIGGER_HIGH, irq_name, prog);
> +			  IRQF_TRIGGER_HIGH, prog->irq_name, prog);
>   	if (ret)
>   		return ERR_PTR(ret);
>
Boris BREZILLON Feb. 4, 2014, 8:42 a.m. UTC | #2
Hello JJ,

Sorry for the noise (I added Mike in the CC list).

BTW, thanks for fixing this bug.

Mike, could you take this bug fix for the next 3.14 release ?

Best Regards,

Boris

On 04/02/2014 09:21, Jean-Jacques Hiblot wrote:
> The name provided to request_irq() must be valid until the irq is released.
> This patch stores the name in the internal data structure.
>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Acked-by: Boris BREZILLON <b.brezillon@overkiz.com>
> ---
>   drivers/clk/at91/clk-programmable.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
> index 8e242c7..799b75c 100644
> --- a/drivers/clk/at91/clk-programmable.c
> +++ b/drivers/clk/at91/clk-programmable.c
> @@ -44,6 +44,7 @@ struct clk_programmable {
>   	u8 css;
>   	u8 pres;
>   	u8 slckmck;
> +	char irq_name[11];
>   	const struct clk_programmable_layout *layout;
>   };
>   
> @@ -247,7 +248,6 @@ at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
>   	struct clk_programmable *prog;
>   	struct clk *clk = NULL;
>   	struct clk_init_data init;
> -	char irq_name[11];
>   
>   	if (id > PROG_ID_MAX)
>   		return ERR_PTR(-EINVAL);
> @@ -269,9 +269,9 @@ at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
>   	prog->irq = irq;
>   	init_waitqueue_head(&prog->wait);
>   	irq_set_status_flags(prog->irq, IRQ_NOAUTOEN);
> -	snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id);
> +	snprintf(prog->irq_name, sizeof(prog->irq_name), "clk-prog%d", id);
>   	ret = request_irq(prog->irq, clk_programmable_irq_handler,
> -			  IRQF_TRIGGER_HIGH, irq_name, prog);
> +			  IRQF_TRIGGER_HIGH, prog->irq_name, prog);
>   	if (ret)
>   		return ERR_PTR(ret);
>
Nicolas Ferre Feb. 4, 2014, 9:03 a.m. UTC | #3
On 04/02/2014 09:21, Jean-Jacques Hiblot :
> The name provided to request_irq() must be valid until the irq is released.
> This patch stores the name in the internal data structure.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks. Bye,

> ---
>  drivers/clk/at91/clk-programmable.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
> index 8e242c7..799b75c 100644
> --- a/drivers/clk/at91/clk-programmable.c
> +++ b/drivers/clk/at91/clk-programmable.c
> @@ -44,6 +44,7 @@ struct clk_programmable {
>  	u8 css;
>  	u8 pres;
>  	u8 slckmck;
> +	char irq_name[11];
>  	const struct clk_programmable_layout *layout;
>  };
>  
> @@ -247,7 +248,6 @@ at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
>  	struct clk_programmable *prog;
>  	struct clk *clk = NULL;
>  	struct clk_init_data init;
> -	char irq_name[11];
>  
>  	if (id > PROG_ID_MAX)
>  		return ERR_PTR(-EINVAL);
> @@ -269,9 +269,9 @@ at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
>  	prog->irq = irq;
>  	init_waitqueue_head(&prog->wait);
>  	irq_set_status_flags(prog->irq, IRQ_NOAUTOEN);
> -	snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id);
> +	snprintf(prog->irq_name, sizeof(prog->irq_name), "clk-prog%d", id);
>  	ret = request_irq(prog->irq, clk_programmable_irq_handler,
> -			  IRQF_TRIGGER_HIGH, irq_name, prog);
> +			  IRQF_TRIGGER_HIGH, prog->irq_name, prog);
>  	if (ret)
>  		return ERR_PTR(ret);
>  
>
Boris BREZILLON Feb. 4, 2014, 1:57 p.m. UTC | #4
Hello, Mike,

Please do not take this patch: the work of JJ to fix the prog clk 
prepare bug
will remove the irq handling from the prog clk driver, as a result, we won't
have to request the irq anymore.

Sorry for the inconvenience.

Best Regards,

Boris

On 04/02/2014 09:42, Boris BREZILLON wrote:
> Hello JJ,
>
> Sorry for the noise (I added Mike in the CC list).
>
> BTW, thanks for fixing this bug.
>
> Mike, could you take this bug fix for the next 3.14 release ?
>
> Best Regards,
>
> Boris
>
> On 04/02/2014 09:21, Jean-Jacques Hiblot wrote:
>> The name provided to request_irq() must be valid until the irq is 
>> released.
>> This patch stores the name in the internal data structure.
>>
>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> Acked-by: Boris BREZILLON <b.brezillon@overkiz.com>
>> ---
>>   drivers/clk/at91/clk-programmable.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/clk/at91/clk-programmable.c 
>> b/drivers/clk/at91/clk-programmable.c
>> index 8e242c7..799b75c 100644
>> --- a/drivers/clk/at91/clk-programmable.c
>> +++ b/drivers/clk/at91/clk-programmable.c
>> @@ -44,6 +44,7 @@ struct clk_programmable {
>>       u8 css;
>>       u8 pres;
>>       u8 slckmck;
>> +    char irq_name[11];
>>       const struct clk_programmable_layout *layout;
>>   };
>>   @@ -247,7 +248,6 @@ at91_clk_register_programmable(struct at91_pmc 
>> *pmc, unsigned int irq,
>>       struct clk_programmable *prog;
>>       struct clk *clk = NULL;
>>       struct clk_init_data init;
>> -    char irq_name[11];
>>         if (id > PROG_ID_MAX)
>>           return ERR_PTR(-EINVAL);
>> @@ -269,9 +269,9 @@ at91_clk_register_programmable(struct at91_pmc 
>> *pmc, unsigned int irq,
>>       prog->irq = irq;
>>       init_waitqueue_head(&prog->wait);
>>       irq_set_status_flags(prog->irq, IRQ_NOAUTOEN);
>> -    snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id);
>> +    snprintf(prog->irq_name, sizeof(prog->irq_name), "clk-prog%d", id);
>>       ret = request_irq(prog->irq, clk_programmable_irq_handler,
>> -              IRQF_TRIGGER_HIGH, irq_name, prog);
>> +              IRQF_TRIGGER_HIGH, prog->irq_name, prog);
>>       if (ret)
>>           return ERR_PTR(ret);
>
diff mbox

Patch

diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
index 8e242c7..799b75c 100644
--- a/drivers/clk/at91/clk-programmable.c
+++ b/drivers/clk/at91/clk-programmable.c
@@ -44,6 +44,7 @@  struct clk_programmable {
 	u8 css;
 	u8 pres;
 	u8 slckmck;
+	char irq_name[11];
 	const struct clk_programmable_layout *layout;
 };
 
@@ -247,7 +248,6 @@  at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
 	struct clk_programmable *prog;
 	struct clk *clk = NULL;
 	struct clk_init_data init;
-	char irq_name[11];
 
 	if (id > PROG_ID_MAX)
 		return ERR_PTR(-EINVAL);
@@ -269,9 +269,9 @@  at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq,
 	prog->irq = irq;
 	init_waitqueue_head(&prog->wait);
 	irq_set_status_flags(prog->irq, IRQ_NOAUTOEN);
-	snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id);
+	snprintf(prog->irq_name, sizeof(prog->irq_name), "clk-prog%d", id);
 	ret = request_irq(prog->irq, clk_programmable_irq_handler,
-			  IRQF_TRIGGER_HIGH, irq_name, prog);
+			  IRQF_TRIGGER_HIGH, prog->irq_name, prog);
 	if (ret)
 		return ERR_PTR(ret);