mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: barebox@lists.infradead.org
Subject: [PATCH v2 22/22] OF: base: cleanup base function include
Date: Wed, 19 Jun 2013 11:09:51 +0200	[thread overview]
Message-ID: <1371632991-1504-23-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1371576607-8090-1-git-send-email-sebastian.hesselbarth@gmail.com>

This cleans up include/of.h by moving some function prototypes below
CONFIG_OFTREE and provide bogus stubs for !CONFIG_OFTREE.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: barebox@lists.infradead.org
---
 include/of.h |  138 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 109 insertions(+), 29 deletions(-)

diff --git a/include/of.h b/include/of.h
index c61d002..b392ca9 100644
--- a/include/of.h
+++ b/include/of.h
@@ -71,15 +71,10 @@ int of_match(struct device_d *dev, struct driver_d *drv);
 int of_add_initrd(struct device_node *root, resource_size_t start,
 		resource_size_t end);
 
-int of_n_addr_cells(struct device_node *np);
-int of_n_size_cells(struct device_node *np);
-
 struct fdt_header *fdt_get_tree(void);
 
 struct fdt_header *of_get_fixed_tree(struct device_node *node);
 
-int of_modalias_node(struct device_node *node, char *modalias, int len);
-
 /* Helper to read a big number; size is in cells (not bytes) */
 static inline u64 of_read_number(const __be32 *cell, int size)
 {
@@ -100,21 +95,12 @@ static inline void of_write_number(void *__cell, u64 val, int size)
 	}
 }
 
-const void *of_get_property(const struct device_node *np, const char *name,
-			 int *lenp);
-
 int of_get_named_gpio(struct device_node *np,
                                    const char *propname, int index);
 
-struct device_node *of_find_node_by_phandle(phandle phandle);
 void of_print_property(const void *data, int len);
 void of_print_cmdline(struct device_node *root);
 
-int of_device_is_compatible(const struct device_node *device,
-		const char *compat);
-
-int of_machine_is_compatible(const char *compat);
-
 u64 of_translate_address(struct device_node *node, const __be32 *in_addr);
 
 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
@@ -123,41 +109,51 @@ u64 of_translate_address(struct device_node *node, const __be32 *in_addr);
 void of_print_nodes(struct device_node *node, int indent);
 int of_probe(void);
 int of_parse_dtb(struct fdt_header *fdt);
-void of_free(struct device_node *node);
 struct device_node *of_unflatten_dtb(struct device_node *root, void *fdt);
-struct device_node *of_new_node(struct device_node *parent, const char *name);
-struct property *of_new_property(struct device_node *node, const char *name,
-		const void *data, int len);
-void of_delete_property(struct property *pp);
-
-int of_set_property(struct device_node *node, const char *p, const void *val, int len,
-		int create);
-struct device_node *of_create_node(struct device_node *root, const char *path);
-
-int of_set_root_node(struct device_node *);
-
-const struct of_device_id *of_match_node(const struct of_device_id *matches,
-					 const struct device_node *node);
 
 struct cdev;
 
 #ifdef CONFIG_OFTREE
+extern int of_n_addr_cells(struct device_node *np);
+extern int of_n_size_cells(struct device_node *np);
+
 extern struct property *of_find_property(const struct device_node *np,
 					const char *name, int *lenp);
+extern const void *of_get_property(const struct device_node *np,
+				const char *name, int *lenp);
+
+extern int of_set_property(struct device_node *node, const char *p,
+			const void *val, int len, int create);
+extern struct property *of_new_property(struct device_node *node,
+				const char *name, const void *data, int len);
+extern void of_delete_property(struct property *pp);
 
 extern struct device_node *of_find_node_by_name(struct device_node *from,
 	const char *name);
 extern struct device_node *of_find_node_by_path_from(struct device_node *from,
 						const char *path);
 extern struct device_node *of_find_node_by_path(const char *path);
+extern struct device_node *of_find_node_by_phandle(phandle phandle);
 extern struct device_node *of_find_compatible_node(struct device_node *from,
 	const char *type, const char *compat);
+extern const struct of_device_id *of_match_node(
+	const struct of_device_id *matches, const struct device_node *node);
 extern struct device_node *of_find_matching_node_and_match(
 	struct device_node *from,
 	const struct of_device_id *matches,
 	const struct of_device_id **match);
 extern struct device_node *of_find_node_with_property(
 	struct device_node *from, const char *prop_name);
+
+extern struct device_node *of_new_node(struct device_node *parent,
+				const char *name);
+extern struct device_node *of_create_node(struct device_node *root,
+					const char *path);
+extern void of_free(struct device_node *node);
+
+extern int of_machine_is_compatible(const char *compat);
+extern int of_device_is_compatible(const struct device_node *device,
+		const char *compat);
 extern int of_device_is_available(const struct device_node *device);
 
 extern struct device_node *of_get_parent(const struct device_node *node);
@@ -225,6 +221,10 @@ extern int of_count_phandle_with_args(const struct device_node *np,
 extern void of_alias_scan(void);
 extern int of_alias_get_id(struct device_node *np, const char *stem);
 extern const char *of_alias_get(struct device_node *np);
+extern int of_modalias_node(struct device_node *node, char *modalias, int len);
+
+extern struct device_node *of_get_root_node(void);
+extern int of_set_root_node(struct device_node *node);
 
 int of_parse_partitions(struct cdev *cdev, struct device_node *node);
 int of_device_is_stdout_path(struct device_d *dev);
@@ -233,7 +233,6 @@ void *of_flatten_dtb(struct device_node *node);
 int of_add_memory(struct device_node *node, bool dump);
 void of_add_memory_bank(struct device_node *node, bool dump, int r,
 		u64 base, u64 size);
-struct device_node *of_get_root_node(void);
 #else
 static inline int of_parse_partitions(struct cdev *cdev,
 					  struct device_node *node)
@@ -266,6 +265,21 @@ static inline struct device_node *of_get_root_node(void)
 	return NULL;
 }
 
+static inline int of_set_root_node(struct device_node *node)
+{
+	return -ENOSYS;
+}
+
+static inline int of_n_addr_cells(struct device_node *np)
+{
+	return 0;
+}
+
+static inline int of_n_size_cells(struct device_node *np)
+{
+	return 0;
+}
+
 static inline struct device_node *of_get_parent(const struct device_node *node)
 {
 	return NULL;
@@ -300,6 +314,28 @@ static inline struct property *of_find_property(const struct device_node *np,
 	return NULL;
 }
 
+static inline const void *of_get_property(const struct device_node *np,
+				const char *name, int *lenp)
+{
+	return NULL;
+}
+
+static inline int of_set_property(struct device_node *node, const char *p,
+			const void *val, int len, int create)
+{
+	return -ENOSYS;
+}
+
+static inline struct property *of_new_property(struct device_node *node,
+				const char *name, const void *data, int len)
+{
+	return NULL;
+}
+
+static inline void of_delete_property(struct property *pp)
+{
+}
+
 static inline int of_property_read_u32_index(const struct device_node *np,
 				const char *propname, u32 index, u32 *out_value)
 {
@@ -432,6 +468,11 @@ static inline struct device_node *of_find_node_by_name(struct device_node *from,
 	return NULL;
 }
 
+static inline struct device_node *of_find_node_by_phandle(phandle phandle)
+{
+	return NULL;
+}
+
 static inline struct device_node *of_find_compatible_node(
 						struct device_node *from,
 						const char *type,
@@ -440,6 +481,12 @@ static inline struct device_node *of_find_compatible_node(
 	return NULL;
 }
 
+static inline const struct of_device_id *of_match_node(
+	const struct of_device_id *matches, const struct device_node *node)
+{
+	return NULL;
+}
+
 static inline struct device_node *of_find_matching_node_and_match(
 					struct device_node *from,
 					const struct of_device_id *matches,
@@ -454,6 +501,33 @@ static inline struct device_node *of_find_node_with_property(
 	return NULL;
 }
 
+static inline struct device_node *of_new_node(struct device_node *parent,
+				const char *name)
+{
+	return NULL;
+}
+
+static inline struct device_node *of_create_node(struct device_node *root,
+					const char *path)
+{
+	return NULL;
+}
+
+static inline void of_free(struct device_node *node)
+{
+}
+
+static inline int of_machine_is_compatible(const char *compat)
+{
+	return 0;
+}
+
+static inline int of_device_is_compatible(const struct device_node *device,
+		const char *compat)
+{
+	return 0;
+}
+
 static inline int of_device_is_available(const struct device_node *device)
 {
 	return 0;
@@ -472,6 +546,12 @@ static inline const char *of_alias_get(struct device_node *np)
 {
 	return NULL;
 }
+
+static inline int of_modalias_node(struct device_node *node, char *modalias,
+				int len)
+{
+	return -ENOSYS;
+}
 #endif
 
 #define for_each_node_by_name(dn, name) \
-- 
1.7.2.5


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

      parent reply	other threads:[~2013-06-19  9:10 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 17:29 [PATCH 00/22] Barebox OF API fixes, sync, and cleanup Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 01/22] lib: string: import case-insensitive string compare Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 02/22] OF: base: bail out early on missing matches for of_match_node Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 03/22] OF: base: also update property length on of_property_write_u32 Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 04/22] OF: base: export of_alias_scan Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 05/22] OF: base: convert strcmp to default string compare functions Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 06/22] OF: base: sync of_find_property with linux OF API Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 07/22] OF: base: sync of_find_node_by_path " Sebastian Hesselbarth
2013-06-18 20:13   ` Sascha Hauer
2013-06-18 20:19     ` Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 08/22] OF: base: rename of_node_disabled to of_device_is_available Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 09/22] OF: base: import of_find_node_by_name from Linux OF API Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 10/22] OF: base: import of_find_compatible_node " Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 11/22] OF: base: import of_find_matching_node_and_match " Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 12/22] OF: base: import of_find_node_with_property " Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 13/22] OF: base: import parent/child functions " Sebastian Hesselbarth
2013-06-18 20:18   ` Sascha Hauer
2013-06-18 20:29   ` Sascha Hauer
2013-06-18 20:34     ` Sebastian Hesselbarth
2013-06-18 17:29 ` [PATCH 14/22] OF: base: import of_property_read_* helpers " Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 15/22] OF: base: import of_parse_phandle " Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 16/22] OF: base: import parse phandle functions " Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 17/22] OF: base: introduce property write for bool, u8, u16, and u64 Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 18/22] OF: base: import property iterators from Linux OF API Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 19/22] OF: base: remove of_tree_for_each_node from public API Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 20/22] OF: base: remove of_find_child_by_name Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 21/22] OF: base: convert and remove device_node_for_nach_child Sebastian Hesselbarth
2013-06-18 17:30 ` [PATCH 22/22] OF: base: cleanup base function include Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 00/22] Barebox OF API fixes, sync, and cleanup Sebastian Hesselbarth
2013-06-20  9:18   ` Sascha Hauer
2013-06-19  9:09 ` [PATCH v2 01/22] lib: string: import case-insensitive string compare Sebastian Hesselbarth
2013-06-20  9:04   ` Sascha Hauer
2013-06-19  9:09 ` [PATCH v2 02/22] OF: base: bail out early on missing matches for of_match_node Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 03/22] OF: base: also update property length on of_property_write_u32 Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 04/22] OF: base: export of_alias_scan Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 05/22] OF: base: convert strcmp to default string compare functions Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 06/22] OF: base: sync of_find_property with linux OF API Sebastian Hesselbarth
2013-06-20  8:57   ` Sascha Hauer
2013-06-19  9:09 ` [PATCH v2 07/22] OF: base: sync of_find_node_by_path " Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 08/22] OF: base: rename of_node_disabled to of_device_is_available Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 09/22] OF: base: import of_find_node_by_name from Linux OF API Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 10/22] OF: base: import of_find_compatible_node " Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 11/22] OF: base: import of_find_matching_node_and_match " Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 12/22] OF: base: import of_find_node_with_property " Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 13/22] OF: base: import parent/child functions " Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 14/22] OF: base: import of_property_read_* helpers " Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 15/22] OF: base: import of_parse_phandle " Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 16/22] OF: base: import parse phandle functions " Sebastian Hesselbarth
2013-06-20  8:33   ` Sascha Hauer
2013-06-19  9:09 ` [PATCH v2 17/22] OF: base: introduce property write for bool, u8, u16, and u64 Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 18/22] OF: base: import property iterators from Linux OF API Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 19/22] OF: base: remove of_tree_for_each_node from public API Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 20/22] OF: base: remove of_find_child_by_name Sebastian Hesselbarth
2013-06-19  9:09 ` [PATCH v2 21/22] OF: base: convert and remove device_node_for_nach_child Sebastian Hesselbarth
2013-06-19  9:09 ` Sebastian Hesselbarth [this message]

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=1371632991-1504-23-git-send-email-sebastian.hesselbarth@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --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