linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: host: atmel-mci: assign false/true to bool variable
@ 2019-09-18 17:28 Saiyam Doshi
  2019-09-18 18:01 ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Saiyam Doshi @ 2019-09-18 17:28 UTC (permalink / raw)
  To: ludovic.desroches, ulf.hansson, nicolas.ferre, alexandre.belloni
  Cc: linux-mmc, linux-kernel

Use false/true instead of 0/1 in bool variable assignment.

This fixes below coccicheck warning.
"WARNING: Assignment of 0/1 to bool variable"

Generated by: scripts/coccinelle/misc/boolinit.cocci

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Saiyam Doshi <saiyamdoshi.in@gmail.com>
---
 drivers/mmc/host/atmel-mci.c | 50 ++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index c26fbe5f2222..91088b1712ae 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -706,7 +706,7 @@ static void atmci_timeout_timer(struct timer_list *t)
 		host->mrq->cmd->error = -ETIMEDOUT;
 		host->cmd = NULL;
 	}
-	host->need_reset = 1;
+	host->need_reset = true;
 	host->state = STATE_END_REQUEST;
 	smp_wmb();
 	tasklet_schedule(&host->tasklet);
@@ -1610,7 +1610,7 @@ static void atmci_command_complete(struct atmel_mci *host,
 	else if (host->mrq->data && (host->mrq->data->blksz & 3)) {
 		if (host->caps.need_blksz_mul_4) {
 			cmd->error = -EINVAL;
-			host->need_reset = 1;
+			host->need_reset = true;
 		}
 	} else
 		cmd->error = 0;
@@ -2396,45 +2396,45 @@ static void atmci_get_cap(struct atmel_mci *host)
 	dev_info(&host->pdev->dev,
 			"version: 0x%x\n", version);
 
-	host->caps.has_dma_conf_reg = 0;
-	host->caps.has_pdc = 1;
-	host->caps.has_cfg_reg = 0;
-	host->caps.has_cstor_reg = 0;
-	host->caps.has_highspeed = 0;
-	host->caps.has_rwproof = 0;
-	host->caps.has_odd_clk_div = 0;
-	host->caps.has_bad_data_ordering = 1;
-	host->caps.need_reset_after_xfer = 1;
-	host->caps.need_blksz_mul_4 = 1;
-	host->caps.need_notbusy_for_read_ops = 0;
+	host->caps.has_dma_conf_reg = false;
+	host->caps.has_pdc = true;
+	host->caps.has_cfg_reg = false;
+	host->caps.has_cstor_reg = false;
+	host->caps.has_highspeed = false;
+	host->caps.has_rwproof = false;
+	host->caps.has_odd_clk_div = false;
+	host->caps.has_bad_data_ordering = true;
+	host->caps.need_reset_after_xfer = true;
+	host->caps.need_blksz_mul_4 = true;
+	host->caps.need_notbusy_for_read_ops = false;
 
 	/* keep only major version number */
 	switch (version & 0xf00) {
 	case 0x600:
 	case 0x500:
-		host->caps.has_odd_clk_div = 1;
+		host->caps.has_odd_clk_div = true;
 		/* Fall through */
 	case 0x400:
 	case 0x300:
-		host->caps.has_dma_conf_reg = 1;
-		host->caps.has_pdc = 0;
-		host->caps.has_cfg_reg = 1;
-		host->caps.has_cstor_reg = 1;
-		host->caps.has_highspeed = 1;
+		host->caps.has_dma_conf_reg = true;
+		host->caps.has_pdc = false;
+		host->caps.has_cfg_reg = true;
+		host->caps.has_cstor_reg = true;
+		host->caps.has_highspeed = true;
 		/* Fall through */
 	case 0x200:
-		host->caps.has_rwproof = 1;
-		host->caps.need_blksz_mul_4 = 0;
-		host->caps.need_notbusy_for_read_ops = 1;
+		host->caps.has_rwproof = true;
+		host->caps.need_blksz_mul_4 = false;
+		host->caps.need_notbusy_for_read_ops = true;
 		/* Fall through */
 	case 0x100:
-		host->caps.has_bad_data_ordering = 0;
-		host->caps.need_reset_after_xfer = 0;
+		host->caps.has_bad_data_ordering = false;
+		host->caps.need_reset_after_xfer = false;
 		/* Fall through */
 	case 0x0:
 		break;
 	default:
-		host->caps.has_pdc = 0;
+		host->caps.has_pdc = false;
 		dev_warn(&host->pdev->dev,
 				"Unmanaged mci version, set minimum capabilities\n");
 		break;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: host: atmel-mci: assign false/true to bool variable
  2019-09-18 17:28 [PATCH] mmc: host: atmel-mci: assign false/true to bool variable Saiyam Doshi
@ 2019-09-18 18:01 ` Alexandre Belloni
  2019-09-22 16:49   ` Saiyam Doshi
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2019-09-18 18:01 UTC (permalink / raw)
  To: Saiyam Doshi
  Cc: ludovic.desroches, ulf.hansson, nicolas.ferre, linux-mmc,
	linux-kernel

Hello,

On 18/09/2019 22:58:23+0530, Saiyam Doshi wrote:
> Use false/true instead of 0/1 in bool variable assignment.
> 
> This fixes below coccicheck warning.
> "WARNING: Assignment of 0/1 to bool variable"
> 
> Generated by: scripts/coccinelle/misc/boolinit.cocci
> 
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
> 

More useful than information than info on semantic patching, it would be
good to have info on why you feel this is necessary.

> Signed-off-by: Saiyam Doshi <saiyamdoshi.in@gmail.com>
> ---
>  drivers/mmc/host/atmel-mci.c | 50 ++++++++++++++++++------------------
>  1 file changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index c26fbe5f2222..91088b1712ae 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -706,7 +706,7 @@ static void atmci_timeout_timer(struct timer_list *t)
>  		host->mrq->cmd->error = -ETIMEDOUT;
>  		host->cmd = NULL;
>  	}
> -	host->need_reset = 1;
> +	host->need_reset = true;
>  	host->state = STATE_END_REQUEST;
>  	smp_wmb();
>  	tasklet_schedule(&host->tasklet);
> @@ -1610,7 +1610,7 @@ static void atmci_command_complete(struct atmel_mci *host,
>  	else if (host->mrq->data && (host->mrq->data->blksz & 3)) {
>  		if (host->caps.need_blksz_mul_4) {
>  			cmd->error = -EINVAL;
> -			host->need_reset = 1;
> +			host->need_reset = true;
>  		}
>  	} else
>  		cmd->error = 0;
> @@ -2396,45 +2396,45 @@ static void atmci_get_cap(struct atmel_mci *host)
>  	dev_info(&host->pdev->dev,
>  			"version: 0x%x\n", version);
>  
> -	host->caps.has_dma_conf_reg = 0;
> -	host->caps.has_pdc = 1;
> -	host->caps.has_cfg_reg = 0;
> -	host->caps.has_cstor_reg = 0;
> -	host->caps.has_highspeed = 0;
> -	host->caps.has_rwproof = 0;
> -	host->caps.has_odd_clk_div = 0;
> -	host->caps.has_bad_data_ordering = 1;
> -	host->caps.need_reset_after_xfer = 1;
> -	host->caps.need_blksz_mul_4 = 1;
> -	host->caps.need_notbusy_for_read_ops = 0;
> +	host->caps.has_dma_conf_reg = false;
> +	host->caps.has_pdc = true;
> +	host->caps.has_cfg_reg = false;
> +	host->caps.has_cstor_reg = false;
> +	host->caps.has_highspeed = false;
> +	host->caps.has_rwproof = false;
> +	host->caps.has_odd_clk_div = false;
> +	host->caps.has_bad_data_ordering = true;
> +	host->caps.need_reset_after_xfer = true;
> +	host->caps.need_blksz_mul_4 = true;
> +	host->caps.need_notbusy_for_read_ops = false;
>  
>  	/* keep only major version number */
>  	switch (version & 0xf00) {
>  	case 0x600:
>  	case 0x500:
> -		host->caps.has_odd_clk_div = 1;
> +		host->caps.has_odd_clk_div = true;
>  		/* Fall through */
>  	case 0x400:
>  	case 0x300:
> -		host->caps.has_dma_conf_reg = 1;
> -		host->caps.has_pdc = 0;
> -		host->caps.has_cfg_reg = 1;
> -		host->caps.has_cstor_reg = 1;
> -		host->caps.has_highspeed = 1;
> +		host->caps.has_dma_conf_reg = true;
> +		host->caps.has_pdc = false;
> +		host->caps.has_cfg_reg = true;
> +		host->caps.has_cstor_reg = true;
> +		host->caps.has_highspeed = true;
>  		/* Fall through */
>  	case 0x200:
> -		host->caps.has_rwproof = 1;
> -		host->caps.need_blksz_mul_4 = 0;
> -		host->caps.need_notbusy_for_read_ops = 1;
> +		host->caps.has_rwproof = true;
> +		host->caps.need_blksz_mul_4 = false;
> +		host->caps.need_notbusy_for_read_ops = true;
>  		/* Fall through */
>  	case 0x100:
> -		host->caps.has_bad_data_ordering = 0;
> -		host->caps.need_reset_after_xfer = 0;
> +		host->caps.has_bad_data_ordering = false;
> +		host->caps.need_reset_after_xfer = false;
>  		/* Fall through */
>  	case 0x0:
>  		break;
>  	default:
> -		host->caps.has_pdc = 0;
> +		host->caps.has_pdc = false;
>  		dev_warn(&host->pdev->dev,
>  				"Unmanaged mci version, set minimum capabilities\n");
>  		break;
> -- 
> 2.20.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: host: atmel-mci: assign false/true to bool variable
  2019-09-18 18:01 ` Alexandre Belloni
@ 2019-09-22 16:49   ` Saiyam Doshi
  0 siblings, 0 replies; 3+ messages in thread
From: Saiyam Doshi @ 2019-09-22 16:49 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: ludovic.desroches, ulf.hansson, nicolas.ferre, linux-mmc,
	linux-kernel

On Wed, Sep 18, 2019 at 08:01:12PM +0200, Alexandre Belloni wrote:
> More useful than information than info on semantic patching, it would be
> good to have info on why you feel this is necessary.

Sure, will update the changelog and resend.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-22 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-18 17:28 [PATCH] mmc: host: atmel-mci: assign false/true to bool variable Saiyam Doshi
2019-09-18 18:01 ` Alexandre Belloni
2019-09-22 16:49   ` Saiyam Doshi

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).