From: Grant Likely <grant.likely@linaro.org>
To: Rob Herring <robherring2@gmail.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Cc: Rob Herring <robh@kernel.org>
Subject: Re: [PATCH] of/selftest: clean-up of_selftest_platform_populate pass/fail handling
Date: Wed, 14 May 2014 12:10:01 +0100 [thread overview]
Message-ID: <20140514111001.4233CC4153D@trevor.secretlab.ca> (raw)
In-Reply-To: <1399997908-30916-1-git-send-email-robherring2@gmail.com>
On Tue, 13 May 2014 11:18:28 -0500, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <robh@kernel.org>
>
> Move the pass/fail checks into selftest() calls instead of a separate if
> condition. Unconditionally calling pass was wrong.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Grant Likely <grant.likely@linaro.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
> ---
> drivers/of/selftest.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c
> index fe70b86..c1d7d38 100644
> --- a/drivers/of/selftest.c
> +++ b/drivers/of/selftest.c
> @@ -440,22 +440,18 @@ static void __init of_selftest_platform_populate(void)
> /* Test that a missing irq domain returns -EPROBE_DEFER */
> np = of_find_node_by_path("/testcase-data/testcase-device1");
> pdev = of_find_device_by_node(np);
> - if (!pdev)
> - selftest(0, "device 1 creation failed\n");
> + selftest(pdev, "device 1 creation failed\n");
> +
> irq = platform_get_irq(pdev, 0);
> - if (irq != -EPROBE_DEFER)
> - selftest(0, "device deferred probe failed - %d\n", irq);
> + selftest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq);
>
> /* Test that a parsing failure does not return -EPROBE_DEFER */
> np = of_find_node_by_path("/testcase-data/testcase-device2");
> pdev = of_find_device_by_node(np);
> - if (!pdev)
> - selftest(0, "device 2 creation failed\n");
> + selftest(pdev, "device 2 creation failed\n");
> irq = platform_get_irq(pdev, 0);
> - if (irq >= 0 || irq == -EPROBE_DEFER)
> - selftest(0, "device parsing error failed - %d\n", irq);
> + selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq);
>
> - selftest(1, "passed");
> }
>
> static int __init of_selftest(void)
> --
> 1.9.1
>
prev parent reply other threads:[~2014-05-14 11:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 16:18 Rob Herring
2014-05-14 11:10 ` Grant Likely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140514111001.4233CC4153D@trevor.secretlab.ca \
--to=grant.likely@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=robherring2@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®