linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Tony Cho <tony.cho@atmel.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	rachel.kim@atmel.com, chris.park@atmel.com,
	austin.shin@atmel.com, linux-wireless@vger.kernel.org,
	johnny.kim@atmel.com, Nicolas.FERRE@atmel.com,
	robin.hwang@atmel.com, jude.lee@atmel.com, leo.kim@atmel.com
Subject: Re: [PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions
Date: Thu, 30 Jul 2015 17:26:48 +0530	[thread overview]
Message-ID: <20150730115647.GA12823@sudip-pc> (raw)
In-Reply-To: <1438247414-19708-2-git-send-email-tony.cho@atmel.com>

On Thu, Jul 30, 2015 at 06:10:10PM +0900, Tony Cho wrote:
> This patch lets preprocessor conditionals (#ifdef) related to
> WILC_SDIO_IRQ_GPIO to compile out the entire functions. Compiling out
> the entire functions is preferred rather than portions of functions or
> expressions becausue doing so makes code harder to read.
> 
> Signed-off-by: Tony Cho <tony.cho@atmel.com>
> ---
<snip>
>  
> +#ifdef WILC_SDIO_IRQ_GPIO
>  static int sdio_clear_int(void)
>  {
> -#ifndef WILC_SDIO_IRQ_GPIO
> -	/* uint32_t sts; */
> -	sdio_cmd52_t cmd;
> -
> -	cmd.read_write = 0;
> -	cmd.function = 1;
> -	cmd.raw = 0;
> -	cmd.address = 0x4;
> -	cmd.data = 0;
> -	g_sdio.sdio_cmd52(&cmd);
> -	int_clrd++;
> -
> -	return cmd.data;
> -#else
>  	uint32_t reg;
>  
>  	if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
> @@ -181,9 +168,23 @@ static int sdio_clear_int(void)
>  	sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
>  	int_clrd++;
>  	return 1;
> -#endif
> +}
> +#else
> +static int sdio_clear_int(void)
> +{
> +	sdio_cmd52_t cmd;
> +
> +	cmd.read_write = 0;
> +	cmd.function = 1;
> +	cmd.raw = 0;
> +	cmd.address = 0x4;
> +	cmd.data = 0;
> +	g_sdio.sdio_cmd52(&cmd);
> +	int_clrd++;
>  
> +	return cmd.data;
>  }
> +#endif /* WILC_SDIO_IRQ_GPIO */
instead of changing #ifndef to #ifdef i think the following would have
been easier:

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 5a18148..5cd4d45 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -155,9 +155,9 @@ _fail_:
 	return 0;
 }
 
+#ifndef WILC_SDIO_IRQ_GPIO
 static int sdio_clear_int(void)
 {
-#ifndef WILC_SDIO_IRQ_GPIO
 	/* uint32_t sts; */
 	sdio_cmd52_t cmd;
 
@@ -170,7 +170,10 @@ static int sdio_clear_int(void)
 	int_clrd++;
 
 	return cmd.data;
+}
 #else
+static int sdio_clear_int(void)
+{
 	uint32_t reg;
 
 	if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, &reg)) {
@@ -181,9 +184,8 @@ static int sdio_clear_int(void)
 	sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
 	int_clrd++;
 	return 1;
-#endif
-
 }
+#endif
 
 uint32_t sdio_xfer_cnt(void)
 {

>  
>  uint32_t sdio_xfer_cnt(void)
<snip>
> +#ifdef WILC_SDIO_IRQ_GPIO
>  static int sdio_clear_int_ext(uint32_t val)
>  {
>  	int ret;
>  
> -	if (g_sdio.has_thrpt_enh3) {
> +	if(g_sdio.has_thrpt_enh3) {
why changing this? The original style is according to the kernel coding
style.

regards
sudip

  parent reply	other threads:[~2015-07-30 11:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30  9:10 [PATCH 0/5] 2nd patch for illegal coding style Tony Cho
2015-07-30  9:10 ` [PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions Tony Cho
2015-07-30  9:19   ` Johnny Kim
2015-07-30 11:56   ` Sudip Mukherjee [this message]
     [not found]     ` <55BAEB08.8090705@atmel.com>
2015-07-31  3:48       ` Greg KH
2015-07-30  9:10 ` [PATCH V2 2/5] staging: wilc1000: remove unnecessary blank lines Tony Cho
2015-07-30  9:10 ` [PATCH V2 3/5] staging: wilc1000: remove warnings on missing blank line Tony Cho
2015-07-30 12:10   ` Sudip Mukherjee
2015-07-30  9:10 ` [PATCH V2 4/5] staging: wilc1000: remove errors on required space Tony Cho
2015-07-30  9:10 ` [PATCH V2 5/5] staging: wilc1000: remove unused functions Tony Cho
2015-07-31  3:49 ` [PATCH 0/5] 2nd patch for illegal coding style Greg KH

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=20150730115647.GA12823@sudip-pc \
    --to=sudipm.mukherjee@gmail.com \
    --cc=Nicolas.FERRE@atmel.com \
    --cc=austin.shin@atmel.com \
    --cc=chris.park@atmel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnny.kim@atmel.com \
    --cc=jude.lee@atmel.com \
    --cc=leo.kim@atmel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rachel.kim@atmel.com \
    --cc=robin.hwang@atmel.com \
    --cc=tony.cho@atmel.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).