[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-3528d82b684680b72fa31881c8c572c5a98b51de@git.kernel.org>
Date: Wed, 29 May 2013 02:21:05 -0700
From: tip-bot for Thomas Gleixner <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, moinejf@...e.fr, jgunthorpe@...idianresearch.com,
arnd@...db.de, thomas.petazzoni@...e-electrons.com,
linux@....linux.org.uk, ezequiel.garcia@...e-electrons.com,
tglx@...utronix.de, maxime.ripard@...e-electrons.com,
rob@...dley.net, linux-kernel@...r.kernel.org, hpa@...or.com,
jason@...edaemon.net, grant.likely@...aro.org,
gerlando.falauto@...mile.com, sebastian.hesselbarth@...il.com,
rob.herring@...xeda.com, gregory.clement@...e-electrons.com,
andrew@...n.ch
Subject: [tip:irq/core] genirq: Generic chip:
Split out code into separate functions
Commit-ID: 3528d82b684680b72fa31881c8c572c5a98b51de
Gitweb: http://git.kernel.org/tip/3528d82b684680b72fa31881c8c572c5a98b51de
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Mon, 6 May 2013 14:30:25 +0000
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Wed, 29 May 2013 10:57:11 +0200
genirq: Generic chip: Split out code into separate functions
Preparatory patch for linear interrupt domains.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Russell King - ARM Linux <linux@....linux.org.uk>
Cc: Jason Cooper <jason@...edaemon.net>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Jean-Francois Moine <moinejf@...e.fr>
Cc: devicetree-discuss@...ts.ozlabs.org
Cc: Rob Herring <rob.herring@...xeda.com>
Cc: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc: Gregory Clement <gregory.clement@...e-electrons.com>
Cc: Gerlando Falauto <gerlando.falauto@...mile.com>
Cc: Rob Landley <rob@...dley.net>
Acked-by: Grant Likely <grant.likely@...aro.org>
Cc: Maxime Ripard <maxime.ripard@...e-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>
Cc: linux-arm-kernel@...ts.infradead.org
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>
Link: http://lkml.kernel.org/r/20130506142539.377017672@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
kernel/irq/generic-chip.c | 50 ++++++++++++++++++++++++++++++++---------------
1 file changed, 34 insertions(+), 16 deletions(-)
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index 5068fe3..3deb333 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -186,6 +186,19 @@ int irq_gc_set_wake(struct irq_data *d, unsigned int on)
return 0;
}
+static void
+irq_init_generic_chip(struct irq_chip_generic *gc, const char *name,
+ int num_ct, unsigned int irq_base,
+ void __iomem *reg_base, irq_flow_handler_t handler)
+{
+ raw_spin_lock_init(&gc->lock);
+ gc->num_ct = num_ct;
+ gc->irq_base = irq_base;
+ gc->reg_base = reg_base;
+ gc->chip_types->chip.name = name;
+ gc->chip_types->handler = handler;
+}
+
/**
* irq_alloc_generic_chip - Allocate a generic chip and initialize it
* @name: Name of the irq chip
@@ -206,17 +219,31 @@ irq_alloc_generic_chip(const char *name, int num_ct, unsigned int irq_base,
gc = kzalloc(sz, GFP_KERNEL);
if (gc) {
- raw_spin_lock_init(&gc->lock);
- gc->num_ct = num_ct;
- gc->irq_base = irq_base;
- gc->reg_base = reg_base;
- gc->chip_types->chip.name = name;
- gc->chip_types->handler = handler;
+ irq_init_generic_chip(gc, name, num_ct, irq_base, reg_base,
+ handler);
}
return gc;
}
EXPORT_SYMBOL_GPL(irq_alloc_generic_chip);
+static void
+irq_gc_init_mask_cache(struct irq_chip_generic *gc, enum irq_gc_flags flags)
+{
+ struct irq_chip_type *ct = gc->chip_types;
+ u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask;
+ int i;
+
+ for (i = 0; i < gc->num_ct; i++) {
+ if (flags & IRQ_GC_MASK_CACHE_PER_TYPE) {
+ mskptr = &ct[i].mask_cache_priv;
+ mskreg = ct[i].regs.mask;
+ }
+ ct[i].mask_cache = mskptr;
+ if (flags & IRQ_GC_INIT_MASK_CACHE)
+ *mskptr = irq_reg_readl(gc->reg_base + mskreg);
+ }
+}
+
/*
* Separate lockdep class for interrupt chip which can nest irq_desc
* lock.
@@ -242,21 +269,12 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
struct irq_chip_type *ct = gc->chip_types;
struct irq_chip *chip = &ct->chip;
unsigned int i;
- u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask;
raw_spin_lock(&gc_lock);
list_add_tail(&gc->list, &gc_list);
raw_spin_unlock(&gc_lock);
- for (i = 0; i < gc->num_ct; i++) {
- if (flags & IRQ_GC_MASK_CACHE_PER_TYPE) {
- mskptr = &ct[i].mask_cache_priv;
- mskreg = ct[i].regs.mask;
- }
- ct[i].mask_cache = mskptr;
- if (flags & IRQ_GC_INIT_MASK_CACHE)
- *mskptr = irq_reg_readl(gc->reg_base + mskreg);
- }
+ irq_gc_init_mask_cache(gc, flags);
for (i = gc->irq_base; msk; msk >>= 1, i++) {
if (!(msk & 0x01))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists