Skip to content

Commit 530210c

Browse files
committed
of/irq: Replace of_irq with of_phandle_args
struct of_irq and struct of_phandle_args are exactly the same structure. This patch makes the kernel use of_phandle_args everywhere. This in itself isn't a big deal, but it makes some follow-on patches simpler. Signed-off-by: Grant Likely <[email protected]> Acked-by: Michal Simek <[email protected]> Acked-by: Tony Lindgren <[email protected]> Cc: Russell King <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]>
1 parent 0c02c80 commit 530210c

File tree

19 files changed

+58
-88
lines changed

19 files changed

+58
-88
lines changed

arch/arm/mach-integrator/pci_v3.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ static struct hw_pci pci_v3 __initdata = {
837837

838838
static int __init pci_v3_map_irq_dt(const struct pci_dev *dev, u8 slot, u8 pin)
839839
{
840-
struct of_irq oirq;
840+
struct of_phandle_args oirq;
841841
int ret;
842842

843843
ret = of_irq_parse_pci(dev, &oirq);
@@ -847,8 +847,7 @@ static int __init pci_v3_map_irq_dt(const struct pci_dev *dev, u8 slot, u8 pin)
847847
return 0;
848848
}
849849

850-
return irq_create_of_mapping(oirq.controller, oirq.specifier,
851-
oirq.size);
850+
return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
852851
}
853852

854853
static int __init pci_v3_dtprobe(struct platform_device *pdev,

arch/microblaze/pci/pci-common.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void pcibios_set_master(struct pci_dev *dev)
199199
*/
200200
int pci_read_irq_line(struct pci_dev *pci_dev)
201201
{
202-
struct of_irq oirq;
202+
struct of_phandle_args oirq;
203203
unsigned int virq;
204204

205205
/* The current device-tree that iSeries generates from the HV
@@ -243,11 +243,10 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
243243
irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
244244
} else {
245245
pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
246-
oirq.size, oirq.specifier[0], oirq.specifier[1],
247-
of_node_full_name(oirq.controller));
246+
oirq.args_count, oirq.args[0], oirq.args[1],
247+
of_node_full_name(oirq.np));
248248

249-
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
250-
oirq.size);
249+
virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
251250
}
252251
if (!virq) {
253252
pr_debug(" Failed to map !\n");

arch/mips/pci/fixup-lantiq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
2525

2626
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
2727
{
28-
struct of_irq dev_irq;
28+
struct of_phandle_args dev_irq;
2929
int irq;
3030

3131
if (of_irq_parse_pci(dev, &dev_irq)) {
3232
dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n",
3333
slot, pin);
3434
return 0;
3535
}
36-
irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier,
37-
dev_irq.size);
36+
irq = irq_create_of_mapping(dev_irq.np, dev_irq.args, dev_irq.args_count);
3837
dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq);
3938
return irq;
4039
}

arch/mips/pci/pci-rt3883.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static int rt3883_pci_probe(struct platform_device *pdev)
583583

584584
int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
585585
{
586-
struct of_irq dev_irq;
586+
struct of_phandle_args dev_irq;
587587
int err;
588588
int irq;
589589

@@ -594,9 +594,7 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
594594
return 0;
595595
}
596596

597-
irq = irq_create_of_mapping(dev_irq.controller,
598-
dev_irq.specifier,
599-
dev_irq.size);
597+
irq = irq_create_of_mapping(dev_irq.np, dev_irq.args, dev_irq.args_count);
600598

601599
if (irq == 0)
602600
pr_crit("pci %s: no irq found for pin %u\n",

arch/powerpc/kernel/pci-common.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ int pcibios_add_platform_entries(struct pci_dev *pdev)
228228
*/
229229
static int pci_read_irq_line(struct pci_dev *pci_dev)
230230
{
231-
struct of_irq oirq;
231+
struct of_phandle_args oirq;
232232
unsigned int virq;
233233

234234
pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
@@ -263,11 +263,10 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
263263
irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
264264
} else {
265265
pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
266-
oirq.size, oirq.specifier[0], oirq.specifier[1],
267-
of_node_full_name(oirq.controller));
266+
oirq.args_count, oirq.args[0], oirq.args[1],
267+
of_node_full_name(oirq.np));
268268

269-
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
270-
oirq.size);
269+
virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
271270
}
272271
if(virq == NO_IRQ) {
273272
pr_debug(" Failed to map !\n");

arch/powerpc/platforms/cell/celleb_scc_pciex.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ static __init int celleb_setup_pciex(struct device_node *node,
486486
struct pci_controller *phb)
487487
{
488488
struct resource r;
489-
struct of_irq oirq;
489+
struct of_phandle_args oirq;
490490
int virq;
491491

492492
/* SMMIO registers; used inside this file */
@@ -511,8 +511,7 @@ static __init int celleb_setup_pciex(struct device_node *node,
511511
pr_err("PCIEXC:Failed to map irq\n");
512512
goto error;
513513
}
514-
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
515-
oirq.size);
514+
virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
516515
if (request_irq(virq, pciex_handle_internal_irq,
517516
0, "pciex", (void *)phb)) {
518517
pr_err("PCIEXC:Failed to request irq\n");

arch/powerpc/platforms/cell/celleb_scc_sio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int __init txx9_serial_init(void)
4545
struct device_node *node;
4646
int i;
4747
struct uart_port req;
48-
struct of_irq irq;
48+
struct of_phandle_args irq;
4949
struct resource res;
5050

5151
for_each_compatible_node(node, "serial", "toshiba,sio-scc") {
@@ -66,8 +66,7 @@ static int __init txx9_serial_init(void)
6666
#ifdef CONFIG_SERIAL_TXX9_CONSOLE
6767
req.membase = ioremap(req.mapbase, 0x24);
6868
#endif
69-
req.irq = irq_create_of_mapping(irq.controller,
70-
irq.specifier, irq.size);
69+
req.irq = irq_create_of_mapping(irq.np, irq.args, irq.args_count);
7170
req.flags |= UPF_IOREMAP | UPF_BUGGY_UART
7271
/*HAVE_CTS_LINE*/;
7372
req.uartclk = 83300000;

arch/powerpc/platforms/cell/spider-pic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
235235
/* First, we check whether we have a real "interrupts" in the device
236236
* tree in case the device-tree is ever fixed
237237
*/
238-
struct of_irq oirq;
238+
struct of_phandle_args oirq;
239239
if (of_irq_parse_one(pic->host->of_node, 0, &oirq) == 0) {
240-
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
241-
oirq.size);
240+
virq = irq_create_of_mapping(oirq.np, oirq.args,
241+
oirq.args_count);
242242
return virq;
243243
}
244244

arch/powerpc/platforms/cell/spu_manage.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int __init spu_map_device_old(struct spu *spu)
177177

178178
static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
179179
{
180-
struct of_irq oirq;
180+
struct of_phandle_args oirq;
181181
int ret;
182182
int i;
183183

@@ -188,10 +188,10 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
188188
goto err;
189189
}
190190
ret = -EINVAL;
191-
pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0],
192-
oirq.controller->full_name);
193-
spu->irqs[i] = irq_create_of_mapping(oirq.controller,
194-
oirq.specifier, oirq.size);
191+
pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0],
192+
oirq.np->full_name);
193+
spu->irqs[i] = irq_create_of_mapping(oirq.np,
194+
oirq.args, oirq.args_count);
195195
if (spu->irqs[i] == NO_IRQ) {
196196
pr_debug("spu_new: failed to map it !\n");
197197
goto err;
@@ -200,7 +200,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
200200
return 0;
201201

202202
err:
203-
pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier,
203+
pr_debug("failed to map irq %x for spu %s\n", *oirq.args,
204204
spu->name);
205205
for (; i >= 0; i--) {
206206
if (spu->irqs[i] != NO_IRQ)

arch/powerpc/platforms/fsl_uli1575.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
321321
{
322322
struct pci_controller *hose = pci_bus_to_host(dev->bus);
323323
struct device_node *hosenode = hose ? hose->dn : NULL;
324-
struct of_irq oirq;
325-
int virq, pin = 2;
324+
struct of_phandle_args oirq;
325+
int pin = 2;
326326
u32 laddr[3];
327327

328328
if (!machine_is(mpc86xx_hpcd))
@@ -334,9 +334,7 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
334334
laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
335335
laddr[1] = laddr[2] = 0;
336336
of_irq_parse_raw(hosenode, &pin, 1, laddr, &oirq);
337-
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
338-
oirq.size);
339-
dev->irq = virq;
337+
dev->irq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
340338
}
341339

342340
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);

arch/powerpc/platforms/powermac/pic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static void __init pmac_pic_probe_oldstyle(void)
394394
}
395395

396396
int of_irq_parse_oldworld(struct device_node *device, int index,
397-
struct of_irq *out_irq)
397+
struct of_phandle_args *out_irq)
398398
{
399399
const u32 *ints = NULL;
400400
int intlen;
@@ -422,9 +422,9 @@ int of_irq_parse_oldworld(struct device_node *device, int index,
422422
if (index >= intlen)
423423
return -EINVAL;
424424

425-
out_irq->controller = NULL;
426-
out_irq->specifier[0] = ints[index];
427-
out_irq->size = 1;
425+
out_irq->np = NULL;
426+
out_irq->args[0] = ints[index];
427+
out_irq->args_count = 1;
428428

429429
return 0;
430430
}

arch/powerpc/platforms/pseries/event_sources.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void request_event_sources_irqs(struct device_node *np,
2525
const char *name)
2626
{
2727
int i, index, count = 0;
28-
struct of_irq oirq;
28+
struct of_phandle_args oirq;
2929
const u32 *opicprop;
3030
unsigned int opicplen;
3131
unsigned int virqs[16];
@@ -59,9 +59,8 @@ void request_event_sources_irqs(struct device_node *np,
5959
index++) {
6060
if (count > 15)
6161
break;
62-
virqs[count] = irq_create_of_mapping(oirq.controller,
63-
oirq.specifier,
64-
oirq.size);
62+
virqs[count] = irq_create_of_mapping(oirq.np, oirq.args,
63+
oirq.args_count);
6564
if (virqs[count] == NO_IRQ) {
6665
pr_err("event-sources: Unable to allocate "
6766
"interrupt number for %s\n",

arch/powerpc/sysdev/mpic_msi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
3535
const struct irq_domain_ops *ops = mpic->irqhost->ops;
3636
struct device_node *np;
3737
int flags, index, i;
38-
struct of_irq oirq;
38+
struct of_phandle_args oirq;
3939

4040
pr_debug("mpic: found U3, guessing msi allocator setup\n");
4141

@@ -64,8 +64,8 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
6464

6565
index = 0;
6666
while (of_irq_parse_one(np, index++, &oirq) == 0) {
67-
ops->xlate(mpic->irqhost, NULL, oirq.specifier,
68-
oirq.size, &hwirq, &flags);
67+
ops->xlate(mpic->irqhost, NULL, oirq.args,
68+
oirq.args_count, &hwirq, &flags);
6969
msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
7070
}
7171
}

arch/x86/kernel/devicetree.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
105105

106106
static int x86_of_pci_irq_enable(struct pci_dev *dev)
107107
{
108-
struct of_irq oirq;
108+
struct of_phandle_args oirq;
109109
u32 virq;
110110
int ret;
111111
u8 pin;
@@ -120,8 +120,7 @@ static int x86_of_pci_irq_enable(struct pci_dev *dev)
120120
if (ret)
121121
return ret;
122122

123-
virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
124-
oirq.size);
123+
virq = irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
125124
if (virq == 0)
126125
return -EINVAL;
127126
dev->irq = virq;

drivers/of/irq.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@
3636
*/
3737
unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
3838
{
39-
struct of_irq oirq;
39+
struct of_phandle_args oirq;
4040

4141
if (of_irq_parse_one(dev, index, &oirq))
4242
return 0;
4343

44-
return irq_create_of_mapping(oirq.controller, oirq.specifier,
45-
oirq.size);
44+
return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
4645
}
4746
EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
4847

@@ -94,7 +93,7 @@ struct device_node *of_irq_find_parent(struct device_node *child)
9493
* node exist for the parent.
9594
*/
9695
int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec,
97-
u32 ointsize, const __be32 *addr, struct of_irq *out_irq)
96+
u32 ointsize, const __be32 *addr, struct of_phandle_args *out_irq)
9897
{
9998
struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
10099
const __be32 *tmp, *imap, *imask;
@@ -156,10 +155,10 @@ int of_irq_parse_raw(struct device_node *parent, const __be32 *intspec,
156155
NULL) {
157156
pr_debug(" -> got it !\n");
158157
for (i = 0; i < intsize; i++)
159-
out_irq->specifier[i] =
158+
out_irq->args[i] =
160159
of_read_number(intspec +i, 1);
161-
out_irq->size = intsize;
162-
out_irq->controller = ipar;
160+
out_irq->args_count = intsize;
161+
out_irq->np = ipar;
163162
of_node_put(old);
164163
return 0;
165164
}
@@ -280,7 +279,7 @@ EXPORT_SYMBOL_GPL(of_irq_parse_raw);
280279
* This function resolves an interrupt, walking the tree, for a given
281280
* device-tree node. It's the high level pendant to of_irq_parse_raw().
282281
*/
283-
int of_irq_parse_one(struct device_node *device, int index, struct of_irq *out_irq)
282+
int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq)
284283
{
285284
struct device_node *p;
286285
const __be32 *intspec, *tmp, *addr;

drivers/of/of_pci_irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* PCI tree until an device-node is found, at which point it will finish
1616
* resolving using the OF tree walking.
1717
*/
18-
int of_irq_parse_pci(const struct pci_dev *pdev, struct of_irq *out_irq)
18+
int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
1919
{
2020
struct device_node *dn, *ppnode;
2121
struct pci_dev *ppdev;

drivers/pci/host/pci-mvebu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,14 @@ static int __init mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
647647

648648
static int __init mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
649649
{
650-
struct of_irq oirq;
650+
struct of_phandle_args oirq;
651651
int ret;
652652

653653
ret = of_irq_parse_pci(dev, &oirq);
654654
if (ret)
655655
return ret;
656656

657-
return irq_create_of_mapping(oirq.controller, oirq.specifier,
658-
oirq.size);
657+
return irq_create_of_mapping(oirq.np, oirq.args, oirq.args_count);
659658
}
660659

661660
static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)

0 commit comments

Comments
 (0)