Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3030223rwb; Mon, 15 Aug 2022 16:29:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR54IYh9AqYi3RRqgEQOGSTrMJ84Zo2UMauZ1jHvZ6GwTQ2b3irVscxSJiPhm2tqTTGAK+my X-Received: by 2002:a05:6402:3482:b0:43e:dd2:52a3 with SMTP id v2-20020a056402348200b0043e0dd252a3mr16522474edc.386.1660606156051; Mon, 15 Aug 2022 16:29:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660606156; cv=none; d=google.com; s=arc-20160816; b=Lb2tFYH2H20GC4ql9LoSGjSLn1v2bNlmEjbNoJszI49Ku0S/fFa4CNpENRX0oT5PkA ryPVPlhF2xI/cMvF9OJtd3x06ZQ7AGG5D6XYgg7hIK2lo97axjPkcpdxS806jZXtKvVS Jg1DoH9YN9Vu6MfrrixP+Tlsj9Cj2xzRN2634N5buA7uBkKsf5S3nZH/9ZYycmsZG++1 aBhX6WV1fUvoS4K+qffp7B36qv+ivcDXfI0rGGZoTAlJuKxL/krDpYUAdMyY5zbrzg9t gxtA1desJ0Of4AkAwfWEZRvnd8LmoEieJBGLbMNy23VsTinjqPVmXrz7P5nRI8xYpNy/ woHQ== 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=CLdmGMYuvOWHzkYG6dAOSUhnGmiV2V8pte+6Q6BcWe8=; b=oGqrHe7OWN4MzxEKJmbSOG04De2WOUkry7rwaD1C0XeCsfMBAhrR4yhcu94QFtJTC7 x4UCOTY3Un5pWYAW8uXhkYOI2czPTKEQGSHU4mOXo/Of4WOgQKSOxlypfzpUyrOV+Q87 l9d4u/Ae2WAmcGYW5WaqZ08r5nBgpyf+rUd2RxW6RDcSigfzzFN+8FUbaEt9uK7KGWU/ f6z16XAyDjUnniu2ioaI3USEddru9nLcQYq/0rY/rMuZiee0wrtuoMKHNp9D/foyLsun 0n0ztbIeW0iEqjd15yq6bxl1306p0UlcUUFoKrD3FaqcWe/VOCRmRTizWQE5EeswvOWN KNEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1oDmmkCb; 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 c42-20020a509fad000000b0043dcc2ec0cfsi8547551edf.190.2022.08.15.16.28.49; Mon, 15 Aug 2022 16:29:16 -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=1oDmmkCb; 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 S243937AbiHOXRh (ORCPT + 99 others); Mon, 15 Aug 2022 19:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345701AbiHOXO0 (ORCPT ); Mon, 15 Aug 2022 19:14:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEE579EFB; Mon, 15 Aug 2022 13:01:33 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 87BF5612B9; Mon, 15 Aug 2022 20:01:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AEDC433C1; Mon, 15 Aug 2022 20:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593693; bh=abu+AWRH5S6uTZkEhznvw+0Ogzufh67MHgGaXOOZzbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1oDmmkCbXl8yvNsUtxuLcM/bXPXmmqW26StG52cGK6pZGupQT8ImlS+wpgb0eCvrj MVW45KMvcw4lJEg3pYH1AcuUzgIkP9NHb87M1vQNcTbmK7dXLytuhcNP6mAKcyu6lt B8zQcy0TB1+ltEvEwM9FlVISZCWP52sM3idMbY5g= 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.18 0959/1095] scsi: ufs: core: Correct ufshcd_shutdown() flow Date: Mon, 15 Aug 2022 20:05:58 +0200 Message-Id: <20220815180508.745559584@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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/scsi/ufs/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9500,12 +9500,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;