* [PATCH] ata: libahci: properly propagate return value of platform_get_irq()
@ 2017-05-16 12:06 Thomas Petazzoni
2017-05-16 12:59 ` Hans de Goede
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2017-05-16 12:06 UTC (permalink / raw)
To: Hans de Goede, Tejun Heo; +Cc: linux-ide, Gregory Clement, Thomas Petazzoni
When platform_get_irq() fails, it returns an error code, which
libahci_platform and replaces it by -EINVAL. This commit fixes that by
propagating the error code. It fixes the situation where
platform_get_irq() returns -EPROBE_DEFER because the interrupt
controller is not available yet, and generally looks like the right
thing to do.
We pay attention to not show the "no irq" message when we are in an
EPROBE_DEFER situation, because the driver probing will be retried
later on, once the interrupt controller becomes available to provide
the interrupt.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
drivers/ata/libahci_platform.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index aaa761b..cd2eab6 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -514,8 +514,9 @@ int ahci_platform_init_host(struct platform_device *pdev,
irq = platform_get_irq(pdev, 0);
if (irq <= 0) {
- dev_err(dev, "no irq\n");
- return -EINVAL;
+ if (irq != -EPROBE_DEFER)
+ dev_err(dev, "no irq\n");
+ return irq;
}
hpriv->irq = irq;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ata: libahci: properly propagate return value of platform_get_irq()
2017-05-16 12:06 [PATCH] ata: libahci: properly propagate return value of platform_get_irq() Thomas Petazzoni
@ 2017-05-16 12:59 ` Hans de Goede
2017-05-16 15:20 ` Tejun Heo
2017-05-17 9:11 ` Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2017-05-16 12:59 UTC (permalink / raw)
To: Thomas Petazzoni, Tejun Heo; +Cc: linux-ide, Gregory Clement
Hi,
On 16-05-17 14:06, Thomas Petazzoni wrote:
> When platform_get_irq() fails, it returns an error code, which
> libahci_platform and replaces it by -EINVAL. This commit fixes that by
> propagating the error code. It fixes the situation where
> platform_get_irq() returns -EPROBE_DEFER because the interrupt
> controller is not available yet, and generally looks like the right
> thing to do.
>
> We pay attention to not show the "no irq" message when we are in an
> EPROBE_DEFER situation, because the driver probing will be retried
> later on, once the interrupt controller becomes available to provide
> the interrupt.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/ata/libahci_platform.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index aaa761b..cd2eab6 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -514,8 +514,9 @@ int ahci_platform_init_host(struct platform_device *pdev,
>
> irq = platform_get_irq(pdev, 0);
> if (irq <= 0) {
> - dev_err(dev, "no irq\n");
> - return -EINVAL;
> + if (irq != -EPROBE_DEFER)
> + dev_err(dev, "no irq\n");
> + return irq;
> }
>
> hpriv->irq = irq;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ata: libahci: properly propagate return value of platform_get_irq()
2017-05-16 12:06 [PATCH] ata: libahci: properly propagate return value of platform_get_irq() Thomas Petazzoni
2017-05-16 12:59 ` Hans de Goede
@ 2017-05-16 15:20 ` Tejun Heo
2017-05-17 9:11 ` Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2017-05-16 15:20 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: Hans de Goede, linux-ide, Gregory Clement
On Tue, May 16, 2017 at 02:06:12PM +0200, Thomas Petazzoni wrote:
> When platform_get_irq() fails, it returns an error code, which
> libahci_platform and replaces it by -EINVAL. This commit fixes that by
> propagating the error code. It fixes the situation where
> platform_get_irq() returns -EPROBE_DEFER because the interrupt
> controller is not available yet, and generally looks like the right
> thing to do.
>
> We pay attention to not show the "no irq" message when we are in an
> EPROBE_DEFER situation, because the driver probing will be retried
> later on, once the interrupt controller becomes available to provide
> the interrupt.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Applied to libata/for-4.12-fixes.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ata: libahci: properly propagate return value of platform_get_irq()
2017-05-16 12:06 [PATCH] ata: libahci: properly propagate return value of platform_get_irq() Thomas Petazzoni
2017-05-16 12:59 ` Hans de Goede
2017-05-16 15:20 ` Tejun Heo
@ 2017-05-17 9:11 ` Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2017-05-17 9:11 UTC (permalink / raw)
To: Thomas Petazzoni, Hans de Goede, Tejun Heo; +Cc: linux-ide, Gregory Clement
Hello!
On 5/16/2017 3:06 PM, Thomas Petazzoni wrote:
> When platform_get_irq() fails, it returns an error code, which
> libahci_platform and replaces it by -EINVAL.
Couldn't parse this sentence...
> This commit fixes that by
> propagating the error code. It fixes the situation where
> platform_get_irq() returns -EPROBE_DEFER because the interrupt
> controller is not available yet, and generally looks like the right
> thing to do.
>
> We pay attention to not show the "no irq" message when we are in an
> EPROBE_DEFER situation, because the driver probing will be retried
> later on, once the interrupt controller becomes available to provide
> the interrupt.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> drivers/ata/libahci_platform.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index aaa761b..cd2eab6 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -514,8 +514,9 @@ int ahci_platform_init_host(struct platform_device *pdev,
>
> irq = platform_get_irq(pdev, 0);
> if (irq <= 0) {
> - dev_err(dev, "no irq\n");
> - return -EINVAL;
> + if (irq != -EPROBE_DEFER)
> + dev_err(dev, "no irq\n");
> + return irq;
Iff 'irq' is 0, you'll return 0 here, indicating success.
Actually, I've fixed platform_get_irq() not to return 0 on error.
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-17 9:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-16 12:06 [PATCH] ata: libahci: properly propagate return value of platform_get_irq() Thomas Petazzoni
2017-05-16 12:59 ` Hans de Goede
2017-05-16 15:20 ` Tejun Heo
2017-05-17 9:11 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox