Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2888168rwb; Mon, 15 Aug 2022 13:21:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR4TSsMfyi7FGU7ZYb7nzXuVZpnHsmcLjVKHXyVLCUTYS9ks8uodXqYMsSLYrd8ZcJl/4HHr X-Received: by 2002:a05:6402:a47:b0:43d:17a0:fdc9 with SMTP id bt7-20020a0564020a4700b0043d17a0fdc9mr15718967edb.41.1660594882775; Mon, 15 Aug 2022 13:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594882; cv=none; d=google.com; s=arc-20160816; b=x1Y/Skrpv8YGv7D/Cn/nF+FvQJDjlPYTQJERKclr/bA63Dp3zMyA3LP9WKS5y+1Yps k0FlWWa1WUEEOBam+FcH6uvVpOfpsTB5t1P2i5OZKPXGv8SMLUeXhS1Y7uhssllNy+cE oJKe/fQszYwx/atDRyBCwW2j5MkkEH9s7pFp4MTCEaEL1ZlkgiAId4uKmQzo1BGMcamN 5/Y8WhB0kU3qroAINMix46eSah4lxIJ8y/0tzpHx29/HCrzBKPO3W5+B05+7j4awE436 LEewtxxYEy6QZVvEc7j2ocmquVu8Vtb+r+VGflNq7ESt5Juq5440NgoqWrvpFCgDT5lA 8+Ig== 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=CIrxlE2M477BXdV71ryKUg640r+nT0QmNnKNpiTJkSo=; b=gWi9qtLnEzDivGAWhtb7zrEQm2i3xKd8cLOz//crI940nzkzx404ERqEUlNGH5Vevi vm8i/HoOXfRV8K8A7NqF6HRXdrwgfegQWf8ygDNJyavJQ8j634dIsJDzoIGggTJ5dr6+ ZsTNwnOP4Q1mDF6vls2FQwI/jQkOuv9CCnu4HPZVlOSdD8N1S4bb23nsUIak/bTi3Q9d xTGOuxqF2+3suSy0N7LUtv3esNlIPnGIhUExqNTA/PKeUv3jBg/CtJAY5oDq1TU6g7oS J2McE7OAXbrEUtt1ijOQm8THh21FwUEHCml5RuUzOG6c5NmOoxw1r7VAqqleP/cjkFeN Bd7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dHOGAt2F; 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 q8-20020a50cc88000000b00442296a8407si7401347edi.629.2022.08.15.13.20.53; Mon, 15 Aug 2022 13:21:22 -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=dHOGAt2F; 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 S1345329AbiHOTts (ORCPT + 99 others); Mon, 15 Aug 2022 15:49:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344976AbiHOTsE (ORCPT ); Mon, 15 Aug 2022 15:48:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4760742AC3; Mon, 15 Aug 2022 11:49:44 -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 64513B810A0; Mon, 15 Aug 2022 18:49:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AADB0C433D6; Mon, 15 Aug 2022 18:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589381; bh=o7H7UAVGrrpPOWxQzTHEeKccaB3z4bO8liOCqHQkIlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dHOGAt2FMMxcYZxj2c39W+5g5FHXOTJ4zLd11igKNBsVS8NyL+eE982lzOn5BpZ98 RUZRctl+8I8HxcWTDqR4sOlSRyoMx08o+J8Sc6npiz+rwrUT+BeU4qhH/uhc5Bk9yx CQzdP1B6KfgZzzFQAjjmGPMt2bgM1GQ3o8ugOnTA= 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.15 669/779] scsi: ufs: core: Correct ufshcd_shutdown() flow Date: Mon, 15 Aug 2022 20:05:13 +0200 Message-Id: <20220815180405.942124712@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 @@ -9239,12 +9239,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;