Skip to contentSkip to conversation

staging: rtl8712: Fix Comparison with constant warning.

PATCH In review Pinkesh Badjatiya 3 participants 4 messages Feb 6, 2016 – Feb 8, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8712: Fix Comparison with constant warning.

Fix Comparisons with constant on the left side of the test. Checkpatch.pl warning.
--
WARNING: Comparisons should place the constant on the right side of the test
296: FILE: ./rtl8712_cmd.c:296:

	while ((0 != r8712_read32(pAdapter, IOCMD_CTRL_REG)) &&
---
 drivers/staging/rtl8712/rtl8712_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl8712_cmd.c +1 -1
index 9b91609..ce3f7da 100644
@@ -293,7 +293,7 @@ u8 r8712_fw_cmd(struct _adapter *pAdapter, u32 cmd)
 
 	r8712_write32(pAdapter, IOCMD_CTRL_REG, cmd);
 	msleep(100);
-	while ((0 != r8712_read32(pAdapter, IOCMD_CTRL_REG)) &&
+	while ((r8712_read32(pAdapter, IOCMD_CTRL_REG) != 0) &&
 	       (pollingcnts > 0)) {
 		pollingcnts--;
 		msleep(20);
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Pinkesh Badjatiya

Fix Comparisons with constant on the left side of the test. Checkpatch.pl warning.
--
WARNING: Comparisons should place the constant on the right side of the test
296: FILE: ./rtl8712_cmd.c:296:

Quoted 6 lines
	while ((0 != r8712_read32(pAdapter, IOCMD_CTRL_REG)) &&
---
  drivers/staging/rtl8712/rtl8712_cmd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

This is another case where the writers of checkpatch are forcing their ideas of style on the whole world. The problem is that if I reject your patch, it will be submitted by someone else. Thus, reluctantly

Quoted 15 lines
drivers/staging/rtl8712/rtl8712_cmd.c +1 -1
index 9b91609..ce3f7da 100644
@@ -293,7 +293,7 @@ u8 r8712_fw_cmd(struct _adapter *pAdapter, u32 cmd)
 
  	r8712_write32(pAdapter, IOCMD_CTRL_REG, cmd);
  	msleep(100);
-	while ((0 != r8712_read32(pAdapter, IOCMD_CTRL_REG)) &&
+	while ((r8712_read32(pAdapter, IOCMD_CTRL_REG) != 0) &&
  	       (pollingcnts > 0)) {
  		pollingcnts--;
  		msleep(20);
#2 lore raw
Quoted 14 lines · Larry Finger
Quoted 6 lines · Pinkesh Badjatiya

Fix Comparisons with constant on the left side of the test. Checkpatch.pl warning.
--
WARNING: Comparisons should place the constant on the right side of the test
296: FILE: ./rtl8712_cmd.c:296:

Quoted 6 lines
	while ((0 != r8712_read32(pAdapter, IOCMD_CTRL_REG)) &&
---
 drivers/staging/rtl8712/rtl8712_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines

This is another case where the writers of checkpatch are forcing their ideas of style on the whole world. The problem is that if I reject your patch, it will be submitted by someone else. Thus, reluctantly

Well, the general kernel coding style is to put constants on the right hand of the expression, so it is good to have it this way...

thanks,

greg k-h

#3 lore raw
In reply to Pinkesh Badjatiya
Quoted 6 lines · Pinkesh Badjatiya

Fix Comparisons with constant on the left side of the test. Checkpatch.pl warning.
--
WARNING: Comparisons should place the constant on the right side of the test
296: FILE: ./rtl8712_cmd.c:296:

Quoted 7 lines
	while ((0 != r8712_read32(pAdapter, IOCMD_CTRL_REG)) &&
---
 drivers/staging/rtl8712/rtl8712_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Someone else sent this before you did, sorry :(