From patchwork Wed Apr 18 15:01:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 10348343 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 BAB5660244 for ; Wed, 18 Apr 2018 15:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA81D286F7 for ; Wed, 18 Apr 2018 15:03:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8A0728681; Wed, 18 Apr 2018 15:03:38 +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 51BA52871C for ; Wed, 18 Apr 2018 15:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753446AbeDRPDe (ORCPT ); Wed, 18 Apr 2018 11:03:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:39684 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753392AbeDRPD3 (ORCPT ); Wed, 18 Apr 2018 11:03:29 -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 8143EAF6C; Wed, 18 Apr 2018 15:03:26 +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 09/13] scsi: use set_msg_byte Date: Wed, 18 Apr 2018 17:01:12 +0200 Message-Id: <20180418150116.18807-10-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 << 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); ) Signed-off-by: Johannes Thumshirn --- drivers/scsi/advansys.c | 1 - drivers/scsi/hpsa.c | 4 ++-- drivers/scsi/mesh.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) 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));