staging: rts5208: Place constants on the right side of comparisons
PATCH 1/1 staging: rts5208: Place constants on the right side of comparisons
Constants should be placed on the right hand side of comparisons. This issue was identified by checkpatch.
--- drivers/staging/rts5208/sd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/staging/rts5208/sd.c +10 -10
@@ -4260,10 +4260,10 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip)return TRANSPORT_FAILED ; } -if ((0x53 != srb->cmnd[2 ]) || (0x44 != srb->cmnd[3 ]) || - (0x20 != srb->cmnd[4 ]) || (0x43 != srb->cmnd[5 ]) || - (0x61 != srb->cmnd[6 ]) || (0x72 != srb->cmnd[7 ]) || - (0x64 != srb->cmnd[8 ])) { +if ((srb->cmnd[2 ] !=0x53 ) || (srb->cmnd[3 ] !=0x44 ) || + (srb->cmnd[4 ] !=0x20 ) || (srb->cmnd[5 ] !=0x43 ) || + (srb->cmnd[6 ] !=0x61 ) || (srb->cmnd[7 ] !=0x72 ) || + (srb->cmnd[8 ] !=0x64 )) {set_sense_type (chip, lun,SENSE_TYPE_MEDIA_INVALID_CMD_FIELD );rtsx_trace (chip);return TRANSPORT_FAILED ;
@@ -4284,7 +4284,7 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip)return TRANSPORT_FAILED ; } - buf[5 ] = (1 ==CHK_SD (sd_card)) ?0x01 :0x02 ; + buf[5 ] = (CHK_SD (sd_card) ==1 ) ?0x01 :0x02 ;if (chip->card_wp &SD_CARD ) buf[5 ] |=0x80 ;
@@ -5176,10 +5176,10 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip)return TRANSPORT_FAILED ; } -if ((0x53 != srb->cmnd[2 ]) || (0x44 != srb->cmnd[3 ]) || - (0x20 != srb->cmnd[4 ]) || (0x43 != srb->cmnd[5 ]) || - (0x61 != srb->cmnd[6 ]) || (0x72 != srb->cmnd[7 ]) || - (0x64 != srb->cmnd[8 ])) { +if ((srb->cmnd[2 ] !=0x53 ) || (srb->cmnd[3 ] !=0x44 ) || + (srb->cmnd[4 ] !=0x20 ) || (srb->cmnd[5 ] !=0x43 ) || + (srb->cmnd[6 ] !=0x61 ) || (srb->cmnd[7 ] !=0x72 ) || + (srb->cmnd[8 ] !=0x64 )) {set_sense_type (chip, lun,SENSE_TYPE_MEDIA_INVALID_CMD_FIELD );rtsx_trace (chip);return TRANSPORT_FAILED ;
@@ -5188,7 +5188,7 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip)switch (srb->cmnd[1 ] &0x0F ) {case 0 :#ifdef SUPPORT_SD_LOCK -if (0x64 == srb->cmnd[9 ]) +if (srb->cmnd[9 ] ==0x64 ) sd_card->sd_lock_status |=SD_SDR_RST ;#endif retval =reset_sd_card (chip);
Signature · 1 line
2.5.0
Quoted 2 lines · Janani Ravichandran
Constants should be placed on the right hand side of comparisons. This issue was identified by checkpatch.
There is a semantic patch in the kernel that makes this change for you. At the moment, it makes the change in some cases where it is not really necessary, but when you have decided that it is necessary, it could be safer to use the semantic patch than to do it by hand.
misc/compare_const_fl.cocci
Nothing to change in the patch though.
julia
Quoted 67 lines
Signed-off-by Janani Ravichandran <[email protected]>--- drivers/staging/rts5208/sd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)drivers/staging/rts5208/sd.c +10
-10@@ -4260,10 +4260,10 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip)return TRANSPORT_FAILED ; } -if ((0x53 != srb->cmnd[2 ]) || (0x44 != srb->cmnd[3 ]) || - (0x20 != srb->cmnd[4 ]) || (0x43 != srb->cmnd[5 ]) || - (0x61 != srb->cmnd[6 ]) || (0x72 != srb->cmnd[7 ]) || - (0x64 != srb->cmnd[8 ])) { +if ((srb->cmnd[2 ] !=0x53 ) || (srb->cmnd[3 ] !=0x44 ) || + (srb->cmnd[4 ] !=0x20 ) || (srb->cmnd[5 ] !=0x43 ) || + (srb->cmnd[6 ] !=0x61 ) || (srb->cmnd[7 ] !=0x72 ) || + (srb->cmnd[8 ] !=0x64 )) {set_sense_type (chip, lun,SENSE_TYPE_MEDIA_INVALID_CMD_FIELD );rtsx_trace (chip);return TRANSPORT_FAILED ;@@ -4284,7 +4284,7 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip)return TRANSPORT_FAILED ; } - buf[5 ] = (1 ==CHK_SD (sd_card)) ?0x01 :0x02 ; + buf[5 ] = (CHK_SD (sd_card) ==1 ) ?0x01 :0x02 ;if (chip->card_wp &SD_CARD ) buf[5 ] |=0x80 ;@@ -5176,10 +5176,10 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip)return TRANSPORT_FAILED ; } -if ((0x53 != srb->cmnd[2 ]) || (0x44 != srb->cmnd[3 ]) || - (0x20 != srb->cmnd[4 ]) || (0x43 != srb->cmnd[5 ]) || - (0x61 != srb->cmnd[6 ]) || (0x72 != srb->cmnd[7 ]) || - (0x64 != srb->cmnd[8 ])) { +if ((srb->cmnd[2 ] !=0x53 ) || (srb->cmnd[3 ] !=0x44 ) || + (srb->cmnd[4 ] !=0x20 ) || (srb->cmnd[5 ] !=0x43 ) || + (srb->cmnd[6 ] !=0x61 ) || (srb->cmnd[7 ] !=0x72 ) || + (srb->cmnd[8 ] !=0x64 )) {set_sense_type (chip, lun,SENSE_TYPE_MEDIA_INVALID_CMD_FIELD );rtsx_trace (chip);return TRANSPORT_FAILED ;@@ -5188,7 +5188,7 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct rtsx_chip *chip)switch (srb->cmnd[1 ] &0x0F ) {case 0 :#ifdef SUPPORT_SD_LOCK -if (0x64 == srb->cmnd[9 ]) +if (srb->cmnd[9 ] ==0x64 ) sd_card->sd_lock_status |=SD_SDR_RST ;#endif retval =reset_sd_card (chip);Signature · 8 lines
2.5.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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160214025751.GA24385%40janani-Inspiron-3521. For more options, visit https://groups.google.com/d/optout.
Quoted 10 lines · Julia Lawall
Quoted 2 lines · Janani Ravichandran
Constants should be placed on the right hand side of comparisons. This issue was identified by checkpatch.
There is a semantic patch in the kernel that makes this change for you. At the moment, it makes the change in some cases where it is not really necessary, but when you have decided that it is necessary, it could be safer to use the semantic patch than to do it by hand.
I will remember this the next time I make a similar change.
Thanks!
Janani.
Quoted 85 lines
misc/compare_const_fl.cocciNothing to change in the patch though.
julia
drivers/staging/rts5208/sd.c int sd_pass_thru_mode(struct scsi_cmnd *srb,
Quoted 10 lines
Signed-off-by Janani Ravichandran <[email protected]>--- drivers/staging/rts5208/sd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)drivers/staging/rts5208/sd.c +0
-0@@ -4260,10 +4260,10 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb,struct
rtsx_chip*chip)drivers/staging/rts5208/sd.c int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip)
Quoted 12 lines
drivers/staging/rts5208/sd.c +4
-4return TRANSPORT_FAILED ; } -if ((0x53 != srb->cmnd[2 ]) || (0x44 != srb->cmnd[3 ]) || - (0x20 != srb->cmnd[4 ]) || (0x43 != srb->cmnd[5 ]) || - (0x61 != srb->cmnd[6 ]) || (0x72 != srb->cmnd[7 ]) || - (0x64 != srb->cmnd[8 ])) { +if ((srb->cmnd[2 ] !=0x53 ) || (srb->cmnd[3 ] !=0x44 ) || + (srb->cmnd[4 ] !=0x20 ) || (srb->cmnd[5 ] !=0x43 ) || + (srb->cmnd[6 ] !=0x61 ) || (srb->cmnd[7 ] !=0x72 ) || + (srb->cmnd[8 ] !=0x64 )) { set_sense_type(chip, lun,
SENSE_TYPE_MEDIA_INVALID_CMD_FIELD);drivers/staging/rts5208/sd.c int sd_pass_thru_mode(struct scsi_cmnd *srb,
Quoted 3 lines
drivers/staging/rts5208/sd.c +0
-0rtsx_trace (chip);return TRANSPORT_FAILED ;@@ -4284,7 +4284,7 @@ int sd_pass_thru_mode(struct scsi_cmnd *srb,struct
rtsx_chip*chip)drivers/staging/rts5208/sd.c int sd_hw_rst(struct scsi_cmnd *srb, struct
Quoted 9 lines
drivers/staging/rts5208/sd.c +1
-1return TRANSPORT_FAILED ; } - buf[5 ] = (1 ==CHK_SD (sd_card)) ?0x01 :0x02 ; + buf[5 ] = (CHK_SD (sd_card) ==1 ) ?0x01 :0x02 ;if (chip->card_wp &SD_CARD ) buf[5 ] |=0x80 ;@@ -5176,10 +5176,10 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct
rtsx_chip*chip)drivers/staging/rts5208/sd.c int sd_pass_thru_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip)
Quoted 12 lines
drivers/staging/rts5208/sd.c +4
-4return TRANSPORT_FAILED ; } -if ((0x53 != srb->cmnd[2 ]) || (0x44 != srb->cmnd[3 ]) || - (0x20 != srb->cmnd[4 ]) || (0x43 != srb->cmnd[5 ]) || - (0x61 != srb->cmnd[6 ]) || (0x72 != srb->cmnd[7 ]) || - (0x64 != srb->cmnd[8 ])) { +if ((srb->cmnd[2 ] !=0x53 ) || (srb->cmnd[3 ] !=0x44 ) || + (srb->cmnd[4 ] !=0x20 ) || (srb->cmnd[5 ] !=0x43 ) || + (srb->cmnd[6 ] !=0x61 ) || (srb->cmnd[7 ] !=0x72 ) || + (srb->cmnd[8 ] !=0x64 )) { set_sense_type(chip, lun,
SENSE_TYPE_MEDIA_INVALID_CMD_FIELD);drivers/staging/rts5208/sd.c int sd_hw_rst(struct scsi_cmnd *srb, struct
Quoted 3 lines
drivers/staging/rts5208/sd.c +0
-0rtsx_trace (chip);return TRANSPORT_FAILED ;@@ -5188,7 +5188,7 @@ int sd_hw_rst(struct scsi_cmnd *srb, struct
rtsx_chip*chip)Quoted 11 lines
drivers/staging/rts5208/sd.c +1
-2switch (srb->cmnd[1 ] &0x0F ) {case 0 :#ifdef SUPPORT_SD_LOCK -if (0x64 == srb->cmnd[9 ]) +if (srb->cmnd[9 ] ==0x64 ) sd_card->sd_lock_status |=SD_SDR_RST ;#endif retval =reset_sd_card (chip); --2.5.0
Quoted 2 lines
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20160214025751.GA24385%40janani-Inspiron-3521
.Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.