Skip to content

Commit 3fb212a

Browse files
author
Marc Zyngier
committed
irqchip/versatile-fpga: Switch to dynamic chip name output
Move the name output to the relevant callback, which allows us some nice cleanups (mostly owing to the fact that the driver is now DT only. We also drop a random include directive from the ftintc010 driver. Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20220209162607.1118325-8-maz@kernel.org
1 parent 3344265 commit 3fb212a

3 files changed

Lines changed: 26 additions & 35 deletions

File tree

drivers/irqchip/irq-ftintc010.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/irq.h>
1212
#include <linux/io.h>
1313
#include <linux/irqchip.h>
14-
#include <linux/irqchip/versatile-fpga.h>
1514
#include <linux/irqdomain.h>
1615
#include <linux/module.h>
1716
#include <linux/of.h>

drivers/irqchip/irq-versatile-fpga.c

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#include <linux/io.h>
88
#include <linux/irqchip.h>
99
#include <linux/irqchip/chained_irq.h>
10-
#include <linux/irqchip/versatile-fpga.h>
1110
#include <linux/irqdomain.h>
1211
#include <linux/module.h>
1312
#include <linux/of.h>
1413
#include <linux/of_address.h>
1514
#include <linux/of_irq.h>
15+
#include <linux/seq_file.h>
1616

1717
#include <asm/exception.h>
1818
#include <asm/mach/irq.h>
@@ -34,14 +34,12 @@
3434
/**
3535
* struct fpga_irq_data - irq data container for the FPGA IRQ controller
3636
* @base: memory offset in virtual memory
37-
* @chip: chip container for this instance
3837
* @domain: IRQ domain for this instance
3938
* @valid: mask for valid IRQs on this controller
4039
* @used_irqs: number of active IRQs on this controller
4140
*/
4241
struct fpga_irq_data {
4342
void __iomem *base;
44-
struct irq_chip chip;
4543
u32 valid;
4644
struct irq_domain *domain;
4745
u8 used_irqs;
@@ -67,6 +65,20 @@ static void fpga_irq_unmask(struct irq_data *d)
6765
writel(mask, f->base + IRQ_ENABLE_SET);
6866
}
6967

68+
static void fpga_irq_print_chip(struct irq_data *d, struct seq_file *p)
69+
{
70+
struct fpga_irq_data *f = irq_data_get_irq_chip_data(d);
71+
72+
seq_printf(p, irq_domain_get_of_node(f->domain)->name);
73+
}
74+
75+
static const struct irq_chip fpga_chip = {
76+
.irq_ack = fpga_irq_mask,
77+
.irq_mask = fpga_irq_mask,
78+
.irq_unmask = fpga_irq_unmask,
79+
.irq_print_chip = fpga_irq_print_chip,
80+
};
81+
7082
static void fpga_irq_handle(struct irq_desc *desc)
7183
{
7284
struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -116,7 +128,7 @@ static int handle_one_fpga(struct fpga_irq_data *f, struct pt_regs *regs)
116128
* Keep iterating over all registered FPGA IRQ controllers until there are
117129
* no pending interrupts.
118130
*/
119-
asmlinkage void __exception_irq_entry fpga_handle_irq(struct pt_regs *regs)
131+
static asmlinkage void __exception_irq_entry fpga_handle_irq(struct pt_regs *regs)
120132
{
121133
int i, handled;
122134

@@ -135,8 +147,7 @@ static int fpga_irqdomain_map(struct irq_domain *d, unsigned int irq,
135147
if (!(f->valid & BIT(hwirq)))
136148
return -EPERM;
137149
irq_set_chip_data(irq, f);
138-
irq_set_chip_and_handler(irq, &f->chip,
139-
handle_level_irq);
150+
irq_set_chip_and_handler(irq, &fpga_chip, handle_level_irq);
140151
irq_set_probe(irq);
141152
return 0;
142153
}
@@ -146,8 +157,8 @@ static const struct irq_domain_ops fpga_irqdomain_ops = {
146157
.xlate = irq_domain_xlate_onetwocell,
147158
};
148159

149-
void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
150-
int parent_irq, u32 valid, struct device_node *node)
160+
static void __init fpga_irq_init(void __iomem *base, int parent_irq,
161+
u32 valid, struct device_node *node)
151162
{
152163
struct fpga_irq_data *f;
153164
int i;
@@ -158,31 +169,26 @@ void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
158169
}
159170
f = &fpga_irq_devices[fpga_irq_id];
160171
f->base = base;
161-
f->chip.name = name;
162-
f->chip.irq_ack = fpga_irq_mask;
163-
f->chip.irq_mask = fpga_irq_mask;
164-
f->chip.irq_unmask = fpga_irq_unmask;
165172
f->valid = valid;
166173

167174
if (parent_irq != -1) {
168175
irq_set_chained_handler_and_data(parent_irq, fpga_irq_handle,
169176
f);
170177
}
171178

172-
/* This will also allocate irq descriptors */
173-
f->domain = irq_domain_add_simple(node, fls(valid), irq_start,
179+
f->domain = irq_domain_add_linear(node, fls(valid),
174180
&fpga_irqdomain_ops, f);
175181

176182
/* This will allocate all valid descriptors in the linear case */
177183
for (i = 0; i < fls(valid); i++)
178184
if (valid & BIT(i)) {
179-
if (!irq_start)
180-
irq_create_mapping(f->domain, i);
185+
/* Is this still required? */
186+
irq_create_mapping(f->domain, i);
181187
f->used_irqs++;
182188
}
183189

184190
pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs",
185-
fpga_irq_id, name, base, f->used_irqs);
191+
fpga_irq_id, node->name, base, f->used_irqs);
186192
if (parent_irq != -1)
187193
pr_cont(", parent IRQ: %d\n", parent_irq);
188194
else
@@ -192,8 +198,8 @@ void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
192198
}
193199

194200
#ifdef CONFIG_OF
195-
int __init fpga_irq_of_init(struct device_node *node,
196-
struct device_node *parent)
201+
static int __init fpga_irq_of_init(struct device_node *node,
202+
struct device_node *parent)
197203
{
198204
void __iomem *base;
199205
u32 clear_mask;
@@ -222,7 +228,7 @@ int __init fpga_irq_of_init(struct device_node *node,
222228
parent_irq = -1;
223229
}
224230

225-
fpga_irq_init(base, node->name, 0, parent_irq, valid_mask, node);
231+
fpga_irq_init(base, parent_irq, valid_mask, node);
226232

227233
/*
228234
* On Versatile AB/PB, some secondary interrupts have a direct

include/linux/irqchip/versatile-fpga.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)