diff mbox

[v3,11/36] sh, irq: Use helper irq_data_get_irq_handler_data() to hide irq_desc details

Message ID 1433145945-789-12-git-send-email-jiang.liu@linux.intel.com (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Jiang Liu June 1, 2015, 8:05 a.m. UTC
Use helper function irq_data_get_irq_handler_data() to hide irq_desc
implementation details.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
 drivers/sh/intc/virq.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Sergei Shtylyov June 1, 2015, 11:38 a.m. UTC | #1
Hello.

On 6/1/2015 11:05 AM, Jiang Liu wrote:

> Use helper function irq_data_get_irq_handler_data() to hide irq_desc
> implementation details.

    I'm only seeing calls to irq_{get|set}_handler_data() below...

> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> ---
>   drivers/sh/intc/virq.c |   12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)

> diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
> index f30ac9354ff2..bc0601cf0f8f 100644
> --- a/drivers/sh/intc/virq.c
> +++ b/drivers/sh/intc/virq.c
> @@ -83,12 +83,11 @@ EXPORT_SYMBOL_GPL(intc_irq_lookup);
>
>   static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
>   {
> -	struct intc_virq_list **last, *entry;
> -	struct irq_data *data = irq_get_irq_data(irq);
> +	struct intc_virq_list *entry;
> +	struct intc_virq_list **last = NULL;
>
>   	/* scan for duplicates */
> -	last = (struct intc_virq_list **)&data->handler_data;
> -	for_each_virq(entry, data->handler_data) {
> +	for_each_virq(entry, irq_get_handler_data(irq)) {
>   		if (entry->irq == virq)
>   			return 0;
>   		last = &entry->next;
> @@ -102,7 +101,10 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
>
>   	entry->irq = virq;
>
> -	*last = entry;
> +	if (last)
> +		*last = entry;
> +	else
> +		irq_set_handler_data(irq, entry);
>
>   	return 0;
>   }

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiang Liu June 1, 2015, 1:53 p.m. UTC | #2
On 2015/6/1 19:38, Sergei Shtylyov wrote:
> Hello.
> 
> On 6/1/2015 11:05 AM, Jiang Liu wrote:
> 
>> Use helper function irq_data_get_irq_handler_data() to hide irq_desc
>> implementation details.
> 
>    I'm only seeing calls to irq_{get|set}_handler_data() below...
Hi Sergei,
	Thanks for review, I will fix the commit message.
Thanks!
Gerry

> 
>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>> ---
>>   drivers/sh/intc/virq.c |   12 +++++++-----
>>   1 file changed, 7 insertions(+), 5 deletions(-)
> 
>> diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
>> index f30ac9354ff2..bc0601cf0f8f 100644
>> --- a/drivers/sh/intc/virq.c
>> +++ b/drivers/sh/intc/virq.c
>> @@ -83,12 +83,11 @@ EXPORT_SYMBOL_GPL(intc_irq_lookup);
>>
>>   static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
>>   {
>> -    struct intc_virq_list **last, *entry;
>> -    struct irq_data *data = irq_get_irq_data(irq);
>> +    struct intc_virq_list *entry;
>> +    struct intc_virq_list **last = NULL;
>>
>>       /* scan for duplicates */
>> -    last = (struct intc_virq_list **)&data->handler_data;
>> -    for_each_virq(entry, data->handler_data) {
>> +    for_each_virq(entry, irq_get_handler_data(irq)) {
>>           if (entry->irq == virq)
>>               return 0;
>>           last = &entry->next;
>> @@ -102,7 +101,10 @@ static int add_virq_to_pirq(unsigned int irq,
>> unsigned int virq)
>>
>>       entry->irq = virq;
>>
>> -    *last = entry;
>> +    if (last)
>> +        *last = entry;
>> +    else
>> +        irq_set_handler_data(irq, entry);
>>
>>       return 0;
>>   }
> 
> WBR, Sergei
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/sh/intc/virq.c b/drivers/sh/intc/virq.c
index f30ac9354ff2..bc0601cf0f8f 100644
--- a/drivers/sh/intc/virq.c
+++ b/drivers/sh/intc/virq.c
@@ -83,12 +83,11 @@  EXPORT_SYMBOL_GPL(intc_irq_lookup);
 
 static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 {
-	struct intc_virq_list **last, *entry;
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct intc_virq_list *entry;
+	struct intc_virq_list **last = NULL;
 
 	/* scan for duplicates */
-	last = (struct intc_virq_list **)&data->handler_data;
-	for_each_virq(entry, data->handler_data) {
+	for_each_virq(entry, irq_get_handler_data(irq)) {
 		if (entry->irq == virq)
 			return 0;
 		last = &entry->next;
@@ -102,7 +101,10 @@  static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 
 	entry->irq = virq;
 
-	*last = entry;
+	if (last)
+		*last = entry;
+	else
+		irq_set_handler_data(irq, entry);
 
 	return 0;
 }