diff mbox

[VERY,EARLY,RFC,07/13] scsi: use set_driver_byte

Message ID 20180418150116.18807-8-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 << 24 | E2;
+ c->result = 0;
+ set_driver_byte(c, E1);
+ c->result |= E2;
|
- c->result |= E1 << 24 | E2;
+ set_driver_byte(c, E1);
+ c->result |= E2;
|
- c->result = E1 << 24;
+ c->result = 0;
+ set_driver_byte(c, E1);
|
- c->result |= E1 << 24;
+ set_driver_byte(c, E1);
)
<SmPL>

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/ata/libata-scsi.c                   | 2 +-
 drivers/scsi/advansys.c                     | 1 -
 drivers/scsi/aic7xxx/aic79xx_osm.c          | 2 +-
 drivers/scsi/aic7xxx/aic7xxx_osm.c          | 2 +-
 drivers/scsi/arcmsr/arcmsr_hba.c            | 2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   | 2 +-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +-
 drivers/scsi/mvumi.c                        | 5 +++--
 drivers/scsi/scsi.c                         | 2 +-
 drivers/scsi/scsi_error.c                   | 2 +-
 drivers/scsi/vmw_pvscsi.c                   | 4 ++--
 11 files changed, 13 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f34650ada9d7..f019de473a97 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4475,7 +4475,7 @@  void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
 
 	case REQUEST_SENSE:
 		ata_scsi_set_sense(dev, cmd, 0, 0, 0);
-		cmd->result = (DRIVER_SENSE << 24);
+		set_driver_byte(cmd, DRIVER_SENSE);
 		break;
 
 	/* if we reach this, then writeback caching is disabled,
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 0f93fe6c58b0..0e3f464e011d 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2093,7 +2093,6 @@  do { \
 #define STATUS_BYTE(byte)   (byte)
 #define MSG_BYTE(byte)      ((byte) << 8)
 #define HOST_BYTE(byte)     ((byte) << 16)
-#define DRIVER_BYTE(byte)   ((byte) << 24)
 
 #define ASC_STATS(shost, counter) ASC_STATS_ADD(shost, counter, 1)
 #ifndef ADVANSYS_STATS
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 2588b8f84ba0..af748242cdb3 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1941,7 +1941,7 @@  ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
 			memcpy(cmd->sense_buffer,
 			       ahd_get_sense_buf(ahd, scb)
 			       + sense_offset, sense_size);
-			cmd->result |= (DRIVER_SENSE << 24);
+			set_driver_byte(cmd, DRIVER_SENSE);
 
 #ifdef AHD_DEBUG
 			if (ahd_debug & AHD_SHOW_SENSE) {
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index c6be3aeb302b..ac204238b5c1 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1856,7 +1856,7 @@  ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
 			if (sense_size < SCSI_SENSE_BUFFERSIZE)
 				memset(&cmd->sense_buffer[sense_size], 0,
 				       SCSI_SENSE_BUFFERSIZE - sense_size);
-			cmd->result |= (DRIVER_SENSE << 24);
+			set_driver_byte(cmd, DRIVER_SENSE);
 #ifdef AHC_DEBUG
 			if (ahc_debug & AHC_SHOW_SENSE) {
 				int i;
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index a99d44d36e5f..9fd87860ef63 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1211,7 +1211,7 @@  static void arcmsr_report_sense_info(struct CommandControlBlock *ccb)
 		memcpy(sensebuffer, ccb->arcmsr_cdb.SenseData, sense_data_length);
 		sensebuffer->ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
 		sensebuffer->Valid = 1;
-		pcmd->result |= (DRIVER_SENSE << 24);
+		set_driver_byte(pcmd, DRIVER_SENSE);
 	}
 }
 
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 9c3dec24b6bf..6861e8d1aea5 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3309,7 +3309,7 @@  megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 				memcpy(cmd->scmd->sense_buffer, cmd->sense,
 				       hdr->sense_len);
 
-				cmd->scmd->result |= DRIVER_SENSE << 24;
+				set_driver_byte(cmd->scmd, DRIVER_SENSE);
 			}
 
 			break;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 8c5757d5770a..5ffeb21872f3 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1795,7 +1795,7 @@  map_cmd_status(struct fusion_context *fusion,
 			       SCSI_SENSE_BUFFERSIZE);
 			memcpy(scmd->sense_buffer, sense,
 			       SCSI_SENSE_BUFFERSIZE);
-			scmd->result |= DRIVER_SENSE << 24;
+			set_driver_byte(scmd, DRIVER_SENSE);
 		}
 
 		/*
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 570e7ff481a3..148697c9b45d 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -1330,11 +1330,12 @@  static void mvumi_complete_cmd(struct mvumi_hba *mhba, struct mvumi_cmd *cmd,
 		if (ob_frame->rsp_flag & CL_RSP_FLAG_SENSEDATA) {
 			memcpy(cmd->scmd->sense_buffer, ob_frame->payload,
 				sizeof(struct mvumi_sense_data));
-			scmd->result |=  (DRIVER_SENSE << 24);
+			set_driver_byte(scmd, DRIVER_SENSE);
 		}
 		break;
 	default:
-		scmd->result |= (DRIVER_INVALID << 24) | (DID_ABORT << 16);
+		set_driver_byte(scmd, DRIVER_INVALID);
+		scmd->result |= (DID_ABORT << 16);
 		break;
 	}
 
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 4c60c260c5da..e68b9f941e8a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -224,7 +224,7 @@  void scsi_finish_command(struct scsi_cmnd *cmd)
 	 * must have taken place.  Make a note of this.
 	 */
 	if (SCSI_SENSE_VALID(cmd))
-		cmd->result |= (DRIVER_SENSE << 24);
+		set_driver_byte(cmd, DRIVER_SENSE);
 
 	SCSI_LOG_MLCOMPLETE(4, sdev_printk(KERN_INFO, sdev,
 				"Notifying upper driver of completion "
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 7e80f457367e..02e9865501af 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2068,7 +2068,7 @@  void scsi_eh_flush_done_q(struct list_head *done_q)
 			 * set, do not set DRIVER_TIMEOUT.
 			 */
 			if (!scmd->result)
-				scmd->result |= (DRIVER_TIMEOUT << 24);
+				set_driver_byte(scmd, DRIVER_TIMEOUT);
 			SCSI_LOG_ERROR_RECOVERY(3,
 				scmd_printk(KERN_INFO, scmd,
 					     "%s: flush finish cmd\n",
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index fb049d8dcd34..8bec30e73a9e 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -563,7 +563,7 @@  static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
 	     btstat == BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG)) {
 		set_scsi_result(cmd, 0, DID_OK, 0, sdstat);
 		if (sdstat == SAM_STAT_CHECK_CONDITION && cmd->sense_buffer)
-			cmd->result |= (DRIVER_SENSE << 24);
+			set_driver_byte(cmd, DRIVER_SENSE);
 	} else
 		switch (btstat) {
 		case BTSTAT_SUCCESS:
@@ -588,7 +588,7 @@  static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
 		case BTSTAT_LUNMISMATCH:
 		case BTSTAT_TAGREJECT:
 		case BTSTAT_BADMSG:
-			cmd->result = (DRIVER_INVALID << 24);
+			set_driver_byte(cmd, DRIVER_INVALID);
 			/* fall through */
 
 		case BTSTAT_HAHARDWARE: