All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, niklas.soderlund@ragnatech.se,
	laurent.pinchart@ideasonboard.com
Subject: Re: [RFC 1/8] v4l2-async: Use endpoint node, not device node, for fwnode match
Date: Fri, 5 Apr 2019 00:50:54 +0300	[thread overview]
Message-ID: <20190404215054.rg2wtfvyetnubjto@kekkonen.localdomain> (raw)
In-Reply-To: <198618d5-f32b-a4d2-c048-a7d8371289ee@xs4all.nl>

Hi Hans,

Thank you for the review.

On Thu, Apr 04, 2019 at 03:37:44PM +0200, Hans Verkuil wrote:
...
> > diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
> > index 6216b7ac6875..bb4c9cb9f2ad 100644
> > --- a/drivers/media/platform/davinci/vpif_capture.c
> > +++ b/drivers/media/platform/davinci/vpif_capture.c
> > @@ -1541,7 +1541,6 @@ vpif_capture_get_pdata(struct platform_device *pdev)
> >  
> >  	for (i = 0; i < VPIF_CAPTURE_NUM_CHANNELS; i++) {
> >  		struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
> > -		struct device_node *rem;
> >  		unsigned int flags;
> >  		int err;
> >  
> > @@ -1550,14 +1549,6 @@ vpif_capture_get_pdata(struct platform_device *pdev)
> >  		if (!endpoint)
> >  			break;
> >  
> > -		rem = of_graph_get_remote_port_parent(endpoint);
> > -		if (!rem) {
> > -			dev_dbg(&pdev->dev, "Remote device at %pOF not found\n",
> > -				endpoint);
> > -			of_node_put(endpoint);
> > -			goto done;
> > -		}
> > -
> >  		sdinfo = &pdata->subdev_info[i];
> >  		chan = &pdata->chan_config[i];
> >  		chan->inputs = devm_kcalloc(&pdev->dev,
> > @@ -1565,7 +1556,6 @@ vpif_capture_get_pdata(struct platform_device *pdev)
> >  					    sizeof(*chan->inputs),
> >  					    GFP_KERNEL);
> >  		if (!chan->inputs) {
> > -			of_node_put(rem);
> >  			of_node_put(endpoint);
> >  			goto err_cleanup;
> >  		}
> > @@ -1577,10 +1567,8 @@ vpif_capture_get_pdata(struct platform_device *pdev)
> >  
> >  		err = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
> >  						 &bus_cfg);
> > -		of_node_put(endpoint);
> 
> I don't think you can delete this line, seems to be an accidental deletion.

Right. of_graph_get_next_endpoint() will put the endpoint node on the next
iteration, so if the loop is executed again, the endpoint node musn't be
put here. I think I'll properly address this in a separate patch (before
this one).

> 
> >  		if (err) {
> >  			dev_err(&pdev->dev, "Could not parse the endpoint\n");
> > -			of_node_put(rem);
> >  			goto done;
> >  		}
> >  
> > @@ -1599,7 +1587,7 @@ vpif_capture_get_pdata(struct platform_device *pdev)
> >  		sdinfo->name = rem->full_name;
> >  
> >  		pdata->asd[i] = v4l2_async_notifier_add_fwnode_subdev(
> > -			&vpif_obj.notifier, of_fwnode_handle(rem),
> > +			&vpif_obj.notifier, of_fwnode_handle(endpoint),
> >  			sizeof(struct v4l2_async_subdev));
> >  		if (IS_ERR(pdata->asd[i])) {
> >  			of_node_put(rem);

...

> > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
> > index 15b0c44a76e7..4cb49d5f8c03 100644
> > --- a/drivers/media/v4l2-core/v4l2-async.c
> > +++ b/drivers/media/v4l2-core/v4l2-async.c
> > @@ -670,8 +670,12 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
> >  	 * (struct v4l2_subdev.dev), and async sub-device does not
> >  	 * exist independently of the device at any point of time.
> >  	 */
> > -	if (!sd->fwnode && sd->dev)
> > -		sd->fwnode = dev_fwnode(sd->dev);
> > +	if (!sd->fwnode && sd->dev) {
> > +		sd->fwnode = fwnode_graph_get_next_endpoint(
> > +			dev_fwnode(sd->dev), NULL);
> 
> Doesn't this take a reference? As opposed to the assignment below?
> 
> Shouldn't you call 'fwnode_handle_put(sd->fwnode);'?

Yes. I'll fix this for the next version.

> 
> > +		if (!sd->fwnode)
> > +			sd->fwnode = dev_fwnode(sd->dev);
> > +	}
> >  
> >  	mutex_lock(&list_lock);
> >  

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

  reply	other threads:[~2019-04-04 21:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 19:16 [RFC 0/8] Rework V4L2 fwnode parsing; add defaults and avoid iteration Sakari Ailus
2019-03-18 19:16 ` [RFC 1/8] v4l2-async: Use endpoint node, not device node, for fwnode match Sakari Ailus
2019-03-19 13:02   ` [RFC v1.1 " Sakari Ailus
2019-03-20 15:23     ` Niklas Söderlund
2019-04-04 13:37   ` [RFC " Hans Verkuil
2019-04-04 21:50     ` Sakari Ailus [this message]
2019-03-18 19:16 ` [RFC 2/8] v4l2-async: Add v4l2_async_notifier_add_fwnode_remote_subdev Sakari Ailus
2019-03-19 13:00   ` [RFC v1.1 " Sakari Ailus
2019-04-04 13:39   ` [RFC " Hans Verkuil
2019-04-04 23:04     ` Sakari Ailus
2019-03-18 19:16 ` [RFC 3/8] v4l2-fwnode: Use v4l2_async_notifier_add_fwnode_remote_subdev Sakari Ailus
2019-03-20 16:10   ` Niklas Söderlund
2019-03-18 19:16 ` [RFC 4/8] omap3isp: Rework OF endpoint parsing Sakari Ailus
2019-04-04 13:43   ` Hans Verkuil
2019-04-05  0:22     ` Sakari Ailus
2019-03-18 19:16 ` [RFC 5/8] v4l2-async: Safely clean up an uninitialised notifier Sakari Ailus
2019-03-18 19:16 ` [RFC 6/8] ipu3-cio2: Clean up notifier's subdev list if parsing endpoints fails Sakari Ailus
2019-03-18 19:16 ` [RFC 7/8] ipu3-cio2: Proceed with notifier init even if there are no subdevs Sakari Ailus
2019-03-18 19:16 ` [RFC 8/8] ipu3-cio2: Parse information from firmware without using callbacks 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=20190404215054.rg2wtfvyetnubjto@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.