Skip to content

Commit db6a3f4

Browse files
prabhakarladDamien Le Moal
authored andcommitted
ata: pata_of_platform: Use platform_get_irq_optional() to get the interrupt
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static allocation of IRQ resources in DT core code, this causes an issue when using hierarchical interrupt domains using "interrupts" property in the node as this bypasses the hierarchical setup and messes up the irq chaining. In preparation for removal of static setup of IRQ resource from DT core code use platform_get_irq_optional(). Note the code does not set the IRQ flags as this is handled automatically for DT. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
1 parent b6a64a8 commit db6a3f4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

drivers/ata/pata_of_platform.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
2525
struct device_node *dn = ofdev->dev.of_node;
2626
struct resource io_res;
2727
struct resource ctl_res;
28-
struct resource *irq_res;
28+
struct resource irq_res;
2929
unsigned int reg_shift = 0;
3030
int pio_mode = 0;
3131
int pio_mask;
3232
bool use16bit;
33+
int irq;
3334

3435
ret = of_address_to_resource(dn, 0, &io_res);
3536
if (ret) {
@@ -45,7 +46,15 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
4546
return -EINVAL;
4647
}
4748

48-
irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
49+
memset(&irq_res, 0, sizeof(irq_res));
50+
51+
irq = platform_get_irq_optional(ofdev, 0);
52+
if (irq < 0 && irq != -ENXIO)
53+
return irq;
54+
if (irq > 0) {
55+
irq_res.start = irq;
56+
irq_res.end = irq;
57+
}
4958

5059
of_property_read_u32(dn, "reg-shift", &reg_shift);
5160

@@ -63,7 +72,7 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
6372
pio_mask = 1 << pio_mode;
6473
pio_mask |= (1 << pio_mode) - 1;
6574

66-
return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq_res,
75+
return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq > 0 ? &irq_res : NULL,
6776
reg_shift, pio_mask, &pata_platform_sht,
6877
use16bit);
6978
}

0 commit comments

Comments
 (0)