Skip to contentSkip to conversation

dma/ipu: Interrupt cleanups

PATCH In review Thomas Gleixner 2 participants 4 messages Jul 13, 2015 – Jul 16, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover dma/ipu: Interrupt cleanups

The following patches consolidate the setup/removal of chained interrupt handlers and avoid redundant lookups of the irqdescriptor in functions which have already a [in]direct reference to it.

The latter is also a preparation for the removal of the 'irq' argument from interrupt flow handlers.

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/dma

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/2 dma/ipu: Consolidate chained IRQ handler install/remove

Chained irq handlers usually set up handler data as well. We now have a function to set both under irq_desc->lock. Replace the two calls with one.

Search and conversion was done with coccinelle.

---
 drivers/dma/ipu/ipu_irq.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/dma/ipu/ipu_irq.c +4 -8
Index: tip/drivers/dma/ipu/ipu_irq.c
===================================================================
@@ -382,11 +382,9 @@ int __init ipu_irq_attach_irq(struct ipu
 #endif
 	}
 
-	irq_set_handler_data(ipu->irq_fn, ipu);
-	irq_set_chained_handler(ipu->irq_fn, ipu_irq_fn);
+	irq_set_chained_handler_and_data(ipu->irq_fn, ipu_irq_fn, ipu);
 
-	irq_set_handler_data(ipu->irq_err, ipu);
-	irq_set_chained_handler(ipu->irq_err, ipu_irq_err);
+	irq_set_chained_handler_and_data(ipu->irq_err, ipu_irq_err, ipu);
 
 	ipu->irq_base = irq_base;
 
@@ -399,11 +397,9 @@ void ipu_irq_detach_irq(struct ipu *ipu,
 
 	irq_base = ipu->irq_base;
 
-	irq_set_chained_handler(ipu->irq_fn, NULL);
-	irq_set_handler_data(ipu->irq_fn, NULL);
+	irq_set_chained_handler_and_data(ipu->irq_fn, NULL, NULL);
 
-	irq_set_chained_handler(ipu->irq_err, NULL);
-	irq_set_handler_data(ipu->irq_err, NULL);
+	irq_set_chained_handler_and_data(ipu->irq_err, NULL, NULL);
 
 	for (irq = irq_base; irq < irq_base + CONFIG_MX3_IPU_IRQS; irq++) {
 #ifdef CONFIG_ARM
#2 lore raw

PATCH 2/2 dma/ipu: 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.

This is also a preparation for the removal of the 'irq' argument from interrupt flow handlers.

---
 drivers/dma/ipu/ipu_irq.c       |    2 +-
 drivers/gpu/ipu-v3/ipu-common.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/dma/ipu/ipu_irq.c +1 -1
Index: tip/drivers/dma/ipu/ipu_irq.c
===================================================================
@@ -268,7 +268,7 @@ int ipu_irq_unmap(unsigned int source)
 /* Chained IRQ handler for IPU error interrupt */
 static void ipu_irq_err(unsigned int irq, struct irq_desc *desc)
 {
-	struct ipu *ipu = irq_get_handler_data(irq);
+	struct ipu *ipu = irq_desc_get_handler_data(desc);
 	u32 status;
 	int i, line;
 
drivers/gpu/ipu-v3/ipu-common.c +2 -2
Index: tip/drivers/gpu/ipu-v3/ipu-common.c
===================================================================
@@ -915,8 +915,8 @@ static void ipu_irq_handle(struct ipu_so
 static void ipu_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
 	struct ipu_soc *ipu = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
 	const int int_reg[] = { 0, 1, 2, 3, 10, 11, 12, 13, 14};
-	struct irq_chip *chip = irq_get_chip(irq);
 
 	chained_irq_enter(chip, desc);
 
@@ -928,8 +928,8 @@ static void ipu_irq_handler(unsigned int
 static void ipu_err_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
 	struct ipu_soc *ipu = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
 	const int int_reg[] = { 4, 5, 8, 9};
-	struct irq_chip *chip = irq_get_chip(irq);
 
 	chained_irq_enter(chip, desc);
 
#3 lore raw
In reply to Thomas Gleixner
Quoted 7 lines · Thomas Gleixner

The following patches consolidate the setup/removal of chained interrupt handlers and avoid redundant lookups of the irqdescriptor in functions which have already a [in]direct reference to it.

The latter is also a preparation for the removal of the 'irq' argument from interrupt flow handlers.

Quoted 7 lines

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/dma

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

Applied now, though have fixed up the subsystem name

Signature · 1 line
~Vinod