Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 7395/1: VIC: use the domain mapping function to assign handlers

This removes the internal functions for assigning IRQ
handlers to each interrupt in favor of using the internal
map iterator in the irq domain code.

Cc: Will Deacon <will.deacon@arm.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Acked-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Linus Walleij and committed by
Russell King
ce94df9c fa943bed

+24 -20
+24 -20
arch/arm/common/vic.c
··· 39 39 * struct vic_device - VIC PM device 40 40 * @irq: The IRQ number for the base of the VIC. 41 41 * @base: The register base for the VIC. 42 + * @valid_sources: A bitmask of valid interrupts 42 43 * @resume_sources: A bitmask of interrupts for resume. 43 44 * @resume_irqs: The IRQs enabled for resume. 44 45 * @int_select: Save for VIC_INT_SELECT. ··· 51 50 struct vic_device { 52 51 void __iomem *base; 53 52 int irq; 53 + u32 valid_sources; 54 54 u32 resume_sources; 55 55 u32 resume_irqs; 56 56 u32 int_select; ··· 166 164 late_initcall(vic_pm_init); 167 165 #endif /* CONFIG_PM */ 168 166 167 + static struct irq_chip vic_chip; 168 + 169 + static int vic_irqdomain_map(struct irq_domain *d, unsigned int irq, 170 + irq_hw_number_t hwirq) 171 + { 172 + struct vic_device *v = d->host_data; 173 + 174 + /* Skip invalid IRQs, only register handlers for the real ones */ 175 + if (!(v->valid_sources & (1 << hwirq))) 176 + return -ENOTSUPP; 177 + irq_set_chip_and_handler(irq, &vic_chip, handle_level_irq); 178 + irq_set_chip_data(irq, v->base); 179 + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 180 + return 0; 181 + } 182 + 183 + static struct irq_domain_ops vic_irqdomain_ops = { 184 + .map = vic_irqdomain_map, 185 + .xlate = irq_domain_xlate_onetwocell, 186 + }; 187 + 169 188 /** 170 189 * vic_register() - Register a VIC. 171 190 * @base: The base address of the VIC. ··· 214 191 215 192 v = &vic_devices[vic_id]; 216 193 v->base = base; 194 + v->valid_sources = valid_sources; 217 195 v->resume_sources = resume_sources; 218 196 v->irq = irq; 219 197 vic_id++; ··· 313 289 } 314 290 } 315 291 316 - static void __init vic_set_irq_sources(void __iomem *base, 317 - unsigned int irq_start, u32 vic_sources) 318 - { 319 - unsigned int i; 320 - 321 - for (i = 0; i < 32; i++) { 322 - if (vic_sources & (1 << i)) { 323 - unsigned int irq = irq_start + i; 324 - 325 - irq_set_chip_and_handler(irq, &vic_chip, 326 - handle_level_irq); 327 - irq_set_chip_data(irq, base); 328 - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 329 - } 330 - } 331 - } 332 - 333 292 /* 334 293 * The PL190 cell from ARM has been modified by ST to handle 64 interrupts. 335 294 * The original cell has 32 interrupts, while the modified one has 64, ··· 347 340 writel(32, base + VIC_PL190_DEF_VECT_ADDR); 348 341 } 349 342 350 - vic_set_irq_sources(base, irq_start, vic_sources); 351 343 vic_register(base, irq_start, vic_sources, 0, node); 352 344 } 353 345 ··· 386 380 vic_clear_interrupts(base); 387 381 388 382 vic_init2(base); 389 - 390 - vic_set_irq_sources(base, irq_start, vic_sources); 391 383 392 384 vic_register(base, irq_start, vic_sources, resume_sources, node); 393 385 }