diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-02-02 12:19:32 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-02-07 10:00:29 +0100 |
commit | 92489ea9cce3b892d3deefe21cfa2cf1a4f870ac (patch) | |
tree | ed98c49696f30fe082cc40cc3606dee637aa825d /include | |
parent | e4a7f8e21cc55e633ca7997819d8ebdb94d305af (diff) | |
download | barebox-92489ea9cce3b892d3deefe21cfa2cf1a4f870ac.tar.gz barebox-92489ea9cce3b892d3deefe21cfa2cf1a4f870ac.tar.xz |
state: add deep probe aware helpers to get state
state_by_name itself can't be made deep probe aware as it doesn't have
enough information on what to probe. Board code calling it must instead
itself ensure that the state has been proved (either via initcall
ordering or by calling e.g. of_ensure_probed_by_alias). For
state_by_node we can do it better: We can ensure probe of the supplied
device node. For most purposes, users just want to probe the default
state. This can now be done with state_by_alias("state").
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220202111932.1227416-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/state.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/state.h b/include/state.h index be1b592576..bffcd5a900 100644 --- a/include/state.h +++ b/include/state.h @@ -12,7 +12,8 @@ struct state *state_new_from_node(struct device_node *node, bool readonly); void state_release(struct state *state); struct state *state_by_name(const char *name); -struct state *state_by_node(const struct device_node *node); +struct state *state_by_node(struct device_node *node); +struct state *state_by_alias(const char *alias); int state_load_no_auth(struct state *state); int state_load(struct state *state); @@ -34,10 +35,15 @@ static inline struct state *state_by_name(const char *name) return NULL; } -static inline struct state *state_by_node(const struct device_node *node) +static inline struct state *state_by_node(struct device_node *node) { return NULL; -}; +} + +static inline struct state *state_by_alias(const char *alias) +{ + return NULL; +} static inline int state_load(struct state *state) { |