From patchwork Mon Dec 7 05:50:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11954847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 441DBC4361B for ; Mon, 7 Dec 2020 05:53:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0B4D229C7 for ; Mon, 7 Dec 2020 05:53:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0B4D229C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ROuTMTjy4FzlCSVwBkqL9ZXw08vAUOHtK4uQAhF1SeE=; b=tIoMPMzYUvKvj14NpoDaywjAmy 4bYCTLa94pMM+x4O/tNFYdiLknAH0GN4L+lQZJq/sn0xQF9IDKZxUqHwvZcdCV/8PYJzoIti8LLg1 nHRO2twliStVOuGZAPDuATDlMJEmgjLJYnLsHIefK6SkF49nAjs1aIBQqHZrJ84eiX77dr3DMcHv3 fU5CtAqESxe4lNxVpP38qsjqz+SjaMtaq9bYp3vaTAz+lwRvqKeVoDBmb6KnCWsRd1puMWHdwvJFO AoOdnxq62oecGIhiNSy1bwD4SUyJH42tSDKnMi8cF4N8YzTFDs+z0tlk1LWYVkyOGIDnbB6c9Nw3m slLKzWBA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1km9Sf-0005Xn-VM; Mon, 07 Dec 2020 05:53:26 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1km9SY-0005W3-1F; Mon, 07 Dec 2020 05:53:19 +0000 X-UUID: 83d6c4db4fe54766918d0cbbce771a97-20201206 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:Message-ID:Date:Subject:CC:To:From; bh=hqKaCfd4osTzij1PW2DMcYJZ6uIxJOir1YKlL/1qleY=; b=PrQ7z6c6bBEYI2AYQIz8yyL62ZzWIpCSwgEgaS7vC5GEMRCPxhNme2WHcw30dW48RVKpzZ107xBq/V5cn+A2HNpdjskxlCq9f9/igY60uiLKT/pZMeYKm1bXl27hMZwpJta2nKr25voQLcjmKTX/szj8vfMdKybzIdExlsUT2AM=; X-UUID: 83d6c4db4fe54766918d0cbbce771a97-20201206 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 422133830; Sun, 06 Dec 2020 21:53:08 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 6 Dec 2020 21:50:07 -0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 7 Dec 2020 13:50:05 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 7 Dec 2020 13:50:05 +0800 From: Stanley Chu To: , , , , Subject: [PATCH] scsi: ufs: Enable WB flush during suspend only if WB is enabled Date: Mon, 7 Dec 2020 13:50:06 +0800 Message-ID: <20201207055006.24471-1-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-TM-SNTS-SMTP: 7ECFD28C327FC532B2FC8FDB68299D886D91BB65601C989360DB1525EEFAE1122000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201207_005318_214849_494ABD55 X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stanley Chu , alice.chao@mediatek.com, bvanassche@acm.org, andy.teng@mediatek.com, cc.chou@mediatek.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, jiajie.hao@mediatek.com, cang@codeaurora.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, matthias.bgg@gmail.com, beanhuo@micron.com, chaotian.jing@mediatek.com, linux-arm-kernel@lists.infradead.org, asutoshd@codeaurora.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org WriteBootser flush during suspend is not necessary to be enabled if WriteBooster feature is disabled. Simply adding a check to prevent unexpected power drain. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 4879e87577e1..89fa8b9ac11d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5458,7 +5458,7 @@ static bool ufshcd_wb_need_flush(struct ufs_hba *hba) u32 avail_buf; u8 index; - if (!ufshcd_is_wb_allowed(hba)) + if (!ufshcd_is_wb_allowed(hba) || !hba->wb_enabled) return false; /* * The ufs device needs the vcc to be ON to flush.