diff mbox

[VERY,EARLY,RFC,09/13] scsi: use set_msg_byte

Message ID 20180418150116.18807-10-jthumshirn@suse.de (mailing list archive)
State Changes Requested
Headers show

Commit Message

Johannes Thumshirn April 18, 2018, 3:01 p.m. UTC
<SmPL>
@@
struct scsi_cmnd *c;
expression E1, E2;
@@
(
- c->result = E1 << 8 | E2;
+ c->result = 0;
+ set_msg_byte(c, E1);
+ c->result |= E2;
|
- c->result |= E1 << 8 | E2;
+ set_msg_byte(c, E1);
+ c->result |= E2;
|
- c->result = E1 << 8;
+ c->result = 0;
+ set_msg_byte(c, E1);
|
- c->result |= E1 << 8;
+ c->result = 0;
+ set_msg_byte(c, E1);
|
- c->result = (E1 << 8);
+ set_msg_byte(c, E1);
|
- c->result |= (E1 << 8);
+ set_msg_byte(c, E1);
)
</SmPL>

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/scsi/advansys.c | 1 -
 drivers/scsi/hpsa.c     | 4 ++--
 drivers/scsi/mesh.c     | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 846917538e2b..63c0d97d52a0 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2091,7 +2091,6 @@  do { \
 
 /* struct scsi_cmnd function return codes */
 #define STATUS_BYTE(byte)   (byte)
-#define MSG_BYTE(byte)      ((byte) << 8)
 
 #define ASC_STATS(shost, counter) ASC_STATS_ADD(shost, counter, 1)
 #ifndef ADVANSYS_STATS
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c27d1ef7158b..0a4aa7ad4437 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2365,7 +2365,7 @@  static int handle_ioaccel_mode2_error(struct ctlr_info *h,
 		case IOACCEL2_STATUS_SR_UNDERRUN:
 			cmd->result = 0;
 			set_host_byte(cmd, DID_OK);		/* host byte */
-			cmd->result |= (COMMAND_COMPLETE << 8);	/* msg byte */
+			set_msg_byte(cmd, COMMAND_COMPLETE);	/* msg byte */
 			ioaccel2_resid = get_unaligned_le32(
 						&c2->error_data.resid_cnt[0]);
 			scsi_set_resid(cmd, ioaccel2_resid);
@@ -2575,7 +2575,7 @@  static void complete_scsi_command(struct CommandList *cp)
 
 	cmd->result = 0;
 	set_host_byte(cmd, DID_OK); 		/* host byte */
-	cmd->result |= (COMMAND_COMPLETE << 8);	/* msg byte */
+	set_msg_byte(cmd, COMMAND_COMPLETE);	/* msg byte */
 
 	if (cp->cmd_type == CMD_IOACCEL2 || cp->cmd_type == CMD_IOACCEL1) {
 		if (dev->physical_device && dev->expose_device &&
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 97c6eb8e5ae8..fee7ada36d52 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -596,7 +596,7 @@  static void mesh_done(struct mesh_state *ms, int start_next)
 	if (cmd) {
 		set_scsi_result(cmd, 0, ms->stat, 0, cmd->SCp.Status);
 		if (ms->stat == DID_OK)
-			cmd->result += (cmd->SCp.Message << 8);
+			set_msg_byte(cmd, cmd->SCp.Message);
 		if (DEBUG_TARGET(cmd)) {
 			printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n",
 			       cmd->result, ms->data_ptr, scsi_bufflen(cmd));