From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [media] Add driver for Samsung S5K5BAF camera sensor
Date: Wed, 8 Jan 2014 15:45:06 +0300 [thread overview]
Message-ID: <20140108124505.GQ5443@mwanda> (raw)
In-Reply-To: <52CD3D6B.9000400@samsung.com>
On Wed, Jan 08, 2014 at 12:58:35PM +0100, Andrzej Hajda wrote:
> On 01/08/2014 10:58 AM, Dan Carpenter wrote:
> > Hello Andrzej Hajda,
> >
> > The patch 7d459937dc09: "[media] Add driver for Samsung S5K5BAF
> > camera sensor" from Dec 5, 2013, leads to the following
> > static checker warning:
> >
> > drivers/media/i2c/s5k5baf.c:1043 s5k5baf_set_power()
> > warn: add some parenthesis here?
> >
> > drivers/media/i2c/s5k5baf.c
> > 1036 static int s5k5baf_set_power(struct v4l2_subdev *sd, int on)
> > 1037 {
> > 1038 struct s5k5baf *state = to_s5k5baf(sd);
> > 1039 int ret = 0;
> > 1040
> > 1041 mutex_lock(&state->lock);
> > 1042
> > 1043 if (!on != state->power)
> > ^^^^^^^^^^^^^^^^^^^
> > This would be cleaner if it were "if (on == state->power)"
>
> This version works correctly only for 'on' equal 0 and 1, my version
> works for all ints. On the other side documentation says only 0 and 1 is
> allowed for s_power callbacks :)
> I would stay with my version, similar approach is in other drivers.
Even "if (!!on == state->power)" like you do in s5k5baf_s_stream() would
be more readable than the current code.
regards,
dan carpenter
next prev parent reply other threads:[~2014-01-08 12:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 9:58 [media] Add driver for Samsung S5K5BAF camera sensor Dan Carpenter
2014-01-08 11:58 ` Andrzej Hajda
2014-01-08 12:45 ` Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-01-08 9:09 Dan Carpenter
2014-01-08 10:29 ` Sachin Kamat
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=20140108124505.GQ5443@mwanda \
--to=dan.carpenter@oracle.com \
--cc=a.hajda@samsung.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