Skip to content

Commit d59f7d1

Browse files
Zhen LeiMarc Zyngier
authored andcommitted
irqchip/dw-apb-ictl: Refactor priot to introducing hierarchical irq domains
Add the required abstractions that will help introducing hierarchical domain support to the dw-apb-ictl driver. No functional change. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> [maz: commit message, some cleanups] Signed-off-by: Marc Zyngier <maz@kernel.org> Tested-by: Haoyu Lv <lvhaoyu@huawei.com> Link: https://lore.kernel.org/r/20200924071754.4509-3-thunder.leizhen@huawei.com
1 parent ea0c80d commit d59f7d1

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

drivers/irqchip/irq-dw-apb-ictl.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define APB_INT_FINALSTATUS_H 0x34
2727
#define APB_INT_BASE_OFFSET 0x04
2828

29-
static void dw_apb_ictl_handler(struct irq_desc *desc)
29+
static void dw_apb_ictl_handle_irq_cascaded(struct irq_desc *desc)
3030
{
3131
struct irq_domain *d = irq_desc_get_handler_data(desc);
3232
struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -43,7 +43,7 @@ static void dw_apb_ictl_handler(struct irq_desc *desc)
4343
u32 virq = irq_find_mapping(d, gc->irq_base + hwirq);
4444

4545
generic_handle_irq(virq);
46-
stat &= ~(1 << hwirq);
46+
stat &= ~BIT(hwirq);
4747
}
4848
}
4949

@@ -68,17 +68,20 @@ static void dw_apb_ictl_resume(struct irq_data *d)
6868
static int __init dw_apb_ictl_init(struct device_node *np,
6969
struct device_node *parent)
7070
{
71+
const struct irq_domain_ops *domain_ops;
7172
unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
7273
struct resource r;
7374
struct irq_domain *domain;
7475
struct irq_chip_generic *gc;
7576
void __iomem *iobase;
76-
int ret, nrirqs, irq, i;
77+
int ret, nrirqs, parent_irq, i;
7778
u32 reg;
7879

80+
domain_ops = &irq_generic_chip_ops;
81+
7982
/* Map the parent interrupt for the chained handler */
80-
irq = irq_of_parse_and_map(np, 0);
81-
if (irq <= 0) {
83+
parent_irq = irq_of_parse_and_map(np, 0);
84+
if (parent_irq <= 0) {
8285
pr_err("%pOF: unable to parse irq\n", np);
8386
return -EINVAL;
8487
}
@@ -120,8 +123,7 @@ static int __init dw_apb_ictl_init(struct device_node *np,
120123
else
121124
nrirqs = fls(readl_relaxed(iobase + APB_INT_ENABLE_L));
122125

123-
domain = irq_domain_add_linear(np, nrirqs,
124-
&irq_generic_chip_ops, NULL);
126+
domain = irq_domain_add_linear(np, nrirqs, domain_ops, NULL);
125127
if (!domain) {
126128
pr_err("%pOF: unable to add irq domain\n", np);
127129
ret = -ENOMEM;
@@ -146,7 +148,8 @@ static int __init dw_apb_ictl_init(struct device_node *np,
146148
gc->chip_types[0].chip.irq_resume = dw_apb_ictl_resume;
147149
}
148150

149-
irq_set_chained_handler_and_data(irq, dw_apb_ictl_handler, domain);
151+
irq_set_chained_handler_and_data(parent_irq,
152+
dw_apb_ictl_handle_irq_cascaded, domain);
150153

151154
return 0;
152155

0 commit comments

Comments
 (0)