diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2013-05-06 10:30:25 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2013-05-29 04:57:11 -0400 |
| commit | 3528d82b684680b72fa31881c8c572c5a98b51de (patch) | |
| tree | 7ae110c860b98d7068e4bc9ce16b26a3adc820bf /kernel/irq | |
| parent | d0051816e619f8f082582bec07ffa51bdb4f2104 (diff) | |
genirq: Generic chip: Split out code into separate functions
Preparatory patch for linear interrupt domains.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jean-Francois Moine <moinejf@free.fr>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Gerlando Falauto <gerlando.falauto@keymile.com>
Cc: Rob Landley <rob@landley.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Link: http://lkml.kernel.org/r/20130506142539.377017672@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq')
| -rw-r--r-- | kernel/irq/generic-chip.c | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 5068fe3ae1af..3deb3333d53e 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) | |||
| 186 | return 0; | 186 | return 0; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | static void | ||
| 190 | irq_init_generic_chip(struct irq_chip_generic *gc, const char *name, | ||
| 191 | int num_ct, unsigned int irq_base, | ||
| 192 | void __iomem *reg_base, irq_flow_handler_t handler) | ||
| 193 | { | ||
| 194 | raw_spin_lock_init(&gc->lock); | ||
| 195 | gc->num_ct = num_ct; | ||
| 196 | gc->irq_base = irq_base; | ||
| 197 | gc->reg_base = reg_base; | ||
| 198 | gc->chip_types->chip.name = name; | ||
| 199 | gc->chip_types->handler = handler; | ||
| 200 | } | ||
| 201 | |||
| 189 | /** | 202 | /** |
| 190 | * irq_alloc_generic_chip - Allocate a generic chip and initialize it | 203 | * irq_alloc_generic_chip - Allocate a generic chip and initialize it |
| 191 | * @name: Name of the irq chip | 204 | * @name: Name of the irq chip |
| @@ -206,17 +219,31 @@ irq_alloc_generic_chip(const char *name, int num_ct, unsigned int irq_base, | |||
| 206 | 219 | ||
| 207 | gc = kzalloc(sz, GFP_KERNEL); | 220 | gc = kzalloc(sz, GFP_KERNEL); |
| 208 | if (gc) { | 221 | if (gc) { |
| 209 | raw_spin_lock_init(&gc->lock); | 222 | irq_init_generic_chip(gc, name, num_ct, irq_base, reg_base, |
| 210 | gc->num_ct = num_ct; | 223 | handler); |
| 211 | gc->irq_base = irq_base; | ||
| 212 | gc->reg_base = reg_base; | ||
| 213 | gc->chip_types->chip.name = name; | ||
| 214 | gc->chip_types->handler = handler; | ||
| 215 | } | 224 | } |
| 216 | return gc; | 225 | return gc; |
| 217 | } | 226 | } |
| 218 | EXPORT_SYMBOL_GPL(irq_alloc_generic_chip); | 227 | EXPORT_SYMBOL_GPL(irq_alloc_generic_chip); |
| 219 | 228 | ||
| 229 | static void | ||
| 230 | irq_gc_init_mask_cache(struct irq_chip_generic *gc, enum irq_gc_flags flags) | ||
| 231 | { | ||
| 232 | struct irq_chip_type *ct = gc->chip_types; | ||
| 233 | u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask; | ||
| 234 | int i; | ||
| 235 | |||
| 236 | for (i = 0; i < gc->num_ct; i++) { | ||
| 237 | if (flags & IRQ_GC_MASK_CACHE_PER_TYPE) { | ||
| 238 | mskptr = &ct[i].mask_cache_priv; | ||
| 239 | mskreg = ct[i].regs.mask; | ||
| 240 | } | ||
| 241 | ct[i].mask_cache = mskptr; | ||
| 242 | if (flags & IRQ_GC_INIT_MASK_CACHE) | ||
| 243 | *mskptr = irq_reg_readl(gc->reg_base + mskreg); | ||
| 244 | } | ||
| 245 | } | ||
| 246 | |||
| 220 | /* | 247 | /* |
| 221 | * Separate lockdep class for interrupt chip which can nest irq_desc | 248 | * Separate lockdep class for interrupt chip which can nest irq_desc |
| 222 | * lock. | 249 | * lock. |
| @@ -242,21 +269,12 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk, | |||
| 242 | struct irq_chip_type *ct = gc->chip_types; | 269 | struct irq_chip_type *ct = gc->chip_types; |
| 243 | struct irq_chip *chip = &ct->chip; | 270 | struct irq_chip *chip = &ct->chip; |
| 244 | unsigned int i; | 271 | unsigned int i; |
| 245 | u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask; | ||
| 246 | 272 | ||
| 247 | raw_spin_lock(&gc_lock); | 273 | raw_spin_lock(&gc_lock); |
| 248 | list_add_tail(&gc->list, &gc_list); | 274 | list_add_tail(&gc->list, &gc_list); |
| 249 | raw_spin_unlock(&gc_lock); | 275 | raw_spin_unlock(&gc_lock); |
| 250 | 276 | ||
| 251 | for (i = 0; i < gc->num_ct; i++) { | 277 | irq_gc_init_mask_cache(gc, flags); |
| 252 | if (flags & IRQ_GC_MASK_CACHE_PER_TYPE) { | ||
| 253 | mskptr = &ct[i].mask_cache_priv; | ||
| 254 | mskreg = ct[i].regs.mask; | ||
| 255 | } | ||
| 256 | ct[i].mask_cache = mskptr; | ||
| 257 | if (flags & IRQ_GC_INIT_MASK_CACHE) | ||
| 258 | *mskptr = irq_reg_readl(gc->reg_base + mskreg); | ||
| 259 | } | ||
| 260 | 278 | ||
| 261 | for (i = gc->irq_base; msk; msk >>= 1, i++) { | 279 | for (i = gc->irq_base; msk; msk >>= 1, i++) { |
| 262 | if (!(msk & 0x01)) | 280 | if (!(msk & 0x01)) |
