linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Nishad Kamdar <nishadkamdar@gmail.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	NeilBrown <neil@brown.name>, "Joe Perches" <joe@perches.com>,
	"Christian Lütke-Stetzkamp" <christian@lkamp.de>,
	"Dan Carpenter" <dan.carpenter@oracle.com>,
	"John Crispin" <blogic@openwrt.org>
Subject: Re: [PATCH] staging: mt7621-mmc: Remove do {} while (0) loop for single statement macro
Date: Tue, 18 Sep 2018 13:27:11 +0200	[thread overview]
Message-ID: <20180918112711.GA14453@kroah.com> (raw)
In-Reply-To: <20180915131748.GA19661@nishad>

On Sat, Sep 15, 2018 at 06:47:51PM +0530, Nishad Kamdar wrote:
> This patch removes do {} while (0) loop for single statement macros.
> Issue found by checkpatch.
> 
> Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
> ---
>  drivers/staging/mt7621-mmc/sd.c | 28 +++++++---------------------
>  1 file changed, 7 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index 7474f9ed7b5b..ec12a3a5a926 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -104,14 +104,10 @@ static int cd_active_low = 1;
>  /* gate means clock power down */
>  static int g_clk_gate = 0;
>  #define msdc_gate_clock(id) \
> -	do {					       \
> -		g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN));	\
> -	} while (0)
> +	(g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)))

This should become an inline function, right?


>  /* not like power down register. 1 means clock on. */
>  #define msdc_ungate_clock(id) \
> -	do {					    \
> -		g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN);	\
> -	} while (0)
> +	(g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN))

Same here.

>  
>  // do we need sync object or not
>  void msdc_clk_status(int *status)
> @@ -170,9 +166,7 @@ static void msdc_clr_fifo(struct msdc_host *host)
>  	} while (0)
>  
>  #define msdc_irq_restore(val) \
> -	do {					\
> -		sdr_set_bits(host->base + MSDC_INTEN, val);	\
> -	} while (0)
> +	(sdr_set_bits(host->base + MSDC_INTEN, val))

Just call the one function where this is used and delete this #define.

Same type of changes for the rest of these as well.

thanks,

greg k-h

  parent reply	other threads:[~2018-09-18 11:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-15 13:17 [PATCH] staging: mt7621-mmc: Remove do {} while (0) loop for single statement macro Nishad Kamdar
2018-09-17 16:20 ` Joe Perches
2018-09-18 11:27 ` Greg Kroah-Hartman [this message]
2018-09-23  9:34   ` Nishad Kamdar

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=20180918112711.GA14453@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=blogic@openwrt.org \
    --cc=christian@lkamp.de \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=nishadkamdar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).