public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] V4L2 OF fixes
@ 2013-07-03 10:52 Laurent Pinchart
  2013-07-03 10:52 ` [PATCH 1/2] v4l: of: Use of_get_child_by_name() Laurent Pinchart
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Laurent Pinchart @ 2013-07-03 10:52 UTC (permalink / raw)
  To: linux-media; +Cc: Guennadi Liakhovetski, Sylwester Nawrocki

Hello,

Here are two small fixes for the V4L2 OF parsing code. The patches should be
self-explanatory.

Laurent Pinchart (2):
  v4l: of: Use of_get_child_by_name()
  v4l: of: Drop acquired reference to node when getting next endpoint

 drivers/media/v4l2-core/v4l2-of.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] v4l: of: Use of_get_child_by_name()
  2013-07-03 10:52 [PATCH 0/2] V4L2 OF fixes Laurent Pinchart
@ 2013-07-03 10:52 ` Laurent Pinchart
  2013-07-03 10:52 ` [PATCH 2/2] v4l: of: Drop acquired reference to node when getting next endpoint Laurent Pinchart
  2013-07-03 20:36 ` [PATCH 0/2] V4L2 OF fixes Sylwester Nawrocki
  2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2013-07-03 10:52 UTC (permalink / raw)
  To: linux-media; +Cc: Guennadi Liakhovetski, Sylwester Nawrocki

Replace a manual loop through child nodes with a call to
of_get_child_by_name().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-of.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c
index aa59639..f64d953 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -173,12 +173,8 @@ struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent,
 		if (node)
 			parent = node;
 
-		for_each_child_of_node(parent, node) {
-			if (!of_node_cmp(node->name, "port")) {
-				port = node;
-				break;
-			}
-		}
+		port = of_get_child_by_name(parent, "port");
+
 		if (port) {
 			/* Found a port, get an endpoint. */
 			endpoint = of_get_next_child(port, NULL);
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] v4l: of: Drop acquired reference to node when getting next endpoint
  2013-07-03 10:52 [PATCH 0/2] V4L2 OF fixes Laurent Pinchart
  2013-07-03 10:52 ` [PATCH 1/2] v4l: of: Use of_get_child_by_name() Laurent Pinchart
@ 2013-07-03 10:52 ` Laurent Pinchart
  2013-07-03 20:36 ` [PATCH 0/2] V4L2 OF fixes Sylwester Nawrocki
  2 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2013-07-03 10:52 UTC (permalink / raw)
  To: linux-media; +Cc: Guennadi Liakhovetski, Sylwester Nawrocki

The of_get_child_by_name() function takes a reference to the node it
returns. Make sure to drop it when looking for the ports node in
v4l2_of_get_next_endpoint().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/v4l2-core/v4l2-of.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c
index f64d953..ed305d8 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -186,6 +186,7 @@ struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent,
 		if (!endpoint)
 			pr_err("%s(): no endpoint nodes specified for %s\n",
 			       __func__, parent->full_name);
+		of_node_put(node);
 	} else {
 		port = of_get_parent(prev);
 		if (!port)
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] V4L2 OF fixes
  2013-07-03 10:52 [PATCH 0/2] V4L2 OF fixes Laurent Pinchart
  2013-07-03 10:52 ` [PATCH 1/2] v4l: of: Use of_get_child_by_name() Laurent Pinchart
  2013-07-03 10:52 ` [PATCH 2/2] v4l: of: Drop acquired reference to node when getting next endpoint Laurent Pinchart
@ 2013-07-03 20:36 ` Sylwester Nawrocki
  2013-07-03 23:55   ` Laurent Pinchart
  2 siblings, 1 reply; 5+ messages in thread
From: Sylwester Nawrocki @ 2013-07-03 20:36 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, Guennadi Liakhovetski, Sylwester Nawrocki

On 07/03/2013 12:52 PM, Laurent Pinchart wrote:
> Hello,
>
> Here are two small fixes for the V4L2 OF parsing code. The patches should be
> self-explanatory.

Hi Laurent,

Thank you for fixing what I've messed up in the Guennadi's original patch.
For both patches:

  Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

> Laurent Pinchart (2):
>    v4l: of: Use of_get_child_by_name()
>    v4l: of: Drop acquired reference to node when getting next endpoint
>
>   drivers/media/v4l2-core/v4l2-of.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)

Thanks,
Sylwester

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] V4L2 OF fixes
  2013-07-03 20:36 ` [PATCH 0/2] V4L2 OF fixes Sylwester Nawrocki
@ 2013-07-03 23:55   ` Laurent Pinchart
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2013-07-03 23:55 UTC (permalink / raw)
  To: Sylwester Nawrocki; +Cc: linux-media, Guennadi Liakhovetski, Sylwester Nawrocki

Hi Sylwester,

On Wednesday 03 July 2013 22:36:28 Sylwester Nawrocki wrote:
> On 07/03/2013 12:52 PM, Laurent Pinchart wrote:
> > Hello,
> > 
> > Here are two small fixes for the V4L2 OF parsing code. The patches should
> > be self-explanatory.
> 
> Hi Laurent,
> 
> Thank you for fixing what I've messed up in the Guennadi's original patch.
> For both patches:
> 
>   Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

No worries :-) Thanks for your ack.

> 
> > Laurent Pinchart (2):
> >    v4l: of: Use of_get_child_by_name()
> >    v4l: of: Drop acquired reference to node when getting next endpoint
> >   
> >   drivers/media/v4l2-core/v4l2-of.c | 9 +++------
> >   1 file changed, 3 insertions(+), 6 deletions(-)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-03 23:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-03 10:52 [PATCH 0/2] V4L2 OF fixes Laurent Pinchart
2013-07-03 10:52 ` [PATCH 1/2] v4l: of: Use of_get_child_by_name() Laurent Pinchart
2013-07-03 10:52 ` [PATCH 2/2] v4l: of: Drop acquired reference to node when getting next endpoint Laurent Pinchart
2013-07-03 20:36 ` [PATCH 0/2] V4L2 OF fixes Sylwester Nawrocki
2013-07-03 23:55   ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox