From patchwork Fri Mar 23 16:05:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 132353 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp778798ljb; Fri, 23 Mar 2018 09:07:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELts4XGXJzCNbddPQru9GNZy2pWhKFRhNgn0SfcpEYdAiu/RY+mC/TfH2rue9pEeFMYeU/cT X-Received: by 10.99.140.77 with SMTP id q13mr8641607pgn.44.1521821274619; Fri, 23 Mar 2018 09:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521821274; cv=none; d=google.com; s=arc-20160816; b=fQRWiVZncEjbq+Mr59bonqcUERTOR4tW0lS5+PHSEhcydFAnR+QMx7/GtCPPW/ey69 pwlFYMZSvdWBRtRlxY0Anbo+sfuQoLTNIizfNeA0c3/Z07HbtCsfOvAiA8S2Y9aOmZNl ldi6UAB+ULLPqLji+6uT0LAZMpFtczeb72MkDcPbvONuCYv0r5mz4CnmOBBQAZ8ajPYO eLd8qkAQjZBkMPwS9LBZtDaXSbGs/8nA/33U1+sHDB7bzbGku96zKT/T88h6xMVoK8w2 A9VpPaNlUVQt94l31MDzQNCuJICZquKBMhZmZBoBlk4sF2bjVcjAbamAEmnjhGaU+Cks FNbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=dLGHn/6r2yOzRFIiSeTXX14Xvp6iVv7sZVLSXg3vdWU=; b=C4cnv0Zqidoh1KbxALrO8F1bbpsKuLOW3d++22YbQPATZ/TzBA/I2bH9fuDmFi905J Y2PbQxhpy6QHPyp0Gq2D+Cc+E2moHuvBFRoXU/AhRuipmFnRnrL2J+R4JSp2v0JJfI2M HlRfUzugt4lxpRxpLNu8mYELDUZ8VvI9wsawChz/joau5QU8m0GPRBOXBvJ2vOLEGyv1 uEvEcU3MAj8xFOrw839/XDJI0ador8QbHaVzpkhMq03YUSM1pI1bg7Y3blU1ZvScCnYG ZDgTFArfM2ED69JPXHL/sHU+DOzq8bQysoLoJxFQaEP1TYJW68G99RWp2nxgg5Bv/U5b OSRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6-v6si1987823plx.263.2018.03.23.09.07.54; Fri, 23 Mar 2018 09:07:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752507AbeCWQHu (ORCPT + 28 others); Fri, 23 Mar 2018 12:07:50 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6683 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751898AbeCWQGH (ORCPT ); Fri, 23 Mar 2018 12:06:07 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 91009AEB0AB6; Sat, 24 Mar 2018 00:05:50 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.361.1; Sat, 24 Mar 2018 00:05:45 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 5/8] scsi: hisi_sas: consolidate command check in hisi_sas_get_ata_protocol() Date: Sat, 24 Mar 2018 00:05:12 +0800 Message-ID: <1521821115-120040-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521821115-120040-1-git-send-email-john.garry@huawei.com> References: <1521821115-120040-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan Currently we check the fis->command value in 2 locations in hisi_sas_get_ata_protocol() switch statement. Fix this by consolidating the check for fis->command value to 1 location only. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 9563dfa..8557fd0 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -78,22 +78,23 @@ u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis, int direction) case ATA_CMD_STANDBYNOW1: case ATA_CMD_ZAC_MGMT_OUT: return HISI_SAS_SATA_PROTOCOL_NONDATA; + + case ATA_CMD_SET_MAX: + switch (fis->features) { + case ATA_SET_MAX_PASSWD: + case ATA_SET_MAX_LOCK: + return HISI_SAS_SATA_PROTOCOL_PIO; + + case ATA_SET_MAX_PASSWD_DMA: + case ATA_SET_MAX_UNLOCK_DMA: + return HISI_SAS_SATA_PROTOCOL_DMA; + + default: + return HISI_SAS_SATA_PROTOCOL_NONDATA; + } + default: { - if (fis->command == ATA_CMD_SET_MAX) { - switch (fis->features) { - case ATA_SET_MAX_PASSWD: - case ATA_SET_MAX_LOCK: - return HISI_SAS_SATA_PROTOCOL_PIO; - - case ATA_SET_MAX_PASSWD_DMA: - case ATA_SET_MAX_UNLOCK_DMA: - return HISI_SAS_SATA_PROTOCOL_DMA; - - default: - return HISI_SAS_SATA_PROTOCOL_NONDATA; - } - } if (direction == DMA_NONE) return HISI_SAS_SATA_PROTOCOL_NONDATA; return HISI_SAS_SATA_PROTOCOL_PIO;