From: Hans Verkuil <hverkuil@xs4all.nl>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH 1/9] imx074: don't call imx074_find_datafmt() twice
Date: Mon, 04 May 2015 09:22:03 +0200 [thread overview]
Message-ID: <55471E1B.50405@xs4all.nl> (raw)
In-Reply-To: <Pine.LNX.4.64.1505031948000.4237@axis700.grange>
On 05/03/2015 07:54 PM, Guennadi Liakhovetski wrote:
> Hi Hans,
>
> Thanks for fixing the drivers!
>
> On Sun, 3 May 2015, Hans Verkuil wrote:
>
>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> Simplify imx074_set_fmt().
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>> Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
>> ---
>> drivers/media/i2c/soc_camera/imx074.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c
>> index f68c235..4226f06 100644
>> --- a/drivers/media/i2c/soc_camera/imx074.c
>> +++ b/drivers/media/i2c/soc_camera/imx074.c
>> @@ -171,8 +171,9 @@ static int imx074_set_fmt(struct v4l2_subdev *sd,
>> /* MIPI CSI could have changed the format, double-check */
>> if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
>> return -EINVAL;
>> - mf->code = imx074_colour_fmts[0].code;
>> - mf->colorspace = imx074_colour_fmts[0].colorspace;
>> + fmt = imx074_colour_fmts;
>> + mf->code = fmt->code;
>> + mf->colorspace = fmt->colorspace;
>
> Uhm, why this change? I understand, that this is equivalent code, but (1)
> is it at all related to the change? and (2) imx074_colour_fmts is an
> array, so, I'd prefer to keep it as is. I do use pointer arithmetics for
> array, but then I'd do something like
Ah, I missed the FORMAT_ACTIVE check just before these lines. You are right,
this change is not needed.
Regards,
Hans
>
> + fmt = imx074_colour_fmts + 0;
> + mf->code = fmt->code;
> + mf->colorspace = fmt->colorspace;
>
> which looks silly:) And then - even more importantly - you overwrite the
> fmt variable, which is then used below instead of calling
> imx074_find_datafmt() again. So, now you assign a (theoretically)
> different value to priv->fmt. I know that array only has one element and
> imx074_find_datafmt() will anyway just return it, but, I don't see why
> this change is needed?
>
> Thanks
> Guennadi
>
>> }
>>
>> mf->width = IMX074_WIDTH;
>> @@ -180,7 +181,7 @@ static int imx074_set_fmt(struct v4l2_subdev *sd,
>> mf->field = V4L2_FIELD_NONE;
>>
>> if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
>> - priv->fmt = imx074_find_datafmt(mf->code);
>> + priv->fmt = fmt;
>> else
>> cfg->try_fmt = *mf;
>>
>> --
>> 2.1.4
>>
next prev parent reply other threads:[~2015-05-04 7:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-03 9:54 [PATCH 0/9] soc-camera sensor improvements Hans Verkuil
2015-05-03 9:54 ` [PATCH 1/9] imx074: don't call imx074_find_datafmt() twice Hans Verkuil
2015-05-03 17:54 ` Guennadi Liakhovetski
2015-05-04 7:22 ` Hans Verkuil [this message]
2015-05-03 9:54 ` [PATCH 2/9] mt9m001: avoid calling mt9m001_find_datafmt() twice Hans Verkuil
2015-05-03 17:56 ` Guennadi Liakhovetski
2015-05-03 9:54 ` [PATCH 3/9] mt9v022: avoid calling mt9v022_find_datafmt() twice Hans Verkuil
2015-05-03 17:57 ` Guennadi Liakhovetski
2015-05-03 9:54 ` [PATCH 4/9] ov2640: avoid calling ov2640_select_win() twice Hans Verkuil
2015-05-03 18:19 ` Guennadi Liakhovetski
2015-05-04 7:25 ` Hans Verkuil
2015-05-03 9:54 ` [PATCH 5/9] ov5642: avoid calling ov5642_find_datafmt() twice Hans Verkuil
2015-05-03 20:24 ` Guennadi Liakhovetski
2015-05-04 7:26 ` Hans Verkuil
2015-05-03 9:54 ` [PATCH 6/9] ov772x: avoid calling ov772x_select_params() twice Hans Verkuil
2015-05-03 20:30 ` Guennadi Liakhovetski
2015-05-03 9:54 ` [PATCH 7/9] ov9640: avoid calling ov9640_res_roundup() twice Hans Verkuil
2015-05-03 20:34 ` Guennadi Liakhovetski
2015-05-03 9:54 ` [PATCH 8/9] ov9740: avoid calling ov9740_res_roundup() twice Hans Verkuil
2015-05-03 20:47 ` Guennadi Liakhovetski
2015-05-04 10:20 ` Hans Verkuil
2015-05-03 9:54 ` [PATCH 9/9] mt9t112: initialize left and top Hans Verkuil
2015-05-03 21:02 ` Guennadi Liakhovetski
2015-05-03 21:09 ` Guennadi Liakhovetski
2015-05-04 7:31 ` Hans Verkuil
2015-05-04 7:40 ` Guennadi Liakhovetski
2015-05-04 7:43 ` Hans Verkuil
2015-05-04 7:54 ` Guennadi Liakhovetski
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=55471E1B.50405@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=g.liakhovetski@gmx.de \
--cc=hans.verkuil@cisco.com \
--cc=linux-media@vger.kernel.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