mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Daniel Schultz <d.schultz@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/5] common: state: Make find_var public
Date: Fri, 27 Oct 2017 16:37:31 +0200	[thread overview]
Message-ID: <1509115052-4331-4-git-send-email-d.schultz@phytec.de> (raw)
In-Reply-To: <1509115052-4331-1-git-send-email-d.schultz@phytec.de>

Make find_var public to grant access to state variables.

Make also the MAC node public to receive the stored address.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 common/state/state.h | 27 +--------------------------
 include/state.h      | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/common/state/state.h b/common/state/state.h
index 81aaec2..0fca848 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -1,6 +1,7 @@
 #include <linux/types.h>
 #include <linux/list.h>
 #include <driver.h>
+#include <state.h>
 
 struct state;
 struct mtd_info_user;
@@ -128,16 +129,6 @@ struct variable_type {
 					  struct device_node *);
 };
 
-/* instance of a single variable */
-struct state_variable {
-	struct state *state;
-	struct list_head list;
-	const char *name;
-	unsigned int start;
-	unsigned int size;
-	void *raw;
-};
-
 /*
  *  uint32
  */
@@ -161,16 +152,6 @@ struct state_enum32 {
 };
 
 /*
- *  MAC address
- */
-struct state_mac {
-	struct state_variable var;
-	struct param_d *param;
-	uint8_t value[6];
-	uint8_t value_default[6];
-};
-
-/*
  *  string
  */
 struct state_string {
@@ -204,7 +185,6 @@ int state_backend_bucket_circular_create(struct device_d *dev, const char *path,
 int state_backend_bucket_cached_create(struct device_d *dev,
 				       struct state_backend_storage_bucket *raw,
 				       struct state_backend_storage_bucket **out);
-struct state_variable *state_find_var(struct state *state, const char *name);
 struct digest *state_backend_format_raw_get_digest(struct state_backend_format
 						   *format);
 void state_backend_set_readonly(struct state *state);
@@ -229,11 +209,6 @@ static inline struct state_enum32 *to_state_enum32(struct state_variable *s)
 	return container_of(s, struct state_enum32, var);
 }
 
-static inline struct state_mac *to_state_mac(struct state_variable *s)
-{
-	return container_of(s, struct state_mac, var);
-}
-
 static inline struct state_string *to_state_string(struct state_variable *s)
 {
 	return container_of(s, struct state_string, var);
diff --git a/include/state.h b/include/state.h
index 63164f9..ae67d95 100644
--- a/include/state.h
+++ b/include/state.h
@@ -5,6 +5,30 @@
 
 struct state;
 
+/* instance of a single variable */
+struct state_variable {
+	struct state *state;
+	struct list_head list;
+	const char *name;
+	unsigned int start;
+	unsigned int size;
+	void *raw;
+};
+
+/*
+ *  MAC address
+ */
+struct state_mac {
+	struct state_variable var;
+	struct param_d *param;
+	uint8_t value[6];
+	uint8_t value_default[6];
+};
+static inline struct state_mac *to_state_mac(struct state_variable *s)
+{
+	return container_of(s, struct state_mac, var);
+}
+
 int state_backend_dtb_file(struct state *state, const char *of_path,
 		const char *path);
 int state_backend_raw_file(struct state *state, const char *of_path,
@@ -23,4 +47,6 @@ int state_load(struct state *state);
 int state_save(struct state *state);
 void state_info(void);
 
+struct state_variable *state_find_var(struct state *state, const char *name);
+
 #endif /* __STATE_H */
-- 
2.7.4


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

  parent reply	other threads:[~2017-10-27 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27 14:37 [PATCH 1/5] ARM: boards: phytec-som-am335x: Add unified MLO Daniel Schultz
2017-10-27 14:37 ` [PATCH 2/5] ARM: dts: AM335x: Add state framework Daniel Schultz
2017-10-27 14:37 ` [PATCH 3/5] ARM: configs: am335x_defconfig: Add state config Daniel Schultz
2017-10-27 14:37 ` Daniel Schultz [this message]
2017-11-01  7:53   ` [PATCH 4/5] common: state: Make find_var public Sascha Hauer
2017-10-27 14:37 ` [PATCH 5/5] ARM: phytec-som-am335x: Set MAC addresses from state Daniel Schultz

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=1509115052-4331-4-git-send-email-d.schultz@phytec.de \
    --to=d.schultz@phytec.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