diff mbox series

[v3,04/10] ata: pata_platform: Use platform_get_irq_optional() to get the interrupt

Message ID 20211224131300.18198-5-prabhakar.mahadev-lad.rj@bp.renesas.com
State New
Headers show
Series [v3,01/10] ata: pata_platform: Make use of platform_get_mem_or_io() | expand

Commit Message

Lad Prabhakar Dec. 24, 2021, 1:12 p.m. UTC
To be consistent with pata_of_platform driver use
platform_get_irq_optional() instead of
platform_get_resource(pdev, IORESOURCE_IRQ, 0).

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2-->v3
* New patch
---
 drivers/ata/pata_platform.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Sergey Shtylyov Dec. 27, 2021, 7:58 p.m. UTC | #1
On 12/24/21 4:12 PM, Lad Prabhakar wrote:

> To be consistent with pata_of_platform driver use
> platform_get_irq_optional() instead of
> platform_get_resource(pdev, IORESOURCE_IRQ, 0).

   But why can't we be consistent with the unpatched pata_of_platfrom(), and then
convert to platform_get_irq_optional() after merging both drivers?
   I'd like to avoid patching the driver to be gone if possible...

> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[...]

MBR, Sergey
Sergey Shtylyov Dec. 28, 2021, 9:33 a.m. UTC | #2
On 27.12.2021 22:58, Sergey Shtylyov wrote:

>> To be consistent with pata_of_platform driver use
>> platform_get_irq_optional() instead of
>> platform_get_resource(pdev, IORESOURCE_IRQ, 0).
> 
>     But why can't we be consistent with the unpatched pata_of_platfrom(), and then

    Sorry, pata_of_platform.

> convert to platform_get_irq_optional() after merging both drivers?
>     I'd like to avoid patching the driver to be gone if possible...
> 
>> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> [...]

MBR, Sergey
Lad, Prabhakar Jan. 4, 2022, 7:42 p.m. UTC | #3
Hi Sergey,

Thank you for the review.

On Mon, Dec 27, 2021 at 7:58 PM Sergey Shtylyov <s.shtylyov@omp.ru> wrote:
>
> On 12/24/21 4:12 PM, Lad Prabhakar wrote:
>
> > To be consistent with pata_of_platform driver use
> > platform_get_irq_optional() instead of
> > platform_get_resource(pdev, IORESOURCE_IRQ, 0).
>
>    But why can't we be consistent with the unpatched pata_of_platfrom(), and then
> convert to platform_get_irq_optional() after merging both drivers?
>    I'd like to avoid patching the driver to be gone if possible...
>
Basically to have members of struct pata_platform_priv{} in one shot,
instead of changing them again and again. btw you are OK with patching
for 06/10.

Cheers,
Prabhakar
diff mbox series

Patch

diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 29902001e223..2e439b923762 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -184,8 +184,9 @@  static int pata_platform_probe(struct platform_device *pdev)
 {
 	struct resource *io_res;
 	struct resource *ctl_res;
-	struct resource *irq_res;
+	struct resource irq_res;
 	struct pata_platform_info *pp_info = dev_get_platdata(&pdev->dev);
+	int irq;
 
 	/*
 	 * Simple resource validation ..
@@ -212,9 +213,15 @@  static int pata_platform_probe(struct platform_device *pdev)
 	/*
 	 * And the IRQ
 	 */
-	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	irq = platform_get_irq_optional(pdev, 0);
+	if (irq < 0 && irq != -ENXIO)
+		return irq;
+	if (irq > 0) {
+		memset(&irq_res, 0x0, sizeof(struct resource));
+		irq_res.start = irq;
+	}
 
-	return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res,
+	return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq > 0 ? &irq_res : NULL,
 				     pp_info ? pp_info->ioport_shift : 0,
 				     pio_mask, &pata_platform_sht, false);
 }