Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3273550rwb; Mon, 15 Aug 2022 22:57:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4CwjXgT2RwQ0siHVP25fZRunfc783puPse4P1Dn45cu2KQAVtWPt09mELRw3YVSENRgVmF X-Received: by 2002:a05:6402:428c:b0:440:8259:7a2b with SMTP id g12-20020a056402428c00b0044082597a2bmr16992451edc.329.1660629463590; Mon, 15 Aug 2022 22:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660629463; cv=none; d=google.com; s=arc-20160816; b=RU37qqmk540bB6WZREuFFY9UwNYcnoTrts/9nMhVXRRhx+fLUvSOxjBp3BPx5Mb7pz R1guCfFrhdNZx2QEPCBxfw8kP28kAWiKL7iaE8mGaDKuhvSbHtLp8nwE4xnCGvqSY/AG A/sNRjrM59qgeM/pntOQTUgTLN77TkcGZiE0BoSlJ6P0aSlRUggHhquJ0b8cErSpQHTt bfCgdOn/i1PBG6VgfZcvAC2ZKDt2+KtDekvs8EHlJ2zKSk/FotGLPVluV12yoSmR8aco vswjC+lMGs26BY/SyEGOHdxEmUGs6OWPl7d9/Kw4Z68RA2k3cgh3lxjJzYXHbheb2FQB gQ1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VVlMGBGUX0xJN+UehQcHqYWfzpgXM98ARiPhjRWuyiY=; b=GIRzx+GphKj5knfiioyxtE92SEH61nSgmcyuNzgCJinHO/dLQBIuhViEBKPun38wm9 vBKmJeXgBwMon28I4mSUVzd/XK5eYUBxeSxjZKAskEvoC7S91TfF1Onr8KNR2gkSwqa2 H6DnFGAbazZJcn8mz5dMBa/PmeGGdXjRP8mj6P8rzm+Rk/5DXr+jA3Z9Dd6be5SQa2zn CmPj+Y3PX7HaWhmpmr/GX0nDSMKSjw7d4esTDslExbXcO0T/k7NBTjTj5p60oH1wIA6x MbqaLf19ST8iiTtHBnwkYZr0q9l/tqCUxghAWlKftp/U6gQ24ey6H0g3dmjE4Q1Xbmgs RI8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ILtmyyJR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz3-20020a1709072ce300b00730ad9d5b21si10662595ejc.376.2022.08.15.22.57.18; Mon, 15 Aug 2022 22:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ILtmyyJR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232926AbiHPEwt (ORCPT + 99 others); Tue, 16 Aug 2022 00:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbiHPEs7 (ORCPT ); Tue, 16 Aug 2022 00:48:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E44D87C4; Mon, 15 Aug 2022 13:44:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B0124B80EB1; Mon, 15 Aug 2022 20:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E69B9C433C1; Mon, 15 Aug 2022 20:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596293; bh=k+r9KM2TpEG+TWWUNiAOaK1PNljnrRxwz7Ux3xf+zYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ILtmyyJRklBb198ep4zn2vlRgF0ByXe1rDur4ovPyO+XPQT9YwspohZ426VW87N55 jzLB89gjLqh+S17SzWdBbC5gKJ/qHE/dIBpAZktXV7VqIOmFjAURtlkG6OlKsx2wis JWoZMgSxcsRnSAIGwUuCDKMB9sE1ozWt/fbWHAd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanley Chu , Peter Wang , "Martin K. Petersen" Subject: [PATCH 5.19 1033/1157] scsi: ufs: core: Correct ufshcd_shutdown() flow Date: Mon, 15 Aug 2022 20:06:29 +0200 Message-Id: <20220815180521.282733054@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Wang commit 00511d2abf5708ad05dd5d1c36adb2468d274698 upstream. After ufshcd_wl_shutdown() set device power off and link off, ufshcd_shutdown() could turn off clock/power. Also remove pm_runtime_get_sync. The reason why it is safe to remove pm_runtime_get_sync() is because: - ufshcd_wl_shutdown() -> pm_runtime_get_sync() will resume hba->dev too. - device resume(turn on clk/power) is not required, even if device is in RPM_SUSPENDED. Link: https://lore.kernel.org/r/20220727030526.31022-1-peter.wang@mediatek.com Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Cc: # 5.15.x Reviewed-by: Stanley Chu Signed-off-by: Peter Wang Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/ufs/core/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9484,12 +9484,8 @@ EXPORT_SYMBOL(ufshcd_runtime_resume); int ufshcd_shutdown(struct ufs_hba *hba) { if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) - goto out; + ufshcd_suspend(hba); - pm_runtime_get_sync(hba->dev); - - ufshcd_suspend(hba); -out: hba->is_powered = false; /* allow force shutdown even in case of errors */ return 0;