Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1643446 > unrolled thread
| Started by | Kieran Bingham <kbingham@kernel.org> |
|---|---|
| First post | 2017-05-17 17:10 +0200 |
| Last post | 2017-05-18 17:30 +0200 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v1 2/3] device property: Add fwnode_graph_get_port_parent Kieran Bingham <kbingham@kernel.org> - 2017-05-17 17:10 +0200
Re: [PATCH v1 2/3] device property: Add fwnode_graph_get_port_parent Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2017-05-18 15:40 +0200
Re: [PATCH v1 2/3] device property: Add fwnode_graph_get_port_parent Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> - 2017-05-19 15:40 +0200
Re: [PATCH v1 2/3] device property: Add fwnode_graph_get_port_parent Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2017-05-19 16:50 +0200
Re: [PATCH v1 2/3] device property: Add fwnode_graph_get_port_parent Sakari Ailus <sakari.ailus@iki.fi> - 2017-05-22 08:20 +0200
Re: [PATCH v1 2/3] device property: Add fwnode_graph_get_port_parent Sakari Ailus <sakari.ailus@iki.fi> - 2017-05-18 17:30 +0200
| From | Kieran Bingham <kbingham@kernel.org> |
|---|---|
| Date | 2017-05-17 17:10 +0200 |
| Subject | [PATCH v1 2/3] device property: Add fwnode_graph_get_port_parent |
| Message-ID | <tI8Kn-4GH-25@gated-at.bofh.it> |
From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
V4L2 async notifiers can pass the endpoint fwnode rather than the device
fwnode.
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>
---
drivers/base/property.c | 25 +++++++++++++++++++++++++
include/linux/property.h | 2 ++
2 files changed, 27 insertions(+)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 627ebc9b570d..caf4316fe565 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1245,6 +1245,31 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle *fwnode,
EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
/**
+ * fwnode_graph_get_port_parent - Return device node of a port endpoint
+ * @fwnode: Endpoint firmware node pointing of the port
+ *
+ * Extracts firmware node of the device the @fwnode belongs to.
+ */
+struct fwnode_handle *
+fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
+{
+ struct fwnode_handle *parent = NULL;
+
+ if (is_of_node(fwnode)) {
+ struct device_node *node;
+
+ node = of_graph_get_port_parent(to_of_node(fwnode));
+ if (node)
+ parent = &node->fwnode;
+ } else if (is_acpi_node(fwnode)) {
+ parent = acpi_node_get_parent(fwnode);
+ }
+
+ 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
*
diff --git a/include/linux/property.h b/include/linux/property.h
index 2f482616a2f2..624129b86c82 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -274,6 +274,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
[toc] | [next] | [standalone]
| From | Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
|---|---|
| Date | 2017-05-18 15:40 +0200 |
| Message-ID | <tItOP-3bL-45@gated-at.bofh.it> |
| In reply to | #1643446 |
Hi Kieran,
Thank you for the patch.
On Wednesday 17 May 2017 16:03:38 Kieran Bingham wrote:
> From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>
> V4L2 async notifiers can pass the endpoint fwnode rather than the device
> fwnode.
I'm not sure I would mention V4L2 in the commit message, as this is generic.
> 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>
> ---
> drivers/base/property.c | 25 +++++++++++++++++++++++++
> include/linux/property.h | 2 ++
> 2 files changed, 27 insertions(+)
>
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 627ebc9b570d..caf4316fe565 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -1245,6 +1245,31 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle
> *fwnode, EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
>
> /**
> + * fwnode_graph_get_port_parent - Return device node of a port endpoint
> + * @fwnode: Endpoint firmware node pointing of the port
> + *
> + * Extracts firmware node of the device the @fwnode belongs to.
I'm not too familiar with the fwnode API, but I know it's written in C, where
functions don't extract something but return a value :-) How about
Return: the firmware node of the device the @endpoint belongs to.
> + */
> +struct fwnode_handle *
> +fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
This is akin to writing (unsigned int integer)
How about calling the variable endpoint ? That would also make the
documentation clearer in my opinion, with "the @fwnode belongs to" replaced
with "the @endpoint belongs to".
> +{
> + struct fwnode_handle *parent = NULL;
> +
> + if (is_of_node(fwnode)) {
> + struct device_node *node;
> +
> + node = of_graph_get_port_parent(to_of_node(fwnode));
> + if (node)
> + parent = &node->fwnode;
This part looks good to me, with the above small change,
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + } else if (is_acpi_node(fwnode)) {
> + parent = acpi_node_get_parent(fwnode);
I can't comment on this one though.
> + }
> +
> + 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
> *
> diff --git a/include/linux/property.h b/include/linux/property.h
> index 2f482616a2f2..624129b86c82 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -274,6 +274,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,
Laurent Pinchart
[toc] | [prev] | [next] | [standalone]
| From | Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> |
|---|---|
| Date | 2017-05-19 15:40 +0200 |
| Message-ID | <tIQim-2MD-15@gated-at.bofh.it> |
| In reply to | #1644548 |
Hi Laurent,
On 18/05/17 14:36, Laurent Pinchart wrote:
> Hi Kieran,
>
> Thank you for the patch.
>
> On Wednesday 17 May 2017 16:03:38 Kieran Bingham wrote:
>> From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
>>
>> V4L2 async notifiers can pass the endpoint fwnode rather than the device
>> fwnode.
>
> I'm not sure I would mention V4L2 in the commit message, as this is generic.
Good point
>> 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>
>> ---
>> drivers/base/property.c | 25 +++++++++++++++++++++++++
>> include/linux/property.h | 2 ++
>> 2 files changed, 27 insertions(+)
>>
>> diff --git a/drivers/base/property.c b/drivers/base/property.c
>> index 627ebc9b570d..caf4316fe565 100644
>> --- a/drivers/base/property.c
>> +++ b/drivers/base/property.c
>> @@ -1245,6 +1245,31 @@ fwnode_graph_get_next_endpoint(struct fwnode_handle
>> *fwnode, EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
>>
>> /**
>> + * fwnode_graph_get_port_parent - Return device node of a port endpoint
>> + * @fwnode: Endpoint firmware node pointing of the port
>> + *
>> + * Extracts firmware node of the device the @fwnode belongs to.
>
> I'm not too familiar with the fwnode API, but I know it's written in C, where
> functions don't extract something but return a value :-) How about
>
> Return: the firmware node of the device the @endpoint belongs to.
>
I'm not averse to the reword - but it is different to the other functions in the
same context:
fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode)
* Extracts firmware node of a remote endpoint the @fwnode points to.
struct fwnode_handle *fwnode_graph_get_remote_port(struct fwnode_handle *fwnode)
* Extracts firmware node of a remote port the @fwnode points to.
fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode)
* Extracts firmware node of a remote device the @fwnode points to.
Then with this function becoming:
fwnode_graph_get_port_parent(struct fwnode_handle *endpoint)
* Returns firmware node of the device the @endpoint belongs to.
I guess those could be changed too ...
>> + */
>> +struct fwnode_handle *
>> +fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
>
> This is akin to writing (unsigned int integer)
Yes, good point there - I was thinking of the fwnode as an object itself, but
really it's representing the endpoint, and the fwnode is the class type :)
>
> How about calling the variable endpoint ? That would also make the
> documentation clearer in my opinion, with "the @fwnode belongs to" replaced
> with "the @endpoint belongs to".
Agreed
>
>> +{
>> + struct fwnode_handle *parent = NULL;
>> +
>> + if (is_of_node(fwnode)) {
>> + struct device_node *node;
>> +
>> + node = of_graph_get_port_parent(to_of_node(fwnode));
>> + if (node)
>> + parent = &node->fwnode;
>
> This part looks good to me, with the above small change,
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Thanks,
I'll add this if the code doesn't change drastically based on Sakari's suggestion.
>
>> + } else if (is_acpi_node(fwnode)) {
>> + parent = acpi_node_get_parent(fwnode);
>
> I can't comment on this one though.
>
>> + }
>> +
>> + 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
>> *
>> diff --git a/include/linux/property.h b/include/linux/property.h
>> index 2f482616a2f2..624129b86c82 100644
>> --- a/include/linux/property.h
>> +++ b/include/linux/property.h
>> @@ -274,6 +274,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(
>
[toc] | [prev] | [next] | [standalone]
| From | Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
|---|---|
| Date | 2017-05-19 16:50 +0200 |
| Message-ID | <tIRo6-3Bo-19@gated-at.bofh.it> |
| In reply to | #1645608 |
Hi Kieran,
On Friday 19 May 2017 14:34:33 Kieran Bingham wrote:
> On 18/05/17 14:36, Laurent Pinchart wrote:
> > On Wednesday 17 May 2017 16:03:38 Kieran Bingham wrote:
> >> From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> >>
> >> V4L2 async notifiers can pass the endpoint fwnode rather than the device
> >> fwnode.
> >
> > I'm not sure I would mention V4L2 in the commit message, as this is
> > generic.
>
> Good point
>
> >> 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>
> >> ---
> >>
> >> drivers/base/property.c | 25 +++++++++++++++++++++++++
> >> include/linux/property.h | 2 ++
> >> 2 files changed, 27 insertions(+)
> >>
> >> diff --git a/drivers/base/property.c b/drivers/base/property.c
> >> index 627ebc9b570d..caf4316fe565 100644
> >> --- a/drivers/base/property.c
> >> +++ b/drivers/base/property.c
> >> @@ -1245,6 +1245,31 @@ fwnode_graph_get_next_endpoint(struct
> >> fwnode_handle
> >> *fwnode, EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);
> >>
> >> /**
> >>
> >> + * fwnode_graph_get_port_parent - Return device node of a port endpoint
> >> + * @fwnode: Endpoint firmware node pointing of the port
> >> + *
> >> + * Extracts firmware node of the device the @fwnode belongs to.
> >
> > I'm not too familiar with the fwnode API, but I know it's written in C,
> > where functions don't extract something but return a value :-) How about
> >
> > Return: the firmware node of the device the @endpoint belongs to.
>
> I'm not averse to the reword - but it is different to the other functions in
> the same context:
>
> fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode)
> * Extracts firmware node of a remote endpoint the @fwnode points to.
>
> struct fwnode_handle *fwnode_graph_get_remote_port(struct fwnode_handle
> *fwnode)
> * Extracts firmware node of a remote port the @fwnode points to.
>
> fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode)
> * Extracts firmware node of a remote device the @fwnode points to.
>
> Then with this function becoming:
>
> fwnode_graph_get_port_parent(struct fwnode_handle *endpoint)
> * Returns firmware node of the device the @endpoint belongs to.
>
>
> I guess those could be changed too ...
My point is that the kerneldoc format documents return values with a "Return:"
tag. The documentation for the function can still provide extra information.
> >> + */
> >> +struct fwnode_handle *
> >> +fwnode_graph_get_port_parent(struct fwnode_handle *fwnode)
> >
> > This is akin to writing (unsigned int integer)
>
> Yes, good point there - I was thinking of the fwnode as an object itself,
> but really it's representing the endpoint, and the fwnode is the class type
> :)
>
> > How about calling the variable endpoint ? That would also make the
> > documentation clearer in my opinion, with "the @fwnode belongs to"
> > replaced with "the @endpoint belongs to".
>
> Agreed
>
> >> +{
> >> + struct fwnode_handle *parent = NULL;
> >> +
> >> + if (is_of_node(fwnode)) {
> >> + struct device_node *node;
> >> +
> >> + node = of_graph_get_port_parent(to_of_node(fwnode));
> >> + if (node)
> >> + parent = &node->fwnode;
> >
> > This part looks good to me, with the above small change,
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Thanks,
>
> I'll add this if the code doesn't change drastically based on Sakari's
> suggestion.
>
> >> + } else if (is_acpi_node(fwnode)) {
> >> + parent = acpi_node_get_parent(fwnode);
> >
> > I can't comment on this one though.
> >
> >> + }
> >> +
> >> + 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
> >> *
> >>
> >> diff --git a/include/linux/property.h b/include/linux/property.h
> >> index 2f482616a2f2..624129b86c82 100644
> >> --- a/include/linux/property.h
> >> +++ b/include/linux/property.h
> >> @@ -274,6 +274,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,
Laurent Pinchart
[toc] | [prev] | [next] | [standalone]
| From | Sakari Ailus <sakari.ailus@iki.fi> |
|---|---|
| Date | 2017-05-22 08:20 +0200 |
| Message-ID | <tJORb-1PK-9@gated-at.bofh.it> |
| In reply to | #1645665 |
Hi Laurent and Kieran, On Fri, May 19, 2017 at 05:42:07PM +0300, Laurent Pinchart wrote: > Hi Kieran, > > On Friday 19 May 2017 14:34:33 Kieran Bingham wrote: > > On 18/05/17 14:36, Laurent Pinchart wrote: > > > On Wednesday 17 May 2017 16:03:38 Kieran Bingham wrote: > > >> From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > >> > > >> V4L2 async notifiers can pass the endpoint fwnode rather than the device > > >> fwnode. > > > > > > I'm not sure I would mention V4L2 in the commit message, as this is > > > generic. > > > > Good point > > > > >> 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> > > >> --- > > >> > > >> drivers/base/property.c | 25 +++++++++++++++++++++++++ > > >> include/linux/property.h | 2 ++ > > >> 2 files changed, 27 insertions(+) > > >> > > >> diff --git a/drivers/base/property.c b/drivers/base/property.c > > >> index 627ebc9b570d..caf4316fe565 100644 > > >> --- a/drivers/base/property.c > > >> +++ b/drivers/base/property.c > > >> @@ -1245,6 +1245,31 @@ fwnode_graph_get_next_endpoint(struct > > >> fwnode_handle > > >> *fwnode, EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); > > >> > > >> /** > > >> > > >> + * fwnode_graph_get_port_parent - Return device node of a port endpoint > > >> + * @fwnode: Endpoint firmware node pointing of the port > > >> + * > > >> + * Extracts firmware node of the device the @fwnode belongs to. > > > > > > I'm not too familiar with the fwnode API, but I know it's written in C, > > > where functions don't extract something but return a value :-) How about > > > > > > Return: the firmware node of the device the @endpoint belongs to. > > > > I'm not averse to the reword - but it is different to the other functions in > > the same context: > > > > fwnode_graph_get_remote_endpoint(struct fwnode_handle *fwnode) > > * Extracts firmware node of a remote endpoint the @fwnode points to. > > > > struct fwnode_handle *fwnode_graph_get_remote_port(struct fwnode_handle > > *fwnode) > > * Extracts firmware node of a remote port the @fwnode points to. > > > > fwnode_graph_get_remote_port_parent(struct fwnode_handle *fwnode) > > * Extracts firmware node of a remote device the @fwnode points to. > > > > Then with this function becoming: > > > > fwnode_graph_get_port_parent(struct fwnode_handle *endpoint) > > * Returns firmware node of the device the @endpoint belongs to. > > > > > > I guess those could be changed too ... > > My point is that the kerneldoc format documents return values with a "Return:" > tag. The documentation for the function can still provide extra information. Yeah, let's do this right and then fix the rest. I've already submitted the pull request on this one --- the origin of that text is actually the V4L2 OF framework. Feel free to submit a patch that fixes it, I can do it as well. -- Regards, Sakari Ailus e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
[toc] | [prev] | [next] | [standalone]
| From | Sakari Ailus <sakari.ailus@iki.fi> |
|---|---|
| Date | 2017-05-18 17:30 +0200 |
| Message-ID | <tIvxg-4z7-25@gated-at.bofh.it> |
| In reply to | #1643446 |
Hi Kieran, On Wed, May 17, 2017 at 04:03:38PM +0100, Kieran Bingham wrote: > From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> > > V4L2 async notifiers can pass the endpoint fwnode rather than the device > fwnode. > > 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> Could you rebase this on my fwnode cleanup patchset here, please? I'd be happy to apply it on top of the set. <URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=acpi-graph-cleaned> This function becomes quite simple, see fwnode_graph_get_remote_port_parent(). -- Kind regards, Sakari Ailus e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web