From patchwork Fri May 8 08:01:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11535859 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 563CB14C0 for ; Fri, 8 May 2020 08:01:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D9C0207DD for ; Fri, 8 May 2020 08:01:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Cr0UESnY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727891AbgEHIB4 (ORCPT ); Fri, 8 May 2020 04:01:56 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:53373 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727104AbgEHIBZ (ORCPT ); Fri, 8 May 2020 04:01:25 -0400 X-UUID: a4a4b2dcbdb9411390c6a062fffa8521-20200508 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Dzux/Fihh4A+Jn7pw9myKYTjmrm2nWzTzpkmjvC3pRY=; b=Cr0UESnY6tR6SAErll0fRpnzRPXc6Gbmm6hf7USl9K0YvjlrRIevCPPLftYkf7ZsnZo8/og9pB5/Vrt0afBh+KZbuEWQlVAVy6YyP8GpT0YfKIbQAoWQjj3nE/9p6YOMGhYnx83E63MBQLq7n3bY530tFcDWa4P1Nrn7Fh9NiBY=; X-UUID: a4a4b2dcbdb9411390c6a062fffa8521-20200508 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 1686096399; Fri, 08 May 2020 16:01:21 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 8 May 2020 16:01:19 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 8 May 2020 16:01:19 +0800 From: Stanley Chu To: , , , , , CC: , , , , , , , , , , , Stanley Chu Subject: [PATCH v8 8/8] scsi: ufs: cleanup WriteBooster feature Date: Fri, 8 May 2020 16:01:15 +0800 Message-ID: <20200508080115.24233-9-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200508080115.24233-1-stanley.chu@mediatek.com> References: <20200508080115.24233-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Small cleanup as below items, 1. Use ufshcd_is_wb_allowed() directly instead of ufshcd_wb_sup() since ufshcd_wb_sup() just returns the result of ufshcd_is_wb_allowed(). 2. In ufshcd_suspend(), "else if (!ufshcd_is_runtime_pm(pm_op)) can be simplified to "else" since both have the same meaning. This patch does not change any functionality. Signed-off-by: Stanley Chu Reviewed-by: Avri Altman Reviewed-by: Asutosh Das --- drivers/scsi/ufs/ufshcd.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index b6a0d77d47ac..426073a518ef 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -253,7 +253,6 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up); static irqreturn_t ufshcd_intr(int irq, void *__hba); static int ufshcd_change_power_mode(struct ufs_hba *hba, struct ufs_pa_layer_attr *pwr_mode); -static bool ufshcd_wb_sup(struct ufs_hba *hba); static int ufshcd_wb_buf_flush_enable(struct ufs_hba *hba); static int ufshcd_wb_buf_flush_disable(struct ufs_hba *hba); static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable); @@ -285,7 +284,7 @@ static inline void ufshcd_wb_config(struct ufs_hba *hba) { int ret; - if (!ufshcd_wb_sup(hba)) + if (!ufshcd_is_wb_allowed(hba)) return; ret = ufshcd_wb_ctrl(hba, true); @@ -5197,18 +5196,13 @@ static void ufshcd_bkops_exception_event_handler(struct ufs_hba *hba) __func__, err); } -static bool ufshcd_wb_sup(struct ufs_hba *hba) -{ - return ufshcd_is_wb_allowed(hba); -} - static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable) { int ret; u8 index; enum query_opcode opcode; - if (!ufshcd_wb_sup(hba)) + if (!ufshcd_is_wb_allowed(hba)) return 0; if (!(enable ^ hba->wb_enabled)) @@ -5264,7 +5258,7 @@ static int ufshcd_wb_buf_flush_enable(struct ufs_hba *hba) int ret; u8 index; - if (!ufshcd_wb_sup(hba) || hba->wb_buf_flush_enabled) + if (!ufshcd_is_wb_allowed(hba) || hba->wb_buf_flush_enabled) return 0; index = ufshcd_wb_get_flag_index(hba); @@ -5286,7 +5280,7 @@ static int ufshcd_wb_buf_flush_disable(struct ufs_hba *hba) int ret; u8 index; - if (!ufshcd_wb_sup(hba) || !hba->wb_buf_flush_enabled) + if (!ufshcd_is_wb_allowed(hba) || !hba->wb_buf_flush_enabled) return 0; index = ufshcd_wb_get_flag_index(hba); @@ -5336,7 +5330,7 @@ static bool ufshcd_wb_keep_vcc_on(struct ufs_hba *hba) int ret; u32 avail_buf; - if (!ufshcd_wb_sup(hba)) + if (!ufshcd_is_wb_allowed(hba)) return false; /* * The ufs device needs the vcc to be ON to flush. @@ -8235,12 +8229,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) * configured WB type is 70% full, keep vcc ON * for the device to flush the wb buffer */ - if ((hba->auto_bkops_enabled && ufshcd_wb_sup(hba)) || + if ((hba->auto_bkops_enabled && ufshcd_is_wb_allowed(hba)) || ufshcd_wb_keep_vcc_on(hba)) hba->dev_info.keep_vcc_on = true; else hba->dev_info.keep_vcc_on = false; - } else if (!ufshcd_is_runtime_pm(pm_op)) { + } else { hba->dev_info.keep_vcc_on = false; }