From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-acpi@vger.kernel.org
Cc: devicetree@vger.kernel.org, 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, frowand.list@gmail.com,
kieran.bingham@ideasonboard.com,
Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Subject: [PATCH v6 6/6] device property: Add fwnode_graph_get_port_parent
Date: Wed, 31 May 2017 15:27:12 +0300 [thread overview]
Message-ID: <1496233632-25518-7-git-send-email-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <1496233632-25518-1-git-send-email-sakari.ailus@linux.intel.com>
From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Provide a helper to obtain the parent device fwnode without first
parsing the remote-endpoint as per fwnode_graph_get_remote_port_parent.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/base/property.c | 28 ++++++++++++++++++++++++----
include/linux/property.h | 2 ++
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index ac3590b..692007e 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1171,6 +1171,26 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode,
EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
/**
+ * fwnode_graph_get_port_parent - Return the device fwnode of a port endpoint
+ * @endpoint: Endpoint firmware node of the port
+ *
+ * Return: the firmware node of the device the @endpoint belongs to.
+ */
+struct fwnode_handle *
+fwnode_graph_get_port_parent(struct fwnode_handle *endpoint)
+{
+ struct fwnode_handle *port, *parent;
+
+ port = fwnode_get_parent(endpoint);
+ parent = fwnode_call_ptr_op(port, graph_get_port_parent);
+
+ fwnode_handle_put(port);
+
+ return parent;
+}
+EXPORT_SYMBOL_GPL(fwnode_graph_get_port_parent);
+
+/**
* fwnode_graph_get_remote_port_parent - Return fwnode of a remote device
* @fwnode: Endpoint firmware node pointing to the remote endpoint
*
@@ -1179,12 +1199,12 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
struct fwnode_handle *
fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode)
{
- struct fwnode_handle *port, *parent;
+ struct fwnode_handle *endpoint, *parent;
- port = fwnode_graph_get_remote_port(fwnode);
- parent = fwnode_call_ptr_op(port, graph_get_port_parent);
+ endpoint = fwnode_graph_get_remote_endpoint(fwnode);
+ parent = fwnode_graph_get_port_parent(endpoint);
- fwnode_handle_put(port);
+ fwnode_handle_put(endpoint);
return parent;
}
diff --git a/include/linux/property.h b/include/linux/property.h
index 0597a74..7e77039 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -275,6 +275,8 @@ void *device_get_mac_address(struct device *dev, char *addr, int alen);
struct fwnode_handle *fwnode_graph_get_next_endpoint(
struct fwnode_handle *fwnode, struct fwnode_handle *prev);
+struct fwnode_handle *
+fwnode_graph_get_port_parent(struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_port_parent(
struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_port(
--
2.7.4
prev parent reply other threads:[~2017-05-31 12:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 12:27 [PATCH v6 0/6] Move firmware specific code to firmware specific locations Sakari Ailus
[not found] ` <1496233632-25518-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-05-31 12:27 ` [PATCH v6 1/6] ACPI: Constify argument to acpi_device_is_present() Sakari Ailus
2017-05-31 12:27 ` [PATCH v6 2/6] device property: Move FW type specific functionality to FW specific files Sakari Ailus
2017-05-31 12:27 ` [PATCH v6 3/6] device property: Move fwnode graph ops to firmware specific locations Sakari Ailus
2017-05-31 12:27 ` [PATCH v6 4/6] device property: Introduce fwnode_device_is_available() Sakari Ailus
2017-05-31 12:27 ` [PATCH v6 5/6] device property: Add FW type agnostic fwnode_graph_get_remote_node Sakari Ailus
2017-05-31 12:27 ` Sakari Ailus [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=1496233632-25518-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=frowand.list@gmail.com \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=kieran.bingham@ideasonboard.com \
--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).