Skip to contentSkip to conversation

staging: rts5208: Replace a bit shift by a use of BIT.

PATCH In review Arushi Singhal 2 participants 2 messages Mar 22, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rts5208: Replace a bit shift by a use of BIT.

This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@

-1 << c
+BIT(c)

---
 drivers/staging/rts5208/rtsx_chip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/rtsx_chip.c +2 -2
index 3511157a2c78..06a61800b71a 100644
@@ -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;
 	}
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 19 lines · Arushi Singhal

This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@

-1 << c
+BIT(c)

---
 drivers/staging/rts5208/rtsx_chip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rts5208/rtsx_chip.c +0 -0
index 3511157a2c78..06a61800b71a 100644

drivers/staging/rts5208/rtsx_chip.c int rtsx_write_register(struct rtsx_chip *chip, u16 addr, u8 mask, u8 data) · line 1493

Quoted 5 lines
drivers/staging/rts5208/rtsx_chip.c +1 -1
@@ -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) {

Extra parens. Please check all your patches again.

regards,
dan carpenter