* [PATCH v2] net: mvmdio: avoid error message for optional IRQ
@ 2020-03-11 20:05 Chris Packham
2020-03-12 7:03 ` David Miller
2020-03-16 7:29 ` Chris Packham
0 siblings, 2 replies; 5+ messages in thread
From: Chris Packham @ 2020-03-11 20:05 UTC (permalink / raw)
To: davem, andrew, josua; +Cc: netdev, linux-kernel, Chris Packham
Per the dt-binding the interrupt is optional so use
platform_get_irq_optional() instead of platform_get_irq(). Since
commit 7723f4c5ecdb ("driver core: platform: Add an error message to
platform_get_irq*()") platform_get_irq() produces an error message
orion-mdio f1072004.mdio: IRQ index 0 not found
which is perfectly normal if one hasn't specified the optional property
in the device tree.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Notes:
Changes in v2:
- Add review from Andrew
- Clean up error handling case
drivers/net/ethernet/marvell/mvmdio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 0b9e851f3da4..d2e2dc538428 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -347,7 +347,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
}
- dev->err_interrupt = platform_get_irq(pdev, 0);
+ dev->err_interrupt = platform_get_irq_optional(pdev, 0);
if (dev->err_interrupt > 0 &&
resource_size(r) < MVMDIO_ERR_INT_MASK + 4) {
dev_err(&pdev->dev,
@@ -364,8 +364,8 @@ static int orion_mdio_probe(struct platform_device *pdev)
writel(MVMDIO_ERR_INT_SMI_DONE,
dev->regs + MVMDIO_ERR_INT_MASK);
- } else if (dev->err_interrupt == -EPROBE_DEFER) {
- ret = -EPROBE_DEFER;
+ } else if (dev->err_interrupt < 0) {
+ ret = dev->err_interrupt;
goto out_mdio;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: mvmdio: avoid error message for optional IRQ
2020-03-11 20:05 [PATCH v2] net: mvmdio: avoid error message for optional IRQ Chris Packham
@ 2020-03-12 7:03 ` David Miller
2020-03-16 7:29 ` Chris Packham
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2020-03-12 7:03 UTC (permalink / raw)
To: chris.packham; +Cc: andrew, josua, netdev, linux-kernel
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
Date: Thu, 12 Mar 2020 09:05:46 +1300
> Per the dt-binding the interrupt is optional so use
> platform_get_irq_optional() instead of platform_get_irq(). Since
> commit 7723f4c5ecdb ("driver core: platform: Add an error message to
> platform_get_irq*()") platform_get_irq() produces an error message
>
> orion-mdio f1072004.mdio: IRQ index 0 not found
>
> which is perfectly normal if one hasn't specified the optional property
> in the device tree.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: mvmdio: avoid error message for optional IRQ
2020-03-11 20:05 [PATCH v2] net: mvmdio: avoid error message for optional IRQ Chris Packham
2020-03-12 7:03 ` David Miller
@ 2020-03-16 7:29 ` Chris Packham
2020-03-16 8:38 ` Andrew Lunn
1 sibling, 1 reply; 5+ messages in thread
From: Chris Packham @ 2020-03-16 7:29 UTC (permalink / raw)
To: davem, andrew, josua; +Cc: netdev, linux-kernel
On Thu, 2020-03-12 at 09:05 +1300, Chris Packham wrote:
> Per the dt-binding the interrupt is optional so use
> platform_get_irq_optional() instead of platform_get_irq(). Since
> commit 7723f4c5ecdb ("driver core: platform: Add an error message to
> platform_get_irq*()") platform_get_irq() produces an error message
>
> orion-mdio f1072004.mdio: IRQ index 0 not found
>
> which is perfectly normal if one hasn't specified the optional
> property
> in the device tree.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---
>
> Notes:
> Changes in v2:
> - Add review from Andrew
> - Clean up error handling case
>
> drivers/net/ethernet/marvell/mvmdio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvmdio.c
> b/drivers/net/ethernet/marvell/mvmdio.c
> index 0b9e851f3da4..d2e2dc538428 100644
> --- a/drivers/net/ethernet/marvell/mvmdio.c
> +++ b/drivers/net/ethernet/marvell/mvmdio.c
> @@ -347,7 +347,7 @@ static int orion_mdio_probe(struct
> platform_device *pdev)
> }
>
>
> - dev->err_interrupt = platform_get_irq(pdev, 0);
> + dev->err_interrupt = platform_get_irq_optional(pdev, 0);
> if (dev->err_interrupt > 0 &&
> resource_size(r) < MVMDIO_ERR_INT_MASK + 4) {
> dev_err(&pdev->dev,
> @@ -364,8 +364,8 @@ static int orion_mdio_probe(struct
> platform_device *pdev)
> writel(MVMDIO_ERR_INT_SMI_DONE,
> dev->regs + MVMDIO_ERR_INT_MASK);
>
> - } else if (dev->err_interrupt == -EPROBE_DEFER) {
> - ret = -EPROBE_DEFER;
> + } else if (dev->err_interrupt < 0) {
> + ret = dev->err_interrupt;
> goto out_mdio;
> }
Actually on closer inspection I think this is wrong.
platform_get_irq_optional() will return -ENXIO if the irq is not
specified.
So I think v1 was the correct patch and the extra cleanup in v2 is
wrong.
Dave,
Do you want me to send a revert and re-send v1?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: mvmdio: avoid error message for optional IRQ
2020-03-16 7:29 ` Chris Packham
@ 2020-03-16 8:38 ` Andrew Lunn
2020-03-16 9:32 ` Chris Packham
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2020-03-16 8:38 UTC (permalink / raw)
To: Chris Packham; +Cc: davem, josua, netdev, linux-kernel
> Actually on closer inspection I think this is wrong.
> platform_get_irq_optional() will return -ENXIO if the irq is not
> specified.
The _optional is then pointless. And different to all the other
_optional functions which don't return an error if the property is not
defined.
Are you really sure about this? I don't have the time right now to
check.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: mvmdio: avoid error message for optional IRQ
2020-03-16 8:38 ` Andrew Lunn
@ 2020-03-16 9:32 ` Chris Packham
0 siblings, 0 replies; 5+ messages in thread
From: Chris Packham @ 2020-03-16 9:32 UTC (permalink / raw)
To: andrew; +Cc: davem, netdev, linux-kernel, josua
On Mon, 2020-03-16 at 09:38 +0100, Andrew Lunn wrote:
> > Actually on closer inspection I think this is wrong.
> > platform_get_irq_optional() will return -ENXIO if the irq is not
> > specified.
>
> The _optional is then pointless. And different to all the other
> _optional functions which don't return an error if the property is
> not
> defined.
>
> Are you really sure about this? I don't have the time right now to
> check.
>
Regretabbly yes[1]. It caught me by surprise too. I only noticed when I
went to use a different board that used that driver. I think the
problem is that on some platforms 0 is a valid irq so it can't just be
used to indicate a missing interrupt.
[1] - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/platform.c#n138
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-16 9:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 20:05 [PATCH v2] net: mvmdio: avoid error message for optional IRQ Chris Packham
2020-03-12 7:03 ` David Miller
2020-03-16 7:29 ` Chris Packham
2020-03-16 8:38 ` Andrew Lunn
2020-03-16 9:32 ` Chris Packham
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.