summaryrefslogtreecommitdiff
path: root/include/linux/property.h
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2019-05-31 17:15:34 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-06-03 11:55:38 +0300
commit80488a6b1d3c3509b69d38d7c5ac7615889ea7e0 (patch)
tree1ef7f18e72afed204075830ac9969981c2ff11c7 /include/linux/property.h
parent3df85a1ae51f6b256982fe9d17c2dc5bfb4cc402 (diff)
downloadlinux-80488a6b1d3c3509b69d38d7c5ac7615889ea7e0.tar.xz
software node: Add support for static node descriptors
Until now the software nodes could only be created dynamically with fwnode_create_software_node() function. This introduces struct software_node data structure, which makes it possible to describe the software nodes also statically. The statically described software nodes can be registered with a new function fwnode_register_software_node(). This also adds a helper fwnode_register_software_nodes() which makes it possible to register an array of struct software_nodes, i.e. multiple nodes at the same time. There is no difference between statically described and dynamically allocated software nodes. Even the registration does not differ, except that during node creation the device properties are only copied if the node is created dynamically. With statically described nodes, the property entries in the descriptor (struct software_node) are assigned directly to the new software node that is being created without any copies. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/property.h')
-rw-r--r--include/linux/property.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/property.h b/include/linux/property.h
index a29369c89e6e..a3813ded52ea 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -332,7 +332,26 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
/* -------------------------------------------------------------------------- */
/* Software fwnode support - when HW description is incomplete or missing */
+/**
+ * struct software_node - Software node description
+ * @name: Name of the software node
+ * @parent: Parent of the software node
+ * @properties: Array of device properties
+ */
+struct software_node {
+ const char *name;
+ const struct software_node *parent;
+ const struct property_entry *properties;
+};
+
bool is_software_node(const struct fwnode_handle *fwnode);
+const struct software_node *to_software_node(struct fwnode_handle *fwnode);
+struct fwnode_handle *software_node_fwnode(const struct software_node *node);
+
+int software_node_register_nodes(const struct software_node *nodes);
+void software_node_unregister_nodes(const struct software_node *nodes);
+
+int software_node_register(const struct software_node *node);
int software_node_notify(struct device *dev, unsigned long action);