From: jacopo mondi <jacopo-AW8dsiIh9cEdnm+yROfE0A@public.gmane.org>
To: Sakari Ailus <sakari.ailus-X3B1VOXEql0@public.gmane.org>
Cc: Jacopo Mondi
<jacopo+renesas-AW8dsiIh9cEdnm+yROfE0A@public.gmane.org>,
corbet-T1hC0tSOHrs@public.gmane.org,
mchehab-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 2/2] v4l2: i2c: ov7670: Implement OF mbus configuration
Date: Sun, 21 Jan 2018 10:58:16 +0100 [thread overview]
Message-ID: <20180121095816.GM24926@w540> (raw)
In-Reply-To: <20180118222648.kfam634qyy4eu2ed-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
Hi Sakari,
On Fri, Jan 19, 2018 at 12:26:48AM +0200, Sakari Ailus wrote:
> Hi Jacopo,
>
> On Fri, Jan 12, 2018 at 06:56:48PM +0100, Jacopo Mondi wrote:
[snip]
> > +static int ov7670_parse_dt(struct device *dev,
> > + struct ov7670_info *info)
> > +{
> > + struct fwnode_handle *fwnode = dev_fwnode(dev);
> > + struct v4l2_fwnode_endpoint bus_cfg;
> > + struct fwnode_handle *ep;
> > + int ret;
> > +
> > + if (!fwnode)
> > + return -EINVAL;
> > +
> > + info->pclk_hb_disable = false;
> > + if (fwnode_property_present(fwnode, "ov7670,pclk-hb-disable"))
> > + info->pclk_hb_disable = true;
> > +
> > + ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
> > + if (!ep) {
> > + fwnode_handle_put(fwnode);
>
> You haven't acquired a reference to fwnode, therefore you musn't put it.
>
Oh, converting from OF to fwnode_handle doesn't increase reference
count, you're right. That makes error path even nicer :)
> Looks fine otherwise.
>
With that small fix can I have you're Reviewed-by? (The same goes for
bindings patch).
Thanks
j
> > + return -EINVAL;
> > + }
> > +
> > + ret = v4l2_fwnode_endpoint_parse(ep, &bus_cfg);
> > + if (ret)
> > + goto error_put_fwnodes;
> > +
> > + if (bus_cfg.bus_type != V4L2_MBUS_PARALLEL) {
> > + dev_err(dev, "Unsupported media bus type\n");
> > + ret = -EINVAL;
> > + goto error_put_fwnodes;
> > + }
> > + info->mbus_config = bus_cfg.bus.parallel.flags;
> > +
> > +error_put_fwnodes:
> > + fwnode_handle_put(ep);
> > + fwnode_handle_put(fwnode);
> > +
> > + return ret;
> > +}
> > +
> > static int ov7670_probe(struct i2c_client *client,
> > const struct i2c_device_id *id)
> > {
> > @@ -1678,7 +1749,13 @@ static int ov7670_probe(struct i2c_client *client,
> > #endif
> >
> > info->clock_speed = 30; /* default: a guess */
> > - if (client->dev.platform_data) {
> > +
> > + if (dev_fwnode(&client->dev)) {
> > + ret = ov7670_parse_dt(&client->dev, info);
> > + if (ret)
> > + return ret;
> > +
> > + } else if (client->dev.platform_data) {
> > struct ov7670_config *config = client->dev.platform_data;
> >
> > /*
> > @@ -1745,9 +1822,6 @@ static int ov7670_probe(struct i2c_client *client,
> > tpf.denominator = 30;
> > info->devtype->set_framerate(sd, &tpf);
> >
> > - if (info->pclk_hb_disable)
> > - ov7670_write(sd, REG_COM10, COM10_PCLK_HB);
> > -
> > v4l2_ctrl_handler_init(&info->hdl, 10);
> > v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops,
> > V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
> > --
> > 2.7.4
> >
>
> --
> Sakari Ailus
> e-mail: sakari.ailus-X3B1VOXEql0@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2018-01-21 9:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-12 17:56 [PATCH v3 0/2] media: ov7670: Implement mbus configuration Jacopo Mondi
2018-01-12 17:56 ` [PATCH v3 1/2] media: dt-bindings: Add OF properties to ov7670 Jacopo Mondi
2018-01-18 22:23 ` Sakari Ailus
2018-01-12 17:56 ` [PATCH v3 2/2] v4l2: i2c: ov7670: Implement OF mbus configuration Jacopo Mondi
2018-01-18 22:26 ` Sakari Ailus
[not found] ` <20180118222648.kfam634qyy4eu2ed-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2018-01-21 9:58 ` jacopo mondi [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=20180121095816.GM24926@w540 \
--to=jacopo-aw8dsiih9cednm+yrofe0a@public.gmane.org \
--cc=corbet-T1hC0tSOHrs@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=jacopo+renesas-AW8dsiIh9cEdnm+yROfE0A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=mchehab-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sakari.ailus-X3B1VOXEql0@public.gmane.org \
/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).