public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Devendra Naga <devendra.aaru@gmail.com>
Cc: "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:08:39 -0700	[thread overview]
Message-ID: <20120620230839.GA17883@kroah.com> (raw)
In-Reply-To: <1340132742-18849-1-git-send-email-devendra.aaru@gmail.com>

On Wed, Jun 20, 2012 at 12:35:42AM +0530, Devendra Naga wrote:
> fixed some of the coding style problems reported by checkpatch
> 
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
> ---
>  drivers/staging/rtl8192u/r8180_93cx6.c |   36 +++++++++++++++++---------------
>  1 file changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c
> index 3c515b7..19f5270 100644
> --- a/drivers/staging/rtl8192u/r8180_93cx6.c
> +++ b/drivers/staging/rtl8192u/r8180_93cx6.c
> @@ -22,13 +22,16 @@
>  
>  void eprom_cs(struct net_device *dev, short bit)
>  {
> -	if(bit)
> +	if (bit) {
> +		/* enable EPROM */
>  		write_nic_byte_E(dev, EPROM_CMD,
> -			       (1<<EPROM_CS_SHIFT) | \
> -			       read_nic_byte_E(dev, EPROM_CMD)); //enable EPROM
> -	else
> -		write_nic_byte_E(dev, EPROM_CMD, read_nic_byte_E(dev, EPROM_CMD)\
> -			       &~(1<<EPROM_CS_SHIFT)); //disable EPROM
> +				(1<<EPROM_CS_SHIFT) |
> +				read_nic_byte_E(dev, EPROM_CMD));
> +	} else {
> +		/* disable EPROM */
> +		write_nic_byte_E(dev, EPROM_CMD, read_nic_byte_E(dev, EPROM_CMD)
> +			       & ~(1<<EPROM_CS_SHIFT));
> +	}
>  
>  	force_pci_posting(dev);
>  	udelay(EPROM_DELAY);
> @@ -38,24 +41,24 @@ void eprom_cs(struct net_device *dev, short bit)
>  void eprom_ck_cycle(struct net_device *dev)
>  {
>  	write_nic_byte_E(dev, EPROM_CMD,
> -		       (1<<EPROM_CK_SHIFT) | read_nic_byte_E(dev,EPROM_CMD));
> +		       (1<<EPROM_CK_SHIFT) | read_nic_byte_E(dev, EPROM_CMD));
>  	force_pci_posting(dev);
>  	udelay(EPROM_DELAY);
>  	write_nic_byte_E(dev, EPROM_CMD,
> -		       read_nic_byte_E(dev, EPROM_CMD) &~ (1<<EPROM_CK_SHIFT));
> +		       read_nic_byte_E(dev, EPROM_CMD) & ~(1<<EPROM_CK_SHIFT));
>  	force_pci_posting(dev);
>  	udelay(EPROM_DELAY);
>  }
>  
>  
> -void eprom_w(struct net_device *dev,short bit)
> +void eprom_w(struct net_device *dev, short bit)
>  {
> -	if(bit)
> -		write_nic_byte_E(dev, EPROM_CMD, (1<<EPROM_W_SHIFT) | \
> -			       read_nic_byte_E(dev,EPROM_CMD));
> +	if (bit)
> +		write_nic_byte_E(dev, EPROM_CMD, (1<<EPROM_W_SHIFT) |
> +			       read_nic_byte_E(dev, EPROM_CMD));
>  	else
> -		write_nic_byte_E(dev, EPROM_CMD, read_nic_byte_E(dev,EPROM_CMD)\
> -			       &~(1<<EPROM_W_SHIFT));
> +		write_nic_byte_E(dev, EPROM_CMD, read_nic_byte_E(dev, EPROM_CMD)
> +			       & ~(1<<EPROM_W_SHIFT));
>  
>  	force_pci_posting(dev);
>  	udelay(EPROM_DELAY);
> @@ -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?

No, please be painfully obvious, that's the only way to write kernel
code.  Not like this.

greg k-h

  reply	other threads:[~2012-06-20 23:08 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 [this message]
2012-06-20 23:18   ` Joe Perches
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=20120620230839.GA17883@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=devendra.aaru@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox