* [PATCH 1/3] state: pass error code instead of inventing new one
@ 2016-10-20 7:31 Sascha Hauer
2016-10-20 7:31 ` [PATCH 2/3] state: driver: handle EPROBE_DEFER Sascha Hauer
2016-10-20 7:31 ` [PATCH 3/3] of_path: handle no driver for device Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2016-10-20 7:31 UTC (permalink / raw)
To: Barebox List
Both of_find_path() and of_find_path_by_node() return a meaningful
error code, so forward it instead of inventing a new one. Do this
especially for the -EPROBE_DEFER case which currently does not work.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/state/state.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/common/state/state.c b/common/state/state.c
index 075618e..2be3c8c 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -466,9 +466,10 @@ struct state *state_new_from_node(struct device_node *node, char *path,
of_path = partition_node->full_name;
ret = of_find_path_by_node(partition_node, &path, 0);
}
- if (!path) {
- pr_err("state failed to parse path to backend\n");
- ret = -EINVAL;
+ if (ret) {
+ if (ret != -EPROBE_DEFER)
+ pr_err("state failed to parse path to backend: %s\n",
+ strerror(-ret));
goto out_release_state;
}
}
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] state: driver: handle EPROBE_DEFER
2016-10-20 7:31 [PATCH 1/3] state: pass error code instead of inventing new one Sascha Hauer
@ 2016-10-20 7:31 ` Sascha Hauer
2016-10-20 7:31 ` [PATCH 3/3] of_path: handle no driver for device Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2016-10-20 7:31 UTC (permalink / raw)
To: Barebox List
When state_new_from_node() returns -ENODEV that means that there
is no device available for the node, so return -EPROBE_DEFER in this
case and hope a device is there later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/misc/state.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/state.c b/drivers/misc/state.c
index b9eb1b7..b43aee6 100644
--- a/drivers/misc/state.c
+++ b/drivers/misc/state.c
@@ -28,8 +28,12 @@ static int state_probe(struct device_d *dev)
bool readonly = false;
state = state_new_from_node(np, NULL, 0, 0, readonly);
- if (IS_ERR(state))
- return PTR_ERR(state);
+ if (IS_ERR(state)) {
+ int ret = PTR_ERR(state);
+ if (ret == -ENODEV)
+ ret = -EPROBE_DEFER;
+ return ret;
+ }
return 0;
}
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] of_path: handle no driver for device
2016-10-20 7:31 [PATCH 1/3] state: pass error code instead of inventing new one Sascha Hauer
2016-10-20 7:31 ` [PATCH 2/3] state: driver: handle EPROBE_DEFER Sascha Hauer
@ 2016-10-20 7:31 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2016-10-20 7:31 UTC (permalink / raw)
To: Barebox List
in __of_find_path it can happen that there is a device, but there
is no driver for this device because it hasn't been probed yet.
Return -ENODEV in this case to let the caller know that it has to
try later again.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/of/of_path.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index 8e1931f..12a7c02 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -61,6 +61,9 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
return -ENODEV;
}
+ if (!dev->driver)
+ return -ENODEV;
+
device_detect(dev);
if (part)
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-20 7:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 7:31 [PATCH 1/3] state: pass error code instead of inventing new one Sascha Hauer
2016-10-20 7:31 ` [PATCH 2/3] state: driver: handle EPROBE_DEFER Sascha Hauer
2016-10-20 7:31 ` [PATCH 3/3] of_path: handle no driver for device Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox