From: Dan Carpenter <dan.carpenter@oracle.com>
To: "devendra.aaru" <devendra.aaru@gmail.com>
Cc: Joe Perches <joe@perches.com>,
devel@driverdev.osuosl.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
"Justin P. Mattock" <justinmattock@gmail.com>
Subject: Re: [PATCH V2 1/3] staging/rtl8192u: fix coding style problems
Date: Sat, 23 Jun 2012 22:10:51 +0300 [thread overview]
Message-ID: <20120623191051.GF5333@mwanda> (raw)
In-Reply-To: <CAHdPZaMH1vJPsFmGFrrpWNtCxuY+S35-w2j+gbiiE=7jVKLtUQ@mail.gmail.com>
On Sun, Jun 24, 2012 at 12:04:12AM +0530, devendra.aaru wrote:
> Hi Joe,
>
> On Thu, Jun 21, 2012 at 4:48 AM, Joe Perches <joe@perches.com> wrote:
> > On Wed, 2012-06-20 at 16:08 -0700, Greg Kroah-Hartman wrote:
> >> On Wed, Jun 20, 2012 at 12:35:42AM +0530, Devendra Naga wrote:
> >> > fixed some of the coding style problems reported by checkpatch
> > []
> >> > @@ -66,11 +69,10 @@ short eprom_r(struct net_device *dev)
> >> > {
> >> > short bit;
> >> >
> >> > - bit=(read_nic_byte_E(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT) );
> >> > + bit = (read_nic_byte_E(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT));
> >> > udelay(EPROM_DELAY);
> >> >
> >> > - if(bit) return 1;
> >> > - return 0;
> >> > + return !!bit;
> >>
> >> Oh come on, really? !! is more "clear" here?
> >
> > Depends on the reader. !! is pretty common.
> >
> >> No, please be painfully obvious, that's the only way to write kernel
> >> code. Not like this.
> >
> > I'd just make the return a bool instead.
> >
> taking another variable and assign it like bool ret = !!bit, and
> returning ret?, i think this doesn't look better.
*eye roll*
if (bit)
return 1;
return 0;
regards,
dan carpenter
next prev parent reply other threads:[~2012-06-23 19:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 19:05 [PATCH V2 1/3] staging/rtl8192u: fix coding style problems Devendra Naga
2012-06-20 23:08 ` Greg Kroah-Hartman
2012-06-20 23:18 ` Joe Perches
2012-06-23 18:34 ` devendra.aaru
2012-06-23 19:10 ` Dan Carpenter [this message]
2012-06-23 20:51 ` Joe Perches
2012-06-23 18:29 ` devendra.aaru
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=20120623191051.GF5333@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=devendra.aaru@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=justinmattock@gmail.com \
--cc=linux-kernel@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 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.