Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1606458 > unrolled thread

[PATCH v2] staging: rts5208: Replace a bit shift by a use of BIT.

Started byArushi Singhal <arushisinghal19971997@gmail.com>
First post2017-03-22 14:20 +0100
Last post2017-03-22 14:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] staging: rts5208: Replace a bit shift by a use of BIT. Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-22 14:20 +0100
    Re: [Outreachy kernel] [PATCH v2] staging: rts5208: Replace a bit  shift by a use of BIT. Julia Lawall <julia.lawall@lip6.fr> - 2017-03-22 14:30 +0100

#1606458 — [PATCH v2] staging: rts5208: Replace a bit shift by a use of BIT.

FromArushi Singhal <arushisinghal19971997@gmail.com>
Date2017-03-22 14:20 +0100
Subject[PATCH v2] staging: rts5208: Replace a bit shift by a use of BIT.
Message-ID<tnOlb-2UB-5@gated-at.bofh.it>
This patch replaces bit shifting on 1 with the BIT(x) macro.
This was done with coccinelle:
@@
constant c;
@@

-1 << c
+BIT(c)

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
changes in v2
 - remove the unnecessary parenthesis.

 drivers/staging/rts5208/rtsx_chip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
index 3511157a2c78..7f4107bffe31 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -1490,7 +1490,7 @@ int rtsx_write_register(struct rtsx_chip *chip, u16 addr, u8 mask, u8 data)
 
 	for (i = 0; i < MAX_RW_REG_CNT; i++) {
 		val = rtsx_readl(chip, RTSX_HAIMR);
-		if ((val & (1 << 31)) == 0) {
+		if ((val & BIT(31)) == 0) {
 			if (data != (u8)val) {
 				rtsx_trace(chip);
 				return STATUS_FAIL;
@@ -1518,7 +1518,7 @@ int rtsx_read_register(struct rtsx_chip *chip, u16 addr, u8 *data)
 
 	for (i = 0; i < MAX_RW_REG_CNT; i++) {
 		val = rtsx_readl(chip, RTSX_HAIMR);
-		if ((val & (1 << 31)) == 0)
+		if ((val & BIT(31)) == 0)
 			break;
 	}
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1606482 — Re: [Outreachy kernel] [PATCH v2] staging: rts5208: Replace a bit shift by a use of BIT.

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-03-22 14:30 +0100
SubjectRe: [Outreachy kernel] [PATCH v2] staging: rts5208: Replace a bit shift by a use of BIT.
Message-ID<tnOuS-32T-35@gated-at.bofh.it>
In reply to#1606458

On Wed, 22 Mar 2017, Arushi Singhal wrote:

> This patch replaces bit shifting on 1 with the BIT(x) macro.
> This was done with coccinelle:
> @@
> constant c;
> @@
>
> -1 << c
> +BIT(c)
>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>

Acked-by: Julia Lawall <julia.lawall@lip6.fr>

> ---
> changes in v2
>  - remove the unnecessary parenthesis.
>
>  drivers/staging/rts5208/rtsx_chip.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
> index 3511157a2c78..7f4107bffe31 100644
> --- a/drivers/staging/rts5208/rtsx_chip.c
> +++ b/drivers/staging/rts5208/rtsx_chip.c
> @@ -1490,7 +1490,7 @@ int rtsx_write_register(struct rtsx_chip *chip, u16 addr, u8 mask, u8 data)
>
>  	for (i = 0; i < MAX_RW_REG_CNT; i++) {
>  		val = rtsx_readl(chip, RTSX_HAIMR);
> -		if ((val & (1 << 31)) == 0) {
> +		if ((val & BIT(31)) == 0) {
>  			if (data != (u8)val) {
>  				rtsx_trace(chip);
>  				return STATUS_FAIL;
> @@ -1518,7 +1518,7 @@ int rtsx_read_register(struct rtsx_chip *chip, u16 addr, u8 *data)
>
>  	for (i = 0; i < MAX_RW_REG_CNT; i++) {
>  		val = rtsx_readl(chip, RTSX_HAIMR);
> -		if ((val & (1 << 31)) == 0)
> +		if ((val & BIT(31)) == 0)
>  			break;
>  	}
>
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170322131757.GA5335%40arushi-HP-Pavilion-Notebook.
> For more options, visit https://groups.google.com/d/optout.
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web