Re: [PATCH v3 1/2] device property: Add fwnode_graph_get_port_parent

2017-05-23 Thread Kieran Bingham
Hi Sakari,

On 23/05/17 22:37, Sakari Ailus wrote:
> Hi Kieran,
> 
> On Tue, May 23, 2017 at 06:15:42PM +0100, Kieran Bingham wrote:
>>
>>
>> On 23/05/17 13:58, Sakari Ailus wrote:
>>> Hi Kieran,
>>>
>>> On Mon, May 22, 2017 at 06:36:37PM +0100, Kieran Bingham wrote:
 From: Kieran Bingham 

 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 

 ---
 v2:
  - Rebase on top of Sakari's acpi-graph-clean branch and simplify

 v3:
  - Fix up kerneldoc
  - Get the 'port' of the endpoint to find the parent of the port

  drivers/base/property.c  | 15 +++
  include/linux/property.h |  2 ++
  2 files changed, 17 insertions(+)

 diff --git a/drivers/base/property.c b/drivers/base/property.c
 index b311a6fa7d0c..fdbc644fd743 100644
 --- a/drivers/base/property.c
 +++ b/drivers/base/property.c
 @@ -1169,6 +1169,21 @@ 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 = fwnode_get_next_parent(endpoint);
 +
 +  return fwnode_call_ptr_op(port, graph_get_port_parent);
>>>
>>> I missed one thing: the reference to port obtained in
>>> fwnode_get_next_parent() needs to be released.
>>>
>>> I can do the change while applying the patch on top of the set if you're ok
>>> with that.
>>
>> Yes, that would be great thanks.
> 
> Thanks! The patch actually came out in this form:
> 
> 
> 
> I'll post it to list once I've rebased the set again, I hope you're ok with
> that. :-)

That looks great.

Thanks
--
Kieran


Re: [PATCH v3 1/2] device property: Add fwnode_graph_get_port_parent

2017-05-23 Thread Sakari Ailus
Hi Kieran,

On Tue, May 23, 2017 at 06:15:42PM +0100, Kieran Bingham wrote:
> 
> 
> On 23/05/17 13:58, Sakari Ailus wrote:
> > Hi Kieran,
> > 
> > On Mon, May 22, 2017 at 06:36:37PM +0100, Kieran Bingham wrote:
> >> From: Kieran Bingham 
> >>
> >> 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 
> >>
> >> ---
> >> v2:
> >>  - Rebase on top of Sakari's acpi-graph-clean branch and simplify
> >>
> >> v3:
> >>  - Fix up kerneldoc
> >>  - Get the 'port' of the endpoint to find the parent of the port
> >>
> >>  drivers/base/property.c  | 15 +++
> >>  include/linux/property.h |  2 ++
> >>  2 files changed, 17 insertions(+)
> >>
> >> diff --git a/drivers/base/property.c b/drivers/base/property.c
> >> index b311a6fa7d0c..fdbc644fd743 100644
> >> --- a/drivers/base/property.c
> >> +++ b/drivers/base/property.c
> >> @@ -1169,6 +1169,21 @@ 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 = fwnode_get_next_parent(endpoint);
> >> +
> >> +  return fwnode_call_ptr_op(port, graph_get_port_parent);
> > 
> > I missed one thing: the reference to port obtained in
> > fwnode_get_next_parent() needs to be released.
> > 
> > I can do the change while applying the patch on top of the set if you're ok
> > with that.
> 
> Yes, that would be great thanks.

Thanks! The patch actually came out in this form:



I'll post it to list once I've rebased the set again, I hope you're ok with
that. :-)

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk


Re: [PATCH v3 1/2] device property: Add fwnode_graph_get_port_parent

2017-05-23 Thread Sakari Ailus
Hi Kieran,

On Mon, May 22, 2017 at 06:36:37PM +0100, Kieran Bingham wrote:
> From: Kieran Bingham 
> 
> 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 
> 
> ---
> v2:
>  - Rebase on top of Sakari's acpi-graph-clean branch and simplify
> 
> v3:
>  - Fix up kerneldoc
>  - Get the 'port' of the endpoint to find the parent of the port
> 
>  drivers/base/property.c  | 15 +++
>  include/linux/property.h |  2 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index b311a6fa7d0c..fdbc644fd743 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -1169,6 +1169,21 @@ 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 = fwnode_get_next_parent(endpoint);
> +
> + return fwnode_call_ptr_op(port, graph_get_port_parent);

I missed one thing: the reference to port obtained in
fwnode_get_next_parent() needs to be released.

I can do the change while applying the patch on top of the set if you're ok
with that.

> +}
> +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
>   *
> diff --git a/include/linux/property.h b/include/linux/property.h
> index b9f4838d9882..af95d5d84192 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(

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk


[PATCH v3 1/2] device property: Add fwnode_graph_get_port_parent

2017-05-22 Thread Kieran Bingham
From: Kieran Bingham 

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 

---
v2:
 - Rebase on top of Sakari's acpi-graph-clean branch and simplify

v3:
 - Fix up kerneldoc
 - Get the 'port' of the endpoint to find the parent of the port

 drivers/base/property.c  | 15 +++
 include/linux/property.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index b311a6fa7d0c..fdbc644fd743 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1169,6 +1169,21 @@ 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 = fwnode_get_next_parent(endpoint);
+
+   return fwnode_call_ptr_op(port, graph_get_port_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
  *
diff --git a/include/linux/property.h b/include/linux/property.h
index b9f4838d9882..af95d5d84192 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(
-- 
git-series 0.9.1