All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Gorskin Ilya <revent82@gmail.com>
Cc: gregkh@linuxfoundation.org, klmckinney1@gmail.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] Staging:bcm: fix coding style error in InterfaceIsr.c
Date: Tue, 25 Sep 2012 09:37:44 +0300	[thread overview]
Message-ID: <20120925063744.GP4587@mwanda> (raw)
In-Reply-To: <1348549469-7222-1-git-send-email-revent82@gmail.com>

On Tue, Sep 25, 2012 at 11:04:28AM +0600, Gorskin Ilya wrote:
> -	if(((Adapter->bPreparingForLowPowerMode == TRUE) && (Adapter->bDoSuspend == TRUE)) ||
> -		psIntfAdapter->bSuspended ||
> -		psIntfAdapter->bPreparingForBusSuspend)
> -	{
> -			BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Interrupt call back is called while suspending the device");
> +	if (((Adapter->bPreparingForLowPowerMode == TRUE) &&
> +				(Adapter->bDoSuspend == TRUE)) ||
> +				psIntfAdapter->bSuspended ||
> +				psIntfAdapter->bPreparingForBusSuspend) {
> +			BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
> +					DBG_LVL_ALL,
> +					"Interrupt call back is called
> +					while suspending the device");
>  			return ;

Hi,

Thanks for doing this, these changes are welcome.  However, they
should be done slightly differently.

Take one type of checkpatch warning at a time and fix that one over
the file, then do a separate patch for the next type of warning.
[patch 1/2] Staging: bcm: move curly braces in InterfaceIsr.c
[patch 2/2] Staging: bcm: clean up conditions in InterfaceIsr.c

Something like that.

Also the way you've indented the condition is not right.  The
conditions which are && together should line up like this:

	if (((Adapter->bPreparingForLowPowerMode == TRUE) &&
	     (Adapter->bDoSuspend == TRUE)) ||
	    psIntfAdapter->bSuspended ||
	    psIntfAdapter->bPreparingForBusSuspend) {

Also the condition has too many parenthesis.  Everyone knows how the
precedence works in:
	if (foo == 3 || bar == 4) {
We don't need to specify:
	if ((foo == 3) || (bar == 4)) {

Putting extra parenthesis make the code harder to read and has lead
to == vs = bugs which would have been caught by gcc:
warning: suggest parentheses around assignment used as truth value [-Wparentheses]

Also can we just leave off the "== TRUE", or is this a case where it
can "== TRUE", "== FALSE", and "== FILENOTFOUND"?

Finally, this is not quoted correctly.
> +                                     "Interrupt call back is called
> +                                     while suspending the device");
Don't break those string literals up across multiple lines, but if
you do then you need to add quotes.
					"Interrupt call back is called"
					                              ^
					"while suspending the device");
					^

regards,
dan carpenter



      parent reply	other threads:[~2012-09-25  6:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25  5:04 [PATCH 2/3] Staging:bcm: fix coding style error in InterfaceIsr.c Gorskin Ilya
2012-09-25  5:04 ` [PATCH 3/3] " Gorskin Ilya
2012-09-25  6:53   ` Dan Carpenter
2012-09-25  6:37 ` Dan Carpenter [this message]

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=20120925063744.GP4587@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=klmckinney1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=revent82@gmail.com \
    /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.