linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: busses: remove unneeded conversion to bool
@ 2020-04-20  4:28 Jason Yan
  2020-04-20  4:44 ` Bjorn Andersson
  2020-04-26  8:16 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Jason Yan @ 2020-04-20  4:28 UTC (permalink / raw)
  To: agross, bjorn.andersson, wsa, linux-arm-msm, linux-i2c, linux-kernel
  Cc: Jason Yan

The '>' expression itself is bool, no need to convert it to bool again.
This fixes the following coccicheck warning:

drivers/i2c/busses/i2c-qup.c:960:48-53: WARNING: conversion to bool not needed here
drivers/i2c/busses/i2c-qup.c:962:47-52: WARNING: conversion to bool not needed here
drivers/i2c/busses/i2c-qup.c:1531:29-34: WARNING: conversion to bool not needed here
drivers/i2c/busses/i2c-qup.c:1533:29-34: WARNING: conversion to bool not needed here

Signed-off-by: Jason Yan <yanaijie@huawei.com>
---
 drivers/i2c/busses/i2c-qup.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 155dcde70fc9..25d5fe2f8316 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -956,10 +956,8 @@ static void qup_i2c_conf_v1(struct qup_i2c_dev *qup)
 	u32 qup_config = I2C_MINI_CORE | I2C_N_VAL;
 	u32 io_mode = QUP_REPACK_EN;
 
-	blk->is_tx_blk_mode =
-		blk->total_tx_len > qup->out_fifo_sz ? true : false;
-	blk->is_rx_blk_mode =
-		blk->total_rx_len > qup->in_fifo_sz ? true : false;
+	blk->is_tx_blk_mode = blk->total_tx_len > qup->out_fifo_sz;
+	blk->is_rx_blk_mode = blk->total_rx_len > qup->in_fifo_sz;
 
 	if (blk->is_tx_blk_mode) {
 		io_mode |= QUP_OUTPUT_BLK_MODE;
@@ -1528,9 +1526,9 @@ qup_i2c_determine_mode_v2(struct qup_i2c_dev *qup,
 		qup->use_dma = true;
 	} else {
 		qup->blk.is_tx_blk_mode = max_tx_len > qup->out_fifo_sz -
-			QUP_MAX_TAGS_LEN ? true : false;
+			QUP_MAX_TAGS_LEN;
 		qup->blk.is_rx_blk_mode = max_rx_len > qup->in_fifo_sz -
-			READ_RX_TAGS_LEN ? true : false;
+			READ_RX_TAGS_LEN;
 	}
 
 	return 0;
-- 
2.21.1


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

* Re: [PATCH] i2c: busses: remove unneeded conversion to bool
  2020-04-20  4:28 [PATCH] i2c: busses: remove unneeded conversion to bool Jason Yan
@ 2020-04-20  4:44 ` Bjorn Andersson
  2020-04-26  8:16 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2020-04-20  4:44 UTC (permalink / raw)
  To: Jason Yan; +Cc: agross, wsa, linux-arm-msm, linux-i2c, linux-kernel

On Sun 19 Apr 21:28 PDT 2020, Jason Yan wrote:

> The '>' expression itself is bool, no need to convert it to bool again.
> This fixes the following coccicheck warning:
> 
> drivers/i2c/busses/i2c-qup.c:960:48-53: WARNING: conversion to bool not needed here
> drivers/i2c/busses/i2c-qup.c:962:47-52: WARNING: conversion to bool not needed here
> drivers/i2c/busses/i2c-qup.c:1531:29-34: WARNING: conversion to bool not needed here
> drivers/i2c/busses/i2c-qup.c:1533:29-34: WARNING: conversion to bool not needed here
> 
> Signed-off-by: Jason Yan <yanaijie@huawei.com>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> ---
>  drivers/i2c/busses/i2c-qup.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
> index 155dcde70fc9..25d5fe2f8316 100644
> --- a/drivers/i2c/busses/i2c-qup.c
> +++ b/drivers/i2c/busses/i2c-qup.c
> @@ -956,10 +956,8 @@ static void qup_i2c_conf_v1(struct qup_i2c_dev *qup)
>  	u32 qup_config = I2C_MINI_CORE | I2C_N_VAL;
>  	u32 io_mode = QUP_REPACK_EN;
>  
> -	blk->is_tx_blk_mode =
> -		blk->total_tx_len > qup->out_fifo_sz ? true : false;
> -	blk->is_rx_blk_mode =
> -		blk->total_rx_len > qup->in_fifo_sz ? true : false;
> +	blk->is_tx_blk_mode = blk->total_tx_len > qup->out_fifo_sz;
> +	blk->is_rx_blk_mode = blk->total_rx_len > qup->in_fifo_sz;
>  
>  	if (blk->is_tx_blk_mode) {
>  		io_mode |= QUP_OUTPUT_BLK_MODE;
> @@ -1528,9 +1526,9 @@ qup_i2c_determine_mode_v2(struct qup_i2c_dev *qup,
>  		qup->use_dma = true;
>  	} else {
>  		qup->blk.is_tx_blk_mode = max_tx_len > qup->out_fifo_sz -
> -			QUP_MAX_TAGS_LEN ? true : false;
> +			QUP_MAX_TAGS_LEN;
>  		qup->blk.is_rx_blk_mode = max_rx_len > qup->in_fifo_sz -
> -			READ_RX_TAGS_LEN ? true : false;
> +			READ_RX_TAGS_LEN;
>  	}
>  
>  	return 0;
> -- 
> 2.21.1
> 

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

* Re: [PATCH] i2c: busses: remove unneeded conversion to bool
  2020-04-20  4:28 [PATCH] i2c: busses: remove unneeded conversion to bool Jason Yan
  2020-04-20  4:44 ` Bjorn Andersson
@ 2020-04-26  8:16 ` Wolfram Sang
  2020-04-26  8:44   ` Jason Yan
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2020-04-26  8:16 UTC (permalink / raw)
  To: Jason Yan; +Cc: agross, bjorn.andersson, linux-arm-msm, linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 691 bytes --]

On Mon, Apr 20, 2020 at 12:28:16PM +0800, Jason Yan wrote:
> The '>' expression itself is bool, no need to convert it to bool again.
> This fixes the following coccicheck warning:
> 
> drivers/i2c/busses/i2c-qup.c:960:48-53: WARNING: conversion to bool not needed here
> drivers/i2c/busses/i2c-qup.c:962:47-52: WARNING: conversion to bool not needed here
> drivers/i2c/busses/i2c-qup.c:1531:29-34: WARNING: conversion to bool not needed here
> drivers/i2c/busses/i2c-qup.c:1533:29-34: WARNING: conversion to bool not needed here
> 
> Signed-off-by: Jason Yan <yanaijie@huawei.com>

Applied to for-next, thanks! But please fix $subject to have the driver
name "qup" next time.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] i2c: busses: remove unneeded conversion to bool
  2020-04-26  8:16 ` Wolfram Sang
@ 2020-04-26  8:44   ` Jason Yan
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Yan @ 2020-04-26  8:44 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: agross, bjorn.andersson, linux-arm-msm, linux-i2c, linux-kernel



在 2020/4/26 16:16, Wolfram Sang 写道:
> On Mon, Apr 20, 2020 at 12:28:16PM +0800, Jason Yan wrote:
>> The '>' expression itself is bool, no need to convert it to bool again.
>> This fixes the following coccicheck warning:
>>
>> drivers/i2c/busses/i2c-qup.c:960:48-53: WARNING: conversion to bool not needed here
>> drivers/i2c/busses/i2c-qup.c:962:47-52: WARNING: conversion to bool not needed here
>> drivers/i2c/busses/i2c-qup.c:1531:29-34: WARNING: conversion to bool not needed here
>> drivers/i2c/busses/i2c-qup.c:1533:29-34: WARNING: conversion to bool not needed here
>>
>> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> 
> Applied to for-next, thanks! But please fix $subject to have the driver
> name "qup" next time.
> 

OK, get it.

Thanks,
Jason


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

end of thread, other threads:[~2020-04-26  8:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20  4:28 [PATCH] i2c: busses: remove unneeded conversion to bool Jason Yan
2020-04-20  4:44 ` Bjorn Andersson
2020-04-26  8:16 ` Wolfram Sang
2020-04-26  8:44   ` Jason Yan

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