From: Joe Perches <joe@perches.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Devendra Naga <devendra.aaru@gmail.com>,
"Justin P. Mattock" <justinmattock@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 1/3] staging/rtl8192u: fix coding style problems
Date: Wed, 20 Jun 2012 16:18:35 -0700 [thread overview]
Message-ID: <1340234315.29885.54.camel@joe2Laptop> (raw)
In-Reply-To: <20120620230839.GA17883@kroah.com>
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.
Also, there are unnecessary parens that could
be removed to make the code clearer.
(1<<EPROM_R_SHIFT), (1<<EPROM_W_SHIFT) and
(1<<EPROM_CK_SHIFT) could be new #defines too.
next prev parent reply other threads:[~2012-06-20 23:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 19:05 Devendra Naga
2012-06-20 23:08 ` Greg Kroah-Hartman
2012-06-20 23:18 ` Joe Perches [this message]
2012-06-23 18:34 ` devendra.aaru
2012-06-23 19:10 ` Dan Carpenter
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=1340234315.29885.54.camel@joe2Laptop \
--to=joe@perches.com \
--cc=devel@driverdev.osuosl.org \
--cc=devendra.aaru@gmail.com \
--cc=gregkh@linuxfoundation.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®