linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: unittest: Use platform_get_irq_optional() for non-existing interrupt
@ 2019-10-16 14:31 Geert Uytterhoeven
  2019-10-16 23:23 ` Stephen Boyd
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-10-16 14:31 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand
  Cc: Stephen Boyd, devicetree, linux-kernel, Geert Uytterhoeven

As platform_get_irq() now prints an error when the interrupt
does not exist, a scary warning may be printed for a non-existing
interrupt:

    platform testcase-data:testcase-device2: IRQ index 0 not found

Fix this by calling platform_get_irq_optional() instead.

Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is a fix for v5.4.
---
 drivers/of/unittest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 9efae29722588a35..34da22f8b0660989 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1121,7 +1121,7 @@ static void __init of_unittest_platform_populate(void)
 		np = of_find_node_by_path("/testcase-data/testcase-device2");
 		pdev = of_find_device_by_node(np);
 		unittest(pdev, "device 2 creation failed\n");
-		irq = platform_get_irq(pdev, 0);
+		irq = platform_get_irq_optional(pdev, 0);
 		unittest(irq < 0 && irq != -EPROBE_DEFER,
 			 "device parsing error failed - %d\n", irq);
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] of: unittest: Use platform_get_irq_optional() for non-existing interrupt
  2019-10-16 14:31 [PATCH] of: unittest: Use platform_get_irq_optional() for non-existing interrupt Geert Uytterhoeven
@ 2019-10-16 23:23 ` Stephen Boyd
  2019-10-17  6:59   ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2019-10-16 23:23 UTC (permalink / raw)
  To: Frank Rowand, Geert Uytterhoeven, Rob Herring
  Cc: devicetree, linux-kernel, Geert Uytterhoeven

Quoting Geert Uytterhoeven (2019-10-16 07:31:42)
> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> index 9efae29722588a35..34da22f8b0660989 100644
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -1121,7 +1121,7 @@ static void __init of_unittest_platform_populate(void)
>                 np = of_find_node_by_path("/testcase-data/testcase-device2");
>                 pdev = of_find_device_by_node(np);
>                 unittest(pdev, "device 2 creation failed\n");
> -               irq = platform_get_irq(pdev, 0);
> +               irq = platform_get_irq_optional(pdev, 0);
>                 unittest(irq < 0 && irq != -EPROBE_DEFER,

This is a test to make sure that irq failure doesn't return probe defer.
Do we want to silence the error message that we're expecting to see?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] of: unittest: Use platform_get_irq_optional() for non-existing interrupt
  2019-10-16 23:23 ` Stephen Boyd
@ 2019-10-17  6:59   ` Geert Uytterhoeven
  2019-10-17 12:51     ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-10-17  6:59 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Frank Rowand, Geert Uytterhoeven, Rob Herring,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

Hi Stephen,

On Thu, Oct 17, 2019 at 1:23 AM Stephen Boyd <swboyd@chromium.org> wrote:
> Quoting Geert Uytterhoeven (2019-10-16 07:31:42)
> > diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> > index 9efae29722588a35..34da22f8b0660989 100644
> > --- a/drivers/of/unittest.c
> > +++ b/drivers/of/unittest.c
> > @@ -1121,7 +1121,7 @@ static void __init of_unittest_platform_populate(void)
> >                 np = of_find_node_by_path("/testcase-data/testcase-device2");
> >                 pdev = of_find_device_by_node(np);
> >                 unittest(pdev, "device 2 creation failed\n");
> > -               irq = platform_get_irq(pdev, 0);
> > +               irq = platform_get_irq_optional(pdev, 0);
> >                 unittest(irq < 0 && irq != -EPROBE_DEFER,
>
> This is a test to make sure that irq failure doesn't return probe defer.
> Do we want to silence the error message that we're expecting to see?

I think so.  We're not interested in error messages for expected failures,
only in error messages for unittest() failures.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] of: unittest: Use platform_get_irq_optional() for non-existing interrupt
  2019-10-17  6:59   ` Geert Uytterhoeven
@ 2019-10-17 12:51     ` Rob Herring
  2019-10-17 17:17       ` Frank Rowand
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2019-10-17 12:51 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Stephen Boyd, Frank Rowand, Geert Uytterhoeven,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

On Thu, Oct 17, 2019 at 1:59 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Stephen,
>
> On Thu, Oct 17, 2019 at 1:23 AM Stephen Boyd <swboyd@chromium.org> wrote:
> > Quoting Geert Uytterhoeven (2019-10-16 07:31:42)
> > > diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> > > index 9efae29722588a35..34da22f8b0660989 100644
> > > --- a/drivers/of/unittest.c
> > > +++ b/drivers/of/unittest.c
> > > @@ -1121,7 +1121,7 @@ static void __init of_unittest_platform_populate(void)
> > >                 np = of_find_node_by_path("/testcase-data/testcase-device2");
> > >                 pdev = of_find_device_by_node(np);
> > >                 unittest(pdev, "device 2 creation failed\n");
> > > -               irq = platform_get_irq(pdev, 0);
> > > +               irq = platform_get_irq_optional(pdev, 0);
> > >                 unittest(irq < 0 && irq != -EPROBE_DEFER,
> >
> > This is a test to make sure that irq failure doesn't return probe defer.
> > Do we want to silence the error message that we're expecting to see?
>
> I think so.  We're not interested in error messages for expected failures,
> only in error messages for unittest() failures.

The unittests start with a warning that error messages will be seen.
OTOH, we didn't get a message here before.

Rob

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] of: unittest: Use platform_get_irq_optional() for non-existing interrupt
  2019-10-17 12:51     ` Rob Herring
@ 2019-10-17 17:17       ` Frank Rowand
  0 siblings, 0 replies; 5+ messages in thread
From: Frank Rowand @ 2019-10-17 17:17 UTC (permalink / raw)
  To: Rob Herring, Geert Uytterhoeven
  Cc: Stephen Boyd, Geert Uytterhoeven,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Linux Kernel Mailing List

On 10/17/2019 07:51, Rob Herring wrote:
> On Thu, Oct 17, 2019 at 1:59 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>
>> Hi Stephen,
>>
>> On Thu, Oct 17, 2019 at 1:23 AM Stephen Boyd <swboyd@chromium.org> wrote:
>>> Quoting Geert Uytterhoeven (2019-10-16 07:31:42)
>>>> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
>>>> index 9efae29722588a35..34da22f8b0660989 100644
>>>> --- a/drivers/of/unittest.c
>>>> +++ b/drivers/of/unittest.c
>>>> @@ -1121,7 +1121,7 @@ static void __init of_unittest_platform_populate(void)
>>>>                 np = of_find_node_by_path("/testcase-data/testcase-device2");
>>>>                 pdev = of_find_device_by_node(np);
>>>>                 unittest(pdev, "device 2 creation failed\n");
>>>> -               irq = platform_get_irq(pdev, 0);
>>>> +               irq = platform_get_irq_optional(pdev, 0);
>>>>                 unittest(irq < 0 && irq != -EPROBE_DEFER,
>>>
>>> This is a test to make sure that irq failure doesn't return probe defer.
>>> Do we want to silence the error message that we're expecting to see?

No, we do not want to silence an error message that we are expecting to see.


>>
>> I think so.  We're not interested in error messages for expected failures,
>> only in error messages for unittest() failures.

platform_get_irq() is precisely the function that we are trying to test here.


> 
> The unittests start with a warning that error messages will be seen.
> OTOH, we didn't get a message here before.
Getting error messages from places outside of unittest.c is just the
nature of the devicetree selftest beast.

-Frank

> 
> Rob
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-17 17:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 14:31 [PATCH] of: unittest: Use platform_get_irq_optional() for non-existing interrupt Geert Uytterhoeven
2019-10-16 23:23 ` Stephen Boyd
2019-10-17  6:59   ` Geert Uytterhoeven
2019-10-17 12:51     ` Rob Herring
2019-10-17 17:17       ` Frank Rowand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).