From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4F1CC7EE23 for ; Sun, 4 Jun 2023 23:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R9MWhpglOvK3lAsR+S1C0IShdqsQ/WtPsZ/c4uMm1q4=; b=DF+d69YWWQJ5jj hpHrVi4ZIG0DdC2u1QIKVmlGMIYN8xGF0rl4rL//NfrXtdl8asc/S0K5s11DPaJQBjFu1fdbQcW6c pBfnccrvmmbctR6ImMaA9to5PJd7lfZxtS5/LOnDoZdOxTMGiPaLhVm/vKVyUBVF7RC/P2E1hvIE5 C4p/SIfMQHSRrzaYi6J1ZVXVPJvBHIIYcc0m3t84YJyoIArC2gLlJcs5H85JBQE3EOAb2tmPa2on1 waKlu2c4hle6VkYRKRPD6HBgptvqLMvwofMJYVTUTv0J6vI1pzbHZigNYqohJUa/OuMfXnAilWFHT G//9aypmPJ8UCj+X/iwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q5wye-00DOF4-2I; Sun, 04 Jun 2023 23:17:36 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q5wyV-00DOEX-2N for linux-arm-kernel@lists.infradead.org; Sun, 04 Jun 2023 23:17:28 +0000 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 5176E60C48; Sun, 4 Jun 2023 23:17:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E34EC433EF; Sun, 4 Jun 2023 23:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685920643; bh=lLXxhmHuTpdEgjdhdN6kOgGjwZKnjXgDZ9PMqOVOxGI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TlMd9+z3vTNafqIAYi30n98Uk81wQ3uVB68YECbeKRR4n72dR1smtw/VKusB7BpZp awaVyL2szpCSklWDSh6QaqDxxzkwQZE5M6QfZNv7hFIWHnejwo4nUfll0HqHSg7YRo K9hqVFIBmUh2qGOl7SPgLz5bPaPgou4x5miyGXunBPPh3KebkaYDvDjZw4353aDnO7 F84M39eTtj0CTe5YaFjfSy2sF4RVSccz/KPtd+BZ4bc2qv5ER1nJMJW7zbgnjGSJx9 BZKPxk6osau9bO7Kpbh3fzvuTq57dybRU0swqSdMLglTqNKsaK4pgtTLLU8nkIlXcm Tb5WtITAk5ssA== Date: Mon, 5 Jun 2023 07:17:11 +0800 From: Peter Chen To: Shenwei Wang Cc: Pawel Laszczak , Shawn Guo , Sascha Hauer , Roger Quadros , Aswath Govindraju , Greg Kroah-Hartman , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li Subject: Re: [PATCH] usb: cdns3: imx: Rework system PM to avoid duplicated operations Message-ID: <20230604231711.GD258497@nchen-desktop> References: <20230523184412.204582-1-shenwei.wang@nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230523184412.204582-1-shenwei.wang@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230604_161727_836458_8F34A263 X-CRM114-Status: GOOD ( 23.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 23-05-23 13:44:12, Shenwei Wang wrote: > The current implementation uses the same callbacks for system PM and > runtime PM suspend/resume without any state checking. This can cause the > clocks to be prepared/unprepared twice, leading to kernel warning issues. > > This patch resolves the double prepare/unprepare issues by separating the > runtime PM and system PM handling. > > Signed-off-by: Shenwei Wang > Reviewed-by: Frank Li > --- > drivers/usb/cdns3/cdns3-imx.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/cdns3/cdns3-imx.c b/drivers/usb/cdns3/cdns3-imx.c > index 59860d1753fd..1c6bc6036c15 100644 > --- a/drivers/usb/cdns3/cdns3-imx.c > +++ b/drivers/usb/cdns3/cdns3-imx.c > @@ -375,14 +375,22 @@ static inline bool cdns_imx_is_power_lost(struct cdns_imx *data) > return false; > } > > +static int __maybe_unused cdns_imx_system_suspend(struct device *dev) > +{ > + pm_runtime_put_sync(dev); > + return 0; > +} > + > static int __maybe_unused cdns_imx_system_resume(struct device *dev) > { > struct cdns_imx *data = dev_get_drvdata(dev); > int ret; > > - ret = cdns_imx_resume(dev); > - if (ret) > + ret = pm_runtime_resume_and_get(dev); > + if (ret < 0) { > + dev_err(dev, "Could not get runtime PM.\n"); > return ret; > + } > > if (cdns_imx_is_power_lost(data)) { > dev_dbg(dev, "resume from power lost\n"); > @@ -405,7 +413,7 @@ static int cdns_imx_platform_suspend(struct device *dev, > > static const struct dev_pm_ops cdns_imx_pm_ops = { > SET_RUNTIME_PM_OPS(cdns_imx_suspend, cdns_imx_resume, NULL) > - SET_SYSTEM_SLEEP_PM_OPS(cdns_imx_suspend, cdns_imx_system_resume) > + SET_SYSTEM_SLEEP_PM_OPS(cdns_imx_system_suspend, cdns_imx_system_resume) > }; > > static const struct of_device_id cdns_imx_of_match[] = { > -- > 2.34.1 > Acked-by: Peter Chen -- Thanks, Peter Chen _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel