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

irqchip: s3c24xx: make interrupt handling independent of irq_domain structure

Keep a pointer to the corresponding s3c_irq_data struct as irq_chip_data.
This removes the need to fetch the intc struct from the irq_domains
host_data, thus making it independent of the underlying irq_domain
structure.

Also keep the real register offset of the interrupt in the s3c_irq_data
struct to make it independent of the hwirq structure in the irq_domain

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>

authored by

Heiko Stuebner and committed by
Kukjin Kim
f5a25524 658dc8fb

+15 -10
+15 -10
drivers/irqchip/irq-s3c24xx.c
··· 43 43 44 44 struct s3c_irq_data { 45 45 unsigned int type; 46 + unsigned long offset; 46 47 unsigned long parent_irq; 47 48 48 49 /* data gets filled during init */ ··· 80 79 81 80 static void s3c_irq_mask(struct irq_data *data) 82 81 { 83 - struct s3c_irq_intc *intc = data->domain->host_data; 82 + struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); 83 + struct s3c_irq_intc *intc = irq_data->intc; 84 84 struct s3c_irq_intc *parent_intc = intc->parent; 85 - struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; 86 85 struct s3c_irq_data *parent_data; 87 86 unsigned long mask; 88 87 unsigned int irqno; 89 88 90 89 mask = __raw_readl(intc->reg_mask); 91 - mask |= (1UL << data->hwirq); 90 + mask |= (1UL << irq_data->offset); 92 91 __raw_writel(mask, intc->reg_mask); 93 92 94 93 if (parent_intc) { ··· 105 104 106 105 static void s3c_irq_unmask(struct irq_data *data) 107 106 { 108 - struct s3c_irq_intc *intc = data->domain->host_data; 107 + struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); 108 + struct s3c_irq_intc *intc = irq_data->intc; 109 109 struct s3c_irq_intc *parent_intc = intc->parent; 110 - struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; 111 110 unsigned long mask; 112 111 unsigned int irqno; 113 112 114 113 mask = __raw_readl(intc->reg_mask); 115 - mask &= ~(1UL << data->hwirq); 114 + mask &= ~(1UL << irq_data->offset); 116 115 __raw_writel(mask, intc->reg_mask); 117 116 118 117 if (parent_intc) { ··· 124 123 125 124 static inline void s3c_irq_ack(struct irq_data *data) 126 125 { 127 - struct s3c_irq_intc *intc = data->domain->host_data; 128 - unsigned long bitval = 1UL << data->hwirq; 126 + struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); 127 + struct s3c_irq_intc *intc = irq_data->intc; 128 + unsigned long bitval = 1UL << irq_data->offset; 129 129 130 130 __raw_writel(bitval, intc->reg_pending); 131 131 if (intc->reg_intpnd) ··· 293 291 static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) 294 292 { 295 293 struct irq_chip *chip = irq_desc_get_chip(desc); 296 - struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; 297 - struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq]; 294 + struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc); 298 295 struct s3c_irq_intc *sub_intc = irq_data->sub_intc; 299 296 unsigned long src; 300 297 unsigned long msk; ··· 407 406 408 407 /* attach controller pointer to irq_data */ 409 408 irq_data->intc = intc; 409 + irq_data->offset = hw; 410 410 411 411 parent_intc = intc->parent; 412 412 ··· 446 444 pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); 447 445 return -EINVAL; 448 446 } 447 + 448 + irq_set_chip_data(virq, irq_data); 449 + 449 450 set_irq_flags(virq, IRQF_VALID); 450 451 451 452 if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) {