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

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>

authored by

Lad Prabhakar and committed by
Damien Le Moal
db6a3f47 b6a64a86

+12 -3
+12 -3
drivers/ata/pata_of_platform.c
··· 25 25 struct device_node *dn = ofdev->dev.of_node; 26 26 struct resource io_res; 27 27 struct resource ctl_res; 28 - struct resource *irq_res; 28 + struct resource irq_res; 29 29 unsigned int reg_shift = 0; 30 30 int pio_mode = 0; 31 31 int pio_mask; 32 32 bool use16bit; 33 + int irq; 33 34 34 35 ret = of_address_to_resource(dn, 0, &io_res); 35 36 if (ret) { ··· 46 45 return -EINVAL; 47 46 } 48 47 49 - irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); 48 + memset(&irq_res, 0, sizeof(irq_res)); 49 + 50 + irq = platform_get_irq_optional(ofdev, 0); 51 + if (irq < 0 && irq != -ENXIO) 52 + return irq; 53 + if (irq > 0) { 54 + irq_res.start = irq; 55 + irq_res.end = irq; 56 + } 50 57 51 58 of_property_read_u32(dn, "reg-shift", &reg_shift); 52 59 ··· 72 63 pio_mask = 1 << pio_mode; 73 64 pio_mask |= (1 << pio_mode) - 1; 74 65 75 - return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq_res, 66 + return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq > 0 ? &irq_res : NULL, 76 67 reg_shift, pio_mask, &pata_platform_sht, 77 68 use16bit); 78 69 }