From patchwork Wed Apr 18 15:01:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 10348351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0783D6054B for ; Wed, 18 Apr 2018 15:03:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC8CD286FE for ; Wed, 18 Apr 2018 15:03:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA7B128703; Wed, 18 Apr 2018 15:03:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8303E286FE for ; Wed, 18 Apr 2018 15:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753473AbeDRPDg (ORCPT ); Wed, 18 Apr 2018 11:03:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:39675 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753362AbeDRPD2 (ORCPT ); Wed, 18 Apr 2018 11:03:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 57B4EAF63; Wed, 18 Apr 2018 15:03:25 +0000 (UTC) From: Johannes Thumshirn To: "Martin K . Petersen" Cc: Bart Van Assche , Hannes Reinecke , James Bottomley , Linux SCSI Mailinglist , Douglas Gilbert , Johannes Thumshirn Subject: [VERY EARLY RFC 07/13] scsi: use set_driver_byte Date: Wed, 18 Apr 2018 17:01:10 +0200 Message-Id: <20180418150116.18807-8-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180418150116.18807-1-jthumshirn@suse.de> References: <20180418150116.18807-1-jthumshirn@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP @@ 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); ) Signed-off-by: Johannes Thumshirn --- 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 --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: