devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-acpi@vger.kernel.org, devicetree@vger.kernel.org
Cc: sudeep.holla@arm.com, lorenzo.pieralisi@arm.com,
	mika.westerberg@linux.intel.com, rafael@kernel.org,
	mark.rutland@arm.com, broonie@kernel.org, robh@kernel.org,
	ahs3@redhat.com
Subject: [PATCH 06/20] device property: Introduce firmware property operations, set them
Date: Thu, 23 Feb 2017 19:01:02 +0200	[thread overview]
Message-ID: <1487869276-25244-7-git-send-email-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <1487869276-25244-1-git-send-email-sakari.ailus@linux.intel.com>

Add ops field for the firmware operations to struct fwnode_handle. Set the
ops pointer based on firmware type in fwnode initialisation.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/acpi/property.c | 3 +++
 drivers/acpi/scan.c     | 1 +
 drivers/base/property.c | 3 +++
 drivers/of/base.c       | 2 ++
 include/linux/acpi.h    | 4 ++++
 include/linux/fwnode.h  | 5 +++++
 include/linux/of.h      | 2 ++
 7 files changed, 20 insertions(+)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 6e776de..0651a74 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -57,6 +57,7 @@ static bool acpi_nondev_subnode_extract(const union acpi_object *desc,
 
 	dn->name = link->package.elements[0].string.pointer;
 	dn->fwnode.type = FWNODE_ACPI_DATA;
+	dn->fwnode.ops = &acpi_fwnode_ops;
 	dn->parent = parent;
 	INIT_LIST_HEAD(&dn->data.subnodes);
 
@@ -1108,3 +1109,5 @@ int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
 
 	return 0;
 }
+
+const struct fwnode_operations acpi_fwnode_ops;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 1926918..901720f 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1441,6 +1441,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
 	device->handle = handle;
 	device->parent = acpi_bus_get_parent(handle);
 	device->fwnode.type = FWNODE_ACPI;
+	device->fwnode.ops = &acpi_fwnode_ops;
 	acpi_set_device_status(device, sta);
 	acpi_device_get_busid(device);
 	acpi_set_pnp_ids(handle, &device->pnp, type);
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 5cb270f..906411e 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -183,6 +183,8 @@ static int pset_prop_read_string(struct property_set *pset,
 	return 0;
 }
 
+static const struct fwnode_operations pset_fwnode_ops;
+
 /**
  * device_property_present - check if a property of a device is present
  * @dev: Device whose property is being checked
@@ -882,6 +884,7 @@ int device_add_properties(struct device *dev, struct property_entry *properties)
 		return PTR_ERR(p);
 
 	p->fwnode.type = FWNODE_PDATA;
+	p->fwnode.ops = &pset_fwnode_ops;
 	set_secondary_fwnode(dev, &p->fwnode);
 	return 0;
 }
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d4bea3c..c08ed0e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2469,3 +2469,5 @@ struct device_node *of_graph_get_remote_port(const struct device_node *node)
 	return of_get_next_parent(np);
 }
 EXPORT_SYMBOL(of_graph_get_remote_port);
+
+const struct fwnode_operations of_fwnode_ops;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 05ff957..85ca76d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -56,6 +56,9 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
 	acpi_fwnode_handle(adev) : NULL)
 #define ACPI_HANDLE(dev)		acpi_device_handle(ACPI_COMPANION(dev))
 
+
+extern const struct fwnode_operations acpi_fwnode_ops;
+
 static inline struct fwnode_handle *acpi_alloc_fwnode_static(void)
 {
 	struct fwnode_handle *fwnode;
@@ -65,6 +68,7 @@ static inline struct fwnode_handle *acpi_alloc_fwnode_static(void)
 		return NULL;
 
 	fwnode->type = FWNODE_ACPI_STATIC;
+	fwnode->ops = &acpi_fwnode_ops;
 
 	return fwnode;
 }
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 37d6ee1..4edb60d 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -12,6 +12,8 @@
 #ifndef _LINUX_FWNODE_H_
 #define _LINUX_FWNODE_H_
 
+#include <linux/types.h>
+
 enum fwnode_type {
 	FWNODE_INVALID = 0,
 	FWNODE_OF,
@@ -22,9 +24,12 @@ enum fwnode_type {
 	FWNODE_IRQCHIP
 };
 
+struct fwnode_operations;
+
 struct fwnode_handle {
 	enum fwnode_type type;
 	struct fwnode_handle *secondary;
+	const struct fwnode_operations *ops;
 };
 
 struct fwnode_endpoint {
diff --git a/include/linux/of.h b/include/linux/of.h
index e0ddb22..21ecde3 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -100,10 +100,12 @@ struct of_reconfig_data {
 
 /* initialize a node */
 extern struct kobj_type of_node_ktype;
+extern const struct fwnode_operations of_fwnode_ops;
 static inline void of_node_init(struct device_node *node)
 {
 	kobject_init(&node->kobj, &of_node_ktype);
 	node->fwnode.type = FWNODE_OF;
+	node->fwnode.ops = &of_fwnode_ops;
 }
 
 /* true when node is initialized */
-- 
2.7.4


  parent reply	other threads:[~2017-02-23 17:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 17:00 [PATCH 00/20] Move firmware specific code to firmware specific locations Sakari Ailus
2017-02-23 17:00 ` [PATCH 01/20] device property: fwnode_property_read_string_array() may return -EILSEQ Sakari Ailus
2017-02-23 17:00 ` [PATCH 02/20] device property: Fix reading pset strings using array access functions Sakari Ailus
2017-02-23 17:00 ` [PATCH 03/20] device property: of_property_read_string_array() returns number of strings Sakari Ailus
2017-02-23 23:42   ` Rob Herring
2017-02-24  8:15     ` Sakari Ailus
2017-02-23 17:01 ` [PATCH 04/20] device property: Add operations struct for fwnode operations Sakari Ailus
2017-02-23 17:01 ` [PATCH 05/20] device property: Add macros for calling " Sakari Ailus
2017-02-24  9:36   ` [PATCH v1.1 " Sakari Ailus
2017-02-23 17:01 ` Sakari Ailus [this message]
2017-02-23 17:01 ` [PATCH 07/20] device property: Use fwnode_operations for fwnode_handle_{get,put} Sakari Ailus
2017-02-23 17:01 ` [PATCH 08/20] device property: Use fwnode_operations for fwnode_property_present() Sakari Ailus
2017-02-23 17:01 ` [PATCH 09/20] device property: Use fwnode_operations for reading integer arrays Sakari Ailus
2017-02-23 17:01 ` [PATCH 10/20] device property: Read strings using string array reading functions Sakari Ailus
2017-02-23 17:01 ` [PATCH 13/20] device property: Use fwnode_operations for obtaining next child node Sakari Ailus
2017-02-23 17:01 ` [PATCH 14/20] device property: Use fwnode_operations for obtaining a named " Sakari Ailus
2017-02-23 17:01 ` [PATCH 16/20] device property: Use fwnode_operations for obtaining the remote endpoint Sakari Ailus
     [not found] ` <1487869276-25244-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-02-23 17:01   ` [PATCH 11/20] device property: Use fwnode_operations for reading string arrays Sakari Ailus
2017-02-23 17:01   ` [PATCH 12/20] device property: Use fwnode_operations for obtaining parent node Sakari Ailus
2017-02-23 17:01   ` [PATCH 15/20] device property: Use fwnode_operations for obtaining next graph endpoint Sakari Ailus
2017-02-23 17:01   ` [PATCH 17/20] device property: Use fwnode_operations for obtaining the remote port Sakari Ailus
2017-02-23 17:01 ` [PATCH 18/20] device property: Use fwnode_operations for obtaining the remote port parent Sakari Ailus
2017-02-23 17:01 ` [PATCH 19/20] device property: Use fwnode_operations for parsing graph endpoint Sakari Ailus
2017-02-23 17:01 ` [PATCH 20/20] device property: Implement fwnode_get_next_parent() using fwnode interface Sakari Ailus
2017-02-23 22:37 ` [PATCH 00/20] Move firmware specific code to firmware specific locations Rafael J. Wysocki
     [not found]   ` <2915459.fDeP2CYj8T-yvgW3jdyMHm1GS7QM15AGw@public.gmane.org>
2017-02-24  8:25     ` Sakari Ailus

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=1487869276-25244-7-git-send-email-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=ahs3@redhat.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).