mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 4/7] common: state: harmonize code with dt-utils
Date: Fri,  8 Feb 2019 08:15:23 +0100	[thread overview]
Message-ID: <20190208071526.19150-5-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20190208071526.19150-1-u.oelmann@pengutronix.de>

Other than in barebox the offset and size of a state's backend device do not
necessarily equal zero in Linux userspace (EEPROMs & block devices), so barebox'
and dt-utils' state code differ here.

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 common/state/state.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/state/state.c b/common/state/state.c
index d3e048b99078..3f5d43ecbf73 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -596,6 +596,8 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 	const char *alias;
 	uint32_t stridesize;
 	struct device_node *partition_node;
+	off_t offset = 0;
+	size_t size = 0;
 
 	alias = of_alias_get(node);
 	if (!alias) {
@@ -614,7 +616,11 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 		goto out_release_state;
 	}
 
+#ifdef __BAREBOX__
 	ret = of_find_path_by_node(partition_node, &state->backend_path, 0);
+#else
+	ret = of_get_devicepath(partition_node, &state->backend_path, &offset, &size);
+#endif
 	if (ret) {
 		if (ret != -EPROBE_DEFER)
 			dev_err(&state->dev, "state failed to parse path to backend: %s\n",
@@ -645,8 +651,8 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 	if (ret)
 		goto out_release_state;
 
-	ret = state_storage_init(state, state->backend_path, 0,
-				 0, stridesize, storage_type);
+	ret = state_storage_init(state, state->backend_path, offset,
+				 size, stridesize, storage_type);
 	if (ret)
 		goto out_release_state;
 
-- 
2.20.1


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

  parent reply	other threads:[~2019-02-08  7:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  7:15 [PATCH 0/7] Harmonize barebox' and dt-utils' state code Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 1/7] common: state: fix compiler warnings about wrong type conversion in messages Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 2/7] common: state: fix formatting of "off_t" variables Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 3/7] common: state: fix formatting of "uint32_t" variables Ulrich Ölmann
2019-02-08  7:15 ` Ulrich Ölmann [this message]
2019-02-08  7:15 ` [PATCH 5/7] common: state: harmonize code with dt-utils Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 6/7] " Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 7/7] " Ulrich Ölmann
2019-02-11  8:12 ` [PATCH 0/7] Harmonize barebox' and dt-utils' state code 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=20190208071526.19150-5-u.oelmann@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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