regmap: Rename ret variable in regmap_read_poll_timeout
[linux-2.6/btrfs-unstable.git] / include / linux / of_graph.h
blobbb3a5a2cd5705062231fe7d87fac4361a5bde889
1 /*
2 * OF graph binding parsing helpers
4 * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
5 * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
7 * Copyright (C) 2012 Renesas Electronics Corp.
8 * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
14 #ifndef __LINUX_OF_GRAPH_H
15 #define __LINUX_OF_GRAPH_H
17 #include <linux/types.h>
18 #include <linux/errno.h>
20 /**
21 * struct of_endpoint - the OF graph endpoint data structure
22 * @port: identifier (value of reg property) of a port this endpoint belongs to
23 * @id: identifier (value of reg property) of this endpoint
24 * @local_node: pointer to device_node of this endpoint
26 struct of_endpoint {
27 unsigned int port;
28 unsigned int id;
29 const struct device_node *local_node;
32 /**
33 * for_each_endpoint_of_node - iterate over every endpoint in a device node
34 * @parent: parent device node containing ports and endpoints
35 * @child: loop variable pointing to the current endpoint node
37 * When breaking out of the loop, of_node_put(child) has to be called manually.
39 #define for_each_endpoint_of_node(parent, child) \
40 for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
41 child = of_graph_get_next_endpoint(parent, child))
43 #ifdef CONFIG_OF
44 int of_graph_parse_endpoint(const struct device_node *node,
45 struct of_endpoint *endpoint);
46 struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
47 struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
48 struct device_node *previous);
49 struct device_node *of_graph_get_endpoint_by_regs(
50 const struct device_node *parent, int port_reg, int reg);
51 struct device_node *of_graph_get_remote_port_parent(
52 const struct device_node *node);
53 struct device_node *of_graph_get_remote_port(const struct device_node *node);
54 #else
56 static inline int of_graph_parse_endpoint(const struct device_node *node,
57 struct of_endpoint *endpoint)
59 return -ENOSYS;
62 static inline struct device_node *of_graph_get_port_by_id(
63 struct device_node *node, u32 id)
65 return NULL;
68 static inline struct device_node *of_graph_get_next_endpoint(
69 const struct device_node *parent,
70 struct device_node *previous)
72 return NULL;
75 static inline struct device_node *of_graph_get_endpoint_by_regs(
76 const struct device_node *parent, int port_reg, int reg)
78 return NULL;
81 static inline struct device_node *of_graph_get_remote_port_parent(
82 const struct device_node *node)
84 return NULL;
87 static inline struct device_node *of_graph_get_remote_port(
88 const struct device_node *node)
90 return NULL;
93 #endif /* CONFIG_OF */
95 #endif /* __LINUX_OF_GRAPH_H */