mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: barebox@lists.infradead.org
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: [PATCH v2 3/8] state: make use of of_find_path_by_phandle() and add return -EPROBE_DEFER if device is not available
Date: Tue, 20 Oct 2015 10:39:07 +0200	[thread overview]
Message-ID: <1445330352-30153-4-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1445330352-30153-1-git-send-email-mkl@pengutronix.de>

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/misc/state.c | 37 ++++++++-----------------------------
 1 file changed, 8 insertions(+), 29 deletions(-)

diff --git a/drivers/misc/state.c b/drivers/misc/state.c
index f3e366480fa2..4cda55b6efc6 100644
--- a/drivers/misc/state.c
+++ b/drivers/misc/state.c
@@ -24,7 +24,6 @@
 static int state_probe(struct device_d *dev)
 {
 	struct device_node *np = dev->device_node;
-	struct device_node *partition_node;
 	struct state *state;
 	const char *alias;
 	const char *backend_type = NULL;
@@ -50,35 +49,15 @@ static int state_probe(struct device_d *dev)
 	}
 
 	/* guess if of_path is a path, not a phandle */
-	if (of_path[0] == '/' && len > 1) {
+	if (of_path[0] == '/' && len > 1)
 		ret = of_find_path(np, "backend", &path, 0);
-		if (ret)
-			goto out_release;
-	} else {
-		struct device_d *dev;
-		struct cdev *cdev;
-
-		partition_node = of_parse_phandle(np, "backend", 0);
-		if (!partition_node) {
-			ret = -ENODEV;
-			goto out_release;
-		}
-
-		dev = of_find_device_by_node(partition_node);
-		if (!list_is_singular(&dev->cdevs)) {
-			ret = -ENODEV;
-			goto out_release;
-		}
-
-		cdev = list_first_entry(&dev->cdevs, struct cdev, devices_list);
-		if (!cdev) {
-			ret = -ENODEV;
-			goto out_release;
-		}
-
-		path = asprintf("/dev/%s", cdev->name);
-		of_path = partition_node->full_name;
-	}
+	else
+		ret = of_find_path_by_phandle(np, "backend", &path, 0);
+
+	if (ret == -ENODEV)
+		ret = -EPROBE_DEFER;
+	if (ret)
+		goto out_release;
 
 	ret = of_property_read_string(np, "backend-type", &backend_type);
 	if (ret) {
-- 
2.6.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-10-20  8:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  8:39 [PATCH v2 1/8] state framework enhancements Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 1/8] of_path: of_find_path() factor out device detection logic into separate function Marc Kleine-Budde
2015-10-21  6:24   ` Sascha Hauer
2015-12-10 22:38   ` Trent Piepho
2015-12-11  0:07     ` [PATCH] of_path: Fix bug with partitions, simply code Trent Piepho
2015-12-11  9:35       ` Sascha Hauer
2015-12-11 18:51         ` Trent Piepho
2015-12-16 10:43       ` Sascha Hauer
2015-10-20  8:39 ` [PATCH v2 2/8] of_path: add of_find_path_by_phandle() Marc Kleine-Budde
2015-10-20  8:39 ` Marc Kleine-Budde [this message]
2015-10-20  8:39 ` [PATCH v2 4/8] state: use name of device node as name if alias is not available Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 5/8] state: disable load command Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 6/8] crypto: add simple keystore Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 7/8] state: prepare raw backend for hmac support Marc Kleine-Budde
2015-10-20  8:39 ` [PATCH v2 8/8] state: backend_raw: add hamc support Marc Kleine-Budde
2015-10-20  9:49   ` Jan Lübbe
2015-10-21  7:13   ` Sascha Hauer
2015-10-21  8:56     ` Marc Kleine-Budde
2015-10-21  9:12       ` Sascha Hauer

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=1445330352-30153-4-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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