Skip to contentSkip to conversation

sh: Interrupt cleanups and API change preparation

PATCH New Thomas Gleixner 2 participants 16 messages Jul 13, 2015 – Jul 29, 2015 SuperH

lore
Share & tools
lore
#0 lore raw

cover sh: Interrupt cleanups and API change preparation

The following patch series contains the following changes:

- Consolidation of chained interrupt handler setup/removal

- Switch to functions which avoid a redundant interrupt descriptor lookup

- Preparation of interrupt flow handlers for the 'irq' argument removal

The series has no dependencies and is also available as a git branch for your convenience:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/sh

If you want me to carry the patches in the irq/core branch of tip, please let me know.

Thanks,

tglx

#1 lore raw

PATCH 1/5 sh/irq: Use accessor irq_data_get_node()

From: Jiang Liu <[email protected]>

Use accessor irq_data_get_node() to hide struct irq_data implementation detail, so we can move irq_data->node to irq_data_common once all usage sites are fixed.

---
 arch/sh/kernel/irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/irq.c +1 -1
Index: tip/arch/sh/kernel/irq.c
===================================================================
@@ -227,7 +227,7 @@ void migrate_irqs(void)
 	for_each_active_irq(irq) {
 		struct irq_data *data = irq_get_irq_data(irq);
 
-		if (data->node == cpu) {
+		if (irq_data_get_node(data) == cpu) {
 			unsigned int newcpu = cpumask_any_and(data->affinity,
 							      cpu_online_mask);
 			if (newcpu >= nr_cpu_ids) {
#2 lore raw

[tip:irq/core] sh/irq: Use accessor irq_data_get_node()

sh/irq: Use accessor irq_data_get_node()
Commit-ID:  66ba22c24fa9ed7c2a25eed743135a11c8e343f4
Gitweb:     http://git.kernel.org/tip/66ba22c24fa9ed7c2a25eed743135a11c8e343f4
Author:     Jiang Liu <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:20 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 27 Jul 2015 13:36:38 +0200

sh/irq: Use accessor irq_data_get_node()

Use accessor irq_data_get_node() to hide struct irq_data implementation detail, so we can move irq_data->node to irq_data_common once all usage sites are fixed.

---
 arch/sh/kernel/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/irq.c +1 -1
index eb10ff8..8dc677c 100644
@@ -227,7 +227,7 @@ void migrate_irqs(void)
 	for_each_active_irq(irq) {
 		struct irq_data *data = irq_get_irq_data(irq);
 
-		if (data->node == cpu) {
+		if (irq_data_get_node(data) == cpu) {
 			unsigned int newcpu = cpumask_any_and(data->affinity,
 							      cpu_online_mask);
 			if (newcpu >= nr_cpu_ids) {
#3 lore raw

[tip:irq/core] sh/irq: Use accessor irq_data_get_node()

In reply to Thomas Gleixner
sh/irq: Use accessor irq_data_get_node()
Commit-ID:  cde5c2756832089e35b0c50417cc2858630f2005
Gitweb:     http://git.kernel.org/tip/cde5c2756832089e35b0c50417cc2858630f2005
Author:     Jiang Liu <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:20 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 29 Jul 2015 10:08:06 +0200

sh/irq: Use accessor irq_data_get_node()

Use accessor irq_data_get_node() to hide struct irq_data implementation detail, so we can move irq_data->node to irq_data_common once all usage sites are fixed.

---
 arch/sh/kernel/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/irq.c +1 -1
index eb10ff8..8dc677c 100644
@@ -227,7 +227,7 @@ void migrate_irqs(void)
 	for_each_active_irq(irq) {
 		struct irq_data *data = irq_get_irq_data(irq);
 
-		if (data->node == cpu) {
+		if (irq_data_get_node(data) == cpu) {
 			unsigned int newcpu = cpumask_any_and(data->affinity,
 							      cpu_online_mask);
 			if (newcpu >= nr_cpu_ids) {
#4 lore raw

PATCH 2/5 sh/irq: Use irq accessor functions instead of open coded access

In reply to Thomas Gleixner

From: Jiang Liu <[email protected]>

This is a preparatory patch for refactoring the internals if irq_data.

---
 drivers/sh/intc/virq.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/sh/intc/virq.c +7 -5
Index: tip/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
 
 	entry->irq = virq;
 
-	*last = entry;
+	if (last)
+		*last = entry;
+	else
+		irq_set_handler_data(irq, entry);
 
 	return 0;
 }
#5 lore raw

[tip:irq/core] sh/irq: Use irq accessor functions instead of open coded access

sh/irq: Use irq accessor functions instead of open coded access
Commit-ID:  d1357bc730a5873aa6593883fe7eb4b94abb082e
Gitweb:     http://git.kernel.org/tip/d1357bc730a5873aa6593883fe7eb4b94abb082e
Author:     Jiang Liu <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:22 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 27 Jul 2015 13:36:38 +0200

sh/irq: Use irq accessor functions instead of open coded access

This is a preparatory patch for refactoring the internals if irq_data.

---
 drivers/sh/intc/virq.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/sh/intc/virq.c +7 -5
index f5f1b82..0f73530 100644
@@ -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;
 }
#6 lore raw

[tip:irq/core] sh/irq: Use irq accessor functions instead of open coded access

In reply to Thomas Gleixner
sh/irq: Use irq accessor functions instead of open coded access
Commit-ID:  d0abe2f3a9a541ded2e30ef7275f057fb7f0335a
Gitweb:     http://git.kernel.org/tip/d0abe2f3a9a541ded2e30ef7275f057fb7f0335a
Author:     Jiang Liu <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:22 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 29 Jul 2015 10:08:07 +0200

sh/irq: Use irq accessor functions instead of open coded access

This is a preparatory patch for refactoring the internals if irq_data.

---
 drivers/sh/intc/virq.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/sh/intc/virq.c +7 -5
index f5f1b82..0f73530 100644
@@ -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;
 }
#7 lore raw

PATCH 3/5 sh/irq: Use access helper irq_data_get_affinity_mask()

In reply to Thomas Gleixner

This is a preparatory patch for moving irq_data struct members.

---
 arch/sh/kernel/irq.c   |    7 ++++---
 drivers/sh/intc/chip.c |    6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/sh/kernel/irq.c +4 -3
Index: tip/arch/sh/kernel/irq.c
===================================================================
@@ -228,15 +228,16 @@ void migrate_irqs(void)
 		struct irq_data *data = irq_get_irq_data(irq);
 
 		if (irq_data_get_node(data) == cpu) {
-			unsigned int newcpu = cpumask_any_and(data->affinity,
+			struct cpumask *mask = irq_data_get_affinity_mask(data);
+			unsigned int newcpu = cpumask_any_and(mask,
 							      cpu_online_mask);
 			if (newcpu >= nr_cpu_ids) {
 				pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n",
 						    irq, cpu);
 
-				cpumask_setall(data->affinity);
+				cpumask_setall(mask);
 			}
-			irq_set_affinity(irq, data->affinity);
+			irq_set_affinity(irq, mask);
 		}
 	}
 }
drivers/sh/intc/chip.c +3 -3
Index: tip/drivers/sh/intc/chip.c
===================================================================
@@ -22,7 +22,7 @@ void _intc_enable(struct irq_data *data,
 
 	for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
 #ifdef CONFIG_SMP
-		if (!cpumask_test_cpu(cpu, data->affinity))
+		if (!cpumask_test_cpu(cpu, irq_data_get_affinity_mask(data)))
 			continue;
 #endif
 		addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
@@ -50,7 +50,7 @@ static void intc_disable(struct irq_data
 
 	for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
 #ifdef CONFIG_SMP
-		if (!cpumask_test_cpu(cpu, data->affinity))
+		if (!cpumask_test_cpu(cpu, irq_data_get_affinity_mask(data)))
 			continue;
 #endif
 		addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
@@ -72,7 +72,7 @@ static int intc_set_affinity(struct irq_
 	if (!cpumask_intersects(cpumask, cpu_online_mask))
 		return -1;
 
-	cpumask_copy(data->affinity, cpumask);
+	cpumask_copy(irq_data_get_affinity_mask(data), cpumask);
 
 	return IRQ_SET_MASK_OK_NOCOPY;
 }
#8 lore raw

[tip:irq/core] sh/irq: Use access helper irq_data_get_affinity_mask()

sh/irq: Use access helper irq_data_get_affinity_mask()
Commit-ID:  0aadc2dff998861b4b2f36692d37a7ee36da5657
Gitweb:     http://git.kernel.org/tip/0aadc2dff998861b4b2f36692d37a7ee36da5657
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:23 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 27 Jul 2015 13:36:39 +0200

sh/irq: Use access helper irq_data_get_affinity_mask()

This is a preparatory patch for moving irq_data struct members.

---
 arch/sh/kernel/irq.c   | 7 ++++---
 drivers/sh/intc/chip.c | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/sh/kernel/irq.c +4 -3
index 8dc677c..6c0378c 100644
@@ -228,15 +228,16 @@ void migrate_irqs(void)
 		struct irq_data *data = irq_get_irq_data(irq);
 
 		if (irq_data_get_node(data) == cpu) {
-			unsigned int newcpu = cpumask_any_and(data->affinity,
+			struct cpumask *mask = irq_data_get_affinity_mask(data);
+			unsigned int newcpu = cpumask_any_and(mask,
 							      cpu_online_mask);
 			if (newcpu >= nr_cpu_ids) {
 				pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n",
 						    irq, cpu);
 
-				cpumask_setall(data->affinity);
+				cpumask_setall(mask);
 			}
-			irq_set_affinity(irq, data->affinity);
+			irq_set_affinity(irq, mask);
 		}
 	}
 }
drivers/sh/intc/chip.c +3 -3
index 46427b4..358df75 100644
@@ -22,7 +22,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle)
 
 	for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
 #ifdef CONFIG_SMP
-		if (!cpumask_test_cpu(cpu, data->affinity))
+		if (!cpumask_test_cpu(cpu, irq_data_get_affinity_mask(data)))
 			continue;
 #endif
 		addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
@@ -50,7 +50,7 @@ static void intc_disable(struct irq_data *data)
 
 	for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
 #ifdef CONFIG_SMP
-		if (!cpumask_test_cpu(cpu, data->affinity))
+		if (!cpumask_test_cpu(cpu, irq_data_get_affinity_mask(data)))
 			continue;
 #endif
 		addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
@@ -72,7 +72,7 @@ static int intc_set_affinity(struct irq_data *data,
 	if (!cpumask_intersects(cpumask, cpu_online_mask))
 		return -1;
 
-	cpumask_copy(data->affinity, cpumask);
+	cpumask_copy(irq_data_get_affinity_mask(data), cpumask);
 
 	return IRQ_SET_MASK_OK_NOCOPY;
 }
#9 lore raw

[tip:irq/core] sh/irq: Use access helper irq_data_get_affinity_mask()

In reply to Thomas Gleixner
sh/irq: Use access helper irq_data_get_affinity_mask()
Commit-ID:  8b8149df9ce99e02cb2b4655bf20d0ce459b9076
Gitweb:     http://git.kernel.org/tip/8b8149df9ce99e02cb2b4655bf20d0ce459b9076
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:23 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 29 Jul 2015 10:08:08 +0200

sh/irq: Use access helper irq_data_get_affinity_mask()

This is a preparatory patch for moving irq_data struct members.

---
 arch/sh/kernel/irq.c   | 7 ++++---
 drivers/sh/intc/chip.c | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/sh/kernel/irq.c +4 -3
index 8dc677c..6c0378c 100644
@@ -228,15 +228,16 @@ void migrate_irqs(void)
 		struct irq_data *data = irq_get_irq_data(irq);
 
 		if (irq_data_get_node(data) == cpu) {
-			unsigned int newcpu = cpumask_any_and(data->affinity,
+			struct cpumask *mask = irq_data_get_affinity_mask(data);
+			unsigned int newcpu = cpumask_any_and(mask,
 							      cpu_online_mask);
 			if (newcpu >= nr_cpu_ids) {
 				pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n",
 						    irq, cpu);
 
-				cpumask_setall(data->affinity);
+				cpumask_setall(mask);
 			}
-			irq_set_affinity(irq, data->affinity);
+			irq_set_affinity(irq, mask);
 		}
 	}
 }
drivers/sh/intc/chip.c +3 -3
index 46427b4..358df75 100644
@@ -22,7 +22,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle)
 
 	for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_E(handle)); cpu++) {
 #ifdef CONFIG_SMP
-		if (!cpumask_test_cpu(cpu, data->affinity))
+		if (!cpumask_test_cpu(cpu, irq_data_get_affinity_mask(data)))
 			continue;
 #endif
 		addr = INTC_REG(d, _INTC_ADDR_E(handle), cpu);
@@ -50,7 +50,7 @@ static void intc_disable(struct irq_data *data)
 
 	for (cpu = 0; cpu < SMP_NR(d, _INTC_ADDR_D(handle)); cpu++) {
 #ifdef CONFIG_SMP
-		if (!cpumask_test_cpu(cpu, data->affinity))
+		if (!cpumask_test_cpu(cpu, irq_data_get_affinity_mask(data)))
 			continue;
 #endif
 		addr = INTC_REG(d, _INTC_ADDR_D(handle), cpu);
@@ -72,7 +72,7 @@ static int intc_set_affinity(struct irq_data *data,
 	if (!cpumask_intersects(cpumask, cpu_online_mask))
 		return -1;
 
-	cpumask_copy(data->affinity, cpumask);
+	cpumask_copy(irq_data_get_affinity_mask(data), cpumask);
 
 	return IRQ_SET_MASK_OK_NOCOPY;
 }
#10 lore raw

PATCH 4/5 sh/intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc

In reply to Thomas Gleixner

From: Jiang Liu <[email protected]>

Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we already have a pointer to corresponding irq_desc.

Also replace generic_handle_irq with generic_handle_irq_desc() to avoid looking up irq_desc again.

---
 arch/sh/boards/mach-se/7343/irq.c  |    2 +-
 arch/sh/boards/mach-se/7722/irq.c  |    2 +-
 arch/sh/boards/mach-x3proto/gpio.c |    2 +-
 drivers/sh/intc/core.c             |    2 +-
 drivers/sh/intc/virq.c             |   14 ++++++++------
 5 files changed, 12 insertions(+), 10 deletions(-)
arch/sh/boards/mach-se/7343/irq.c +1 -1
Index: tip/arch/sh/boards/mach-se/7343/irq.c
===================================================================
@@ -31,7 +31,7 @@ struct irq_domain *se7343_irq_domain;
 
 static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int bit;
arch/sh/boards/mach-se/7722/irq.c +1 -1
Index: tip/arch/sh/boards/mach-se/7722/irq.c
===================================================================
@@ -30,7 +30,7 @@ struct irq_domain *se7722_irq_domain;
 
 static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int bit;
arch/sh/boards/mach-x3proto/gpio.c +1 -1
Index: tip/arch/sh/boards/mach-x3proto/gpio.c
===================================================================
@@ -62,7 +62,7 @@ static int x3proto_gpio_to_irq(struct gp
 
 static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int pin;
drivers/sh/intc/core.c +1 -1
Index: tip/drivers/sh/intc/core.c
===================================================================
@@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int ir
 
 static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
 {
-	generic_handle_irq((unsigned int)irq_get_handler_data(irq));
+	generic_handle_irq((unsigned int)irq_desc_get_handler_data(desc));
 }
 
 static void __init intc_register_irq(struct intc_desc *desc,
drivers/sh/intc/virq.c +8 -6
Index: tip/drivers/sh/intc/virq.c
===================================================================
@@ -111,7 +111,7 @@ static int add_virq_to_pirq(unsigned int
 
 static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
 	struct intc_desc_int *d = get_intc_desc(irq);
@@ -120,12 +120,14 @@ static void intc_virq_handler(unsigned i
 
 	for_each_virq(entry, vlist) {
 		unsigned long addr, handle;
+		struct irq_desc *vdesc = irq_to_desc(entry->irq);
 
-		handle = (unsigned long)irq_get_handler_data(entry->irq);
-		addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
-
-		if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
-			generic_handle_irq(entry->irq);
+		if (vdesc) {
+			handle = (unsigned long)irq_desc_get_handler_data(vdesc);
+			addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
+			if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
+				generic_handle_irq_desc(entry->irq, vdesc);
+		}
 	}
 
 	chip->irq_unmask(data);
#11 lore raw

[tip:irq/core] sh/intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc

sh/intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc
Commit-ID:  5564b1e09838f884511522430f11fce7d667a1c5
Gitweb:     http://git.kernel.org/tip/5564b1e09838f884511522430f11fce7d667a1c5
Author:     Jiang Liu <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:25 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 27 Jul 2015 13:36:39 +0200

sh/intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc

Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we already have a pointer to corresponding irq_desc.

Also replace generic_handle_irq with generic_handle_irq_desc() to avoid looking up irq_desc again.

---
 arch/sh/boards/mach-se/7343/irq.c  |  2 +-
 arch/sh/boards/mach-se/7722/irq.c  |  2 +-
 arch/sh/boards/mach-x3proto/gpio.c |  2 +-
 drivers/sh/intc/core.c             |  2 +-
 drivers/sh/intc/virq.c             | 14 ++++++++------
 5 files changed, 12 insertions(+), 10 deletions(-)
arch/sh/boards/mach-se/7343/irq.c +1 -1
index 1087dba..6f97a8f 100644
@@ -31,7 +31,7 @@ struct irq_domain *se7343_irq_domain;
 
 static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int bit;
arch/sh/boards/mach-se/7722/irq.c +1 -1
index 00e6992..60aebd1 100644
@@ -30,7 +30,7 @@ struct irq_domain *se7722_irq_domain;
 
 static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int bit;
arch/sh/boards/mach-x3proto/gpio.c +1 -1
index f035a7a..24555c3 100644
@@ -62,7 +62,7 @@ static int x3proto_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
 
 static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int pin;
drivers/sh/intc/core.c +1 -1
index 156b790..043419d 100644
@@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
 
 static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
 {
-	generic_handle_irq((unsigned int)irq_get_handler_data(irq));
+	generic_handle_irq((unsigned int)irq_desc_get_handler_data(desc));
 }
 
 static void __init intc_register_irq(struct intc_desc *desc,
drivers/sh/intc/virq.c +8 -6
index 0f73530..503d95a 100644
@@ -111,7 +111,7 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 
 static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
 	struct intc_desc_int *d = get_intc_desc(irq);
@@ -120,12 +120,14 @@ static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 
 	for_each_virq(entry, vlist) {
 		unsigned long addr, handle;
+		struct irq_desc *vdesc = irq_to_desc(entry->irq);
 
-		handle = (unsigned long)irq_get_handler_data(entry->irq);
-		addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
-
-		if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
-			generic_handle_irq(entry->irq);
+		if (vdesc) {
+			handle = (unsigned long)irq_desc_get_handler_data(vdesc);
+			addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
+			if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
+				generic_handle_irq_desc(entry->irq, vdesc);
+		}
 	}
 
 	chip->irq_unmask(data);
#12 lore raw

[tip:irq/core] sh/intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc

In reply to Thomas Gleixner
sh/intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc
Commit-ID:  8228a048961a93e871779c658eaa801f747e6c1d
Gitweb:     http://git.kernel.org/tip/8228a048961a93e871779c658eaa801f747e6c1d
Author:     Jiang Liu <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:25 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 29 Jul 2015 10:08:08 +0200

sh/intc: Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc

Use irq_desc_get_xxx() to avoid redundant lookup of irq_desc while we already have a pointer to corresponding irq_desc.

Also replace generic_handle_irq with generic_handle_irq_desc() to avoid looking up irq_desc again.

---
 arch/sh/boards/mach-se/7343/irq.c  |  2 +-
 arch/sh/boards/mach-se/7722/irq.c  |  2 +-
 arch/sh/boards/mach-x3proto/gpio.c |  2 +-
 drivers/sh/intc/core.c             |  2 +-
 drivers/sh/intc/virq.c             | 14 ++++++++------
 5 files changed, 12 insertions(+), 10 deletions(-)
arch/sh/boards/mach-se/7343/irq.c +1 -1
index 1087dba..6f97a8f 100644
@@ -31,7 +31,7 @@ struct irq_domain *se7343_irq_domain;
 
 static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int bit;
arch/sh/boards/mach-se/7722/irq.c +1 -1
index 00e6992..60aebd1 100644
@@ -30,7 +30,7 @@ struct irq_domain *se7722_irq_domain;
 
 static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int bit;
arch/sh/boards/mach-x3proto/gpio.c +1 -1
index f035a7a..24555c3 100644
@@ -62,7 +62,7 @@ static int x3proto_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
 
 static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	unsigned long mask;
 	int pin;
drivers/sh/intc/core.c +1 -1
index 156b790..043419d 100644
@@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
 
 static void intc_redirect_irq(unsigned int irq, struct irq_desc *desc)
 {
-	generic_handle_irq((unsigned int)irq_get_handler_data(irq));
+	generic_handle_irq((unsigned int)irq_desc_get_handler_data(desc));
 }
 
 static void __init intc_register_irq(struct intc_desc *desc,
drivers/sh/intc/virq.c +8 -6
index 0f73530..503d95a 100644
@@ -111,7 +111,7 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 
 static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct irq_data *data = irq_get_irq_data(irq);
+	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
 	struct intc_desc_int *d = get_intc_desc(irq);
@@ -120,12 +120,14 @@ static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
 
 	for_each_virq(entry, vlist) {
 		unsigned long addr, handle;
+		struct irq_desc *vdesc = irq_to_desc(entry->irq);
 
-		handle = (unsigned long)irq_get_handler_data(entry->irq);
-		addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
-
-		if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
-			generic_handle_irq(entry->irq);
+		if (vdesc) {
+			handle = (unsigned long)irq_desc_get_handler_data(vdesc);
+			addr = INTC_REG(d, _INTC_ADDR_E(handle), 0);
+			if (intc_reg_fns[_INTC_FN(handle)](addr, handle, 0))
+				generic_handle_irq_desc(entry->irq, vdesc);
+		}
 	}
 
 	chip->irq_unmask(data);
#13 lore raw

PATCH 5/5 sh/intc: Prepare irq flow handlers for irq argument removal

In reply to Thomas Gleixner

The irq argument of most interrupt flow handlers is unused or merily used instead of a local variable. The handlers which need the irq argument can retrieve the irq number from the irq descriptor.

Search and update was done with coccinelle and the invaluable help of Julia Lawall.

Cc Julia Lawall <[email protected]>
Cc Jiang Liu <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
---
 arch/sh/boards/mach-se/7724/irq.c |    3 ++-
 drivers/sh/intc/virq.c            |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/sh/boards/mach-se/7724/irq.c +2 -1
Index: tip/arch/sh/boards/mach-se/7724/irq.c
===================================================================
@@ -92,8 +92,9 @@ static struct irq_chip se7724_irq_chip _
 	.irq_unmask	= enable_se7724_irq,
 };
 
-static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
+static void se7724_irq_demux(unsigned int __irq, struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct fpga_irq set = get_fpga_irq(irq);
 	unsigned short intv = __raw_readw(set.sraddr);
 	unsigned int ext_irq = set.base;
drivers/sh/intc/virq.c +2 -1
Index: tip/drivers/sh/intc/virq.c
===================================================================
@@ -109,8 +109,9 @@ static int add_virq_to_pirq(unsigned int
 	return 0;
 }
 
-static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
+static void intc_virq_handler(unsigned int __irq, struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
#14 lore raw

[tip:irq/core] sh/intc: Prepare irq flow handlers for irq argument removal

sh/intc: Prepare irq flow handlers for irq argument removal
Commit-ID:  87d198c25e3cbfd357cabcd8787408054d515789
Gitweb:     http://git.kernel.org/tip/87d198c25e3cbfd357cabcd8787408054d515789
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:26 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 27 Jul 2015 13:36:39 +0200

sh/intc: Prepare irq flow handlers for irq argument removal

The irq argument of most interrupt flow handlers is unused or merily used instead of a local variable. The handlers which need the irq argument can retrieve the irq number from the irq descriptor.

Search and update was done with coccinelle and the invaluable help of Julia Lawall.

---
 arch/sh/boards/mach-se/7724/irq.c | 3 ++-
 drivers/sh/intc/virq.c            | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/sh/boards/mach-se/7724/irq.c +2 -1
index 5d1d3ec..9f20338 100644
@@ -92,8 +92,9 @@ static struct irq_chip se7724_irq_chip __read_mostly = {
 	.irq_unmask	= enable_se7724_irq,
 };
 
-static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
+static void se7724_irq_demux(unsigned int __irq, struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct fpga_irq set = get_fpga_irq(irq);
 	unsigned short intv = __raw_readw(set.sraddr);
 	unsigned int ext_irq = set.base;
drivers/sh/intc/virq.c +2 -1
index 503d95a..bafc51c 100644
@@ -109,8 +109,9 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 	return 0;
 }
 
-static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
+static void intc_virq_handler(unsigned int __irq, struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);
#15 lore raw

[tip:irq/core] sh/intc: Prepare irq flow handlers for irq argument removal

In reply to Thomas Gleixner
sh/intc: Prepare irq flow handlers for irq argument removal
Commit-ID:  c497615c0cb62ba0b06db9580911dcf6d612bdb9
Gitweb:     http://git.kernel.org/tip/c497615c0cb62ba0b06db9580911dcf6d612bdb9
Author:     Thomas Gleixner <[email protected]>
AuthorDate: Mon, 13 Jul 2015 20:51:26 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 29 Jul 2015 10:08:09 +0200

sh/intc: Prepare irq flow handlers for irq argument removal

The irq argument of most interrupt flow handlers is unused or merily used instead of a local variable. The handlers which need the irq argument can retrieve the irq number from the irq descriptor.

Search and update was done with coccinelle and the invaluable help of Julia Lawall.

---
 arch/sh/boards/mach-se/7724/irq.c | 3 ++-
 drivers/sh/intc/virq.c            | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/sh/boards/mach-se/7724/irq.c +2 -1
index 5d1d3ec..9f20338 100644
@@ -92,8 +92,9 @@ static struct irq_chip se7724_irq_chip __read_mostly = {
 	.irq_unmask	= enable_se7724_irq,
 };
 
-static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
+static void se7724_irq_demux(unsigned int __irq, struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct fpga_irq set = get_fpga_irq(irq);
 	unsigned short intv = __raw_readw(set.sraddr);
 	unsigned int ext_irq = set.base;
drivers/sh/intc/virq.c +2 -1
index 503d95a..bafc51c 100644
@@ -109,8 +109,9 @@ static int add_virq_to_pirq(unsigned int irq, unsigned int virq)
 	return 0;
 }
 
-static void intc_virq_handler(unsigned int irq, struct irq_desc *desc)
+static void intc_virq_handler(unsigned int __irq, struct irq_desc *desc)
 {
+	unsigned int irq = irq_desc_get_irq(desc);
 	struct irq_data *data = irq_desc_get_irq_data(desc);
 	struct irq_chip *chip = irq_data_get_irq_chip(data);
 	struct intc_virq_list *entry, *vlist = irq_data_get_irq_handler_data(data);