From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] reset_source: use instance = -1 as default
Date: Sun, 25 Aug 2019 16:55:16 +0200 [thread overview]
Message-ID: <20190825145517.5546-1-u.kleine-koenig@pengutronix.de> (raw)
As with platform device id (does someone still remember?) 0 might be a valid
id. So use -1 for "unknown" or "doesn't apply" instead of 0.
Also don't pass the instance to the device tree if negative. (This ends
up as 0xffffffff otherwise.)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
common/oftree.c | 5 +++--
common/reset_source.c | 2 +-
include/reset_source.h | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/common/oftree.c b/common/oftree.c
index 5bb5420a785b..28a3b965ffee 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -144,6 +144,7 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
struct device_node *node;
const char *str;
int err;
+ int instance = reset_source_get_instance();
str = linux_bootargs_get();
if (!str)
@@ -160,8 +161,8 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
return err;
of_property_write_string(node, "reset-source", reset_source_name());
- of_property_write_u32(node, "reset-source-instance",
- reset_source_get_instance());
+ if (instance >= 0)
+ of_property_write_u32(node, "reset-source-instance", instance);
return of_fixup_bootargs_bootsource(root, node);
}
diff --git a/common/reset_source.c b/common/reset_source.c
index 1955d3f87e33..e24aa337a7c4 100644
--- a/common/reset_source.c
+++ b/common/reset_source.c
@@ -54,7 +54,7 @@ void reset_source_set_priority(enum reset_src_type st, unsigned int priority)
reset_source = st;
reset_source_priority = priority;
- reset_source_instance = 0;
+ reset_source_instance = -1;
pr_debug("Setting reset source to %s with priority %d\n",
reset_src_names[reset_source], priority);
diff --git a/include/reset_source.h b/include/reset_source.h
index 13bc3bcfde7c..2848a91115b8 100644
--- a/include/reset_source.h
+++ b/include/reset_source.h
@@ -49,7 +49,7 @@ static inline enum reset_src_type reset_source_get(void)
static inline int reset_source_get_instance(void)
{
- return 0;
+ return -1;
}
static inline unsigned int of_get_reset_source_priority(struct device_node *node)
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2019-08-25 14:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-25 14:55 Uwe Kleine-König [this message]
2019-08-25 14:55 ` [PATCH 2/2] reset_source: drop reset_source_set_instance() Uwe Kleine-König
2019-08-26 19:24 ` Andrey Smirnov
2019-08-26 20:12 ` Uwe Kleine-König
2019-08-27 4:52 ` Andrey Smirnov
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=20190825145517.5546-1-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@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