mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Larsson <andreas@gaisler.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	devicetree-discuss@lists.ozlabs.org,
	spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, software@gaisler.com
Subject: [PATCH v2 1/6] of: Return -EEXIST from of_parse_phandle_with_args for holes in phandle list
Date: Tue, 29 Jan 2013 15:53:38 +0100	[thread overview]
Message-ID: <1359471223-4794-2-git-send-email-andreas@gaisler.com> (raw)
In-Reply-To: <1359471223-4794-1-git-send-email-andreas@gaisler.com>

Return value for an empty phandle was -EEXIST before commit 15c9a0ac, that
changed the return value in this case to -ENOENT. However, of_gpio_named_count
relies upon the return value to be -EEXIST and relies upon being able to
distinguish this case from the case of no list at all which also returns
-ENOENT.

Also change the of selftest to expect -EEXIST in this case.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---

I have only compile tested the selftest, not having appropriate hardware around for running it.

 drivers/of/base.c     |    4 ++--
 drivers/of/selftest.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 2390ddb..986afd7 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1083,11 +1083,11 @@ int of_parse_phandle_with_args(const struct device_node *np, const char *list_na
 		 * All of the error cases above bail out of the loop, so at
 		 * this point, the parsing is successful. If the requested
 		 * index matches, then fill the out_args structure and return,
-		 * or return -ENOENT for an empty entry.
+		 * or return -EEXIST for an empty entry.
 		 */
 		if (cur_index == index) {
 			if (!phandle)
-				return -ENOENT;
+				return -EEXIST;
 
 			if (out_args) {
 				int i;
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c
index f24ffd7..b1c2ae9 100644
--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -54,7 +54,7 @@ static void __init of_selftest_parse_phandle_with_args(void)
 			passed &= (args.args[1] == 0);
 			break;
 		case 2:
-			passed &= (rc == -ENOENT);
+			passed &= (rc == -EEXIST);
 			break;
 		case 3:
 			passed &= !rc;
-- 
1.7.0.4


  reply	other threads:[~2013-01-29 14:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 14:53 [PATCH v2 0/6] of, of_gpio, of_spi: Bugfix and improve of_parse_phandle_with_args, of_gpio_named_count and of_spi_register_master Andreas Larsson
2013-01-29 14:53 ` Andreas Larsson [this message]
2013-01-29 14:53 ` [PATCH v2 2/6] of: Return -ENXIO from of_parse_phandle_with_args for too large index and return errors from of_gpio_named_count Andreas Larsson
2013-02-01  9:37   ` Linus Walleij
2013-02-10 23:56   ` Grant Likely
2013-01-29 14:53 ` [PATCH v2 3/6] of_spi: Initialize cs_gpios properly Andreas Larsson
2013-02-11  0:00   ` Grant Likely
2013-01-29 14:53 ` [PATCH v2 4/6] of_spi: Document cs_gpios and cs_gpio in kernel-doc Andreas Larsson
2013-02-11  0:06   ` Grant Likely
2013-01-29 14:53 ` [PATCH v2 5/6] of_spi: Add fetching of of_gpio flags to of_spi_register_master Andreas Larsson
2013-02-11  0:22   ` Grant Likely
2013-02-12  9:39     ` Andreas Larsson
2013-02-12 17:09       ` Grant Likely
2013-01-29 14:53 ` [PATCH v2 6/6] of_spi: Initialize cs_gpios and cs_gpio with -EEXIST Andreas Larsson
2013-02-11  0:23   ` Grant Likely
2013-02-12  9:46     ` Andreas Larsson
2013-02-12 18:01       ` Grant Likely

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=1359471223-4794-2-git-send-email-andreas@gaisler.com \
    --to=andreas@gaisler.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=software@gaisler.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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®