From patchwork Wed Apr 18 15:01:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 10348345 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 D5B7860542 for ; Wed, 18 Apr 2018 15:03:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C789828660 for ; Wed, 18 Apr 2018 15:03:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C639D2236A; Wed, 18 Apr 2018 15:03:39 +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 DA044286B4 for ; Wed, 18 Apr 2018 15:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753394AbeDRPD3 (ORCPT ); Wed, 18 Apr 2018 11:03:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:39642 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbeDRPD1 (ORCPT ); Wed, 18 Apr 2018 11:03:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3FBB7AEC2; 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 01/13] scsi: use host_byte() accessor Date: Wed, 18 Apr 2018 17:01:04 +0200 Message-Id: <20180418150116.18807-2-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 Use the host_byte() accessor for getting the SCSI host byte. Signed-off-by: Johannes Thumshirn --- drivers/scsi/aic7xxx/aic79xx_osm.h | 2 +- drivers/scsi/aic7xxx/aic7xxx_osm.h | 2 +- drivers/scsi/dc395x.c | 2 +- drivers/scsi/imm.c | 4 ++-- drivers/scsi/ppa.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 8a8b7ae7aed3..0a84a846ca88 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h @@ -550,7 +550,7 @@ void ahd_set_scsi_status(struct scb *scb, uint32_t status) static inline uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd) { - return ((cmd->result >> 16) & CAM_STATUS_MASK); + return host_byte(cmd->result) & CAM_STATUS_MASK; } static inline diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index f8489078f003..108b30e92c75 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -568,7 +568,7 @@ void ahc_set_scsi_status(struct scb *scb, uint32_t status) static inline uint32_t ahc_cmd_get_transaction_status(struct scsi_cmnd *cmd) { - return ((cmd->result >> 16) & CAM_STATUS_MASK); + return host_byte(cmd->result) & CAM_STATUS_MASK; } static inline diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 60ef8df42b95..da28f08ae185 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -3473,7 +3473,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, /*if( srb->cmd->cmnd[0] == INQUIRY && */ /* (host_byte(cmd->result) == DID_OK || status_byte(cmd->result) & CHECK_CONDITION) ) */ - if ((cmd->result == (DID_OK << 16) + if ((host_byte(cmd->result) == DID_OK || status_byte(cmd->result) & CHECK_CONDITION)) { if (!dcb->init_tcq_flag) { diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 87c94191033b..690c0e25ea51 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -728,7 +728,7 @@ static void imm_interrupt(struct work_struct *work) } /* Command must of completed hence it is safe to let go... */ #if IMM_DEBUG > 0 - switch ((cmd->result >> 16) & 0xff) { + switch (host_byte(cmd->result)) { case DID_OK: break; case DID_NO_CONNECT: @@ -757,7 +757,7 @@ static void imm_interrupt(struct work_struct *work) break; default: printk("imm: bad return code (%02x)\n", - (cmd->result >> 16) & 0xff); + host_byte(cmd->result)); } #endif diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index ee86a0c62dbf..f22fe4939a74 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c @@ -625,7 +625,7 @@ static void ppa_interrupt(struct work_struct *work) } /* Command must of completed hence it is safe to let go... */ #if PPA_DEBUG > 0 - switch ((cmd->result >> 16) & 0xff) { + switch (host_byte(cmd->result)) { case DID_OK: break; case DID_NO_CONNECT: @@ -654,7 +654,7 @@ static void ppa_interrupt(struct work_struct *work) break; default: printk(KERN_WARNING "ppa: bad return code (%02x)\n", - (cmd->result >> 16) & 0xff); + host_byte(cmd->result)); } #endif