From patchwork Fri Jul 26 15:07:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 13742881 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 CA43AC3DA4A for ; Fri, 26 Jul 2024 15:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc: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=i/h9UdQUe6HKGksMkkotjo5BNj4tG+SgMb2q8cRKxS4=; b=dzVYOXHFmlnv4tirLXP/i+4/RU yjeBpwmjzZtcpDqbMYy6KSHQaZTXXMsEMEAHXR8PejQsMchJStJ+q0MfzuHMU+TLNjwv1UX+H1X0C S7QRT9YP7+a+9ppJMvKvUjQcsdUif8ldUEHlUBAlXiPhCCYqzVLoaGAeuAt9710ZVYJvcPs1qRGDC 41670OS+CDA16+ooNJWn0D6dM3Nka26g5QUY84vE3OanTun9zuT7z8eCn6q7W++Ciycg7uNSCnCkb xpcRARVKEBw3wjFp+ko8yDv2PG14L6jbkbQ3A8EfWsTKoAxVq2QN+/fw8TyhwV89V3rpquCg3PnhV IGJOGJNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXMYL-00000004F7c-0XH7; Fri, 26 Jul 2024 15:08:17 +0000 Received: from mail-westeuropeazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c201::] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXMXu-00000004ExI-2kAG for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 15:07:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ry3b7oSLRZjWztHW/e6RlJyOx40aO2SAILOXZR0qaVu/kmCnTVH9hTXIc9fAgbiTEYzu0J66wt4SxwYW9SfPMTg7pwkBBgNAiGxQQ9gTkDHCimDcwQU1kBjV5skq625Jrk5MeLK2IwBSZrivEY2et6thlznYUdLSfFWjGsGL/IOfiFki6hI10fDf2BBgAeP7yreas6RmXVmk+URiRaS/YJ4Lgi3PwRUhbUKXaStesW5TmnejrzamTZMfEX9709gNRSU5EYYQW+ktAmR89Sz0xwk5QyYJhhx9JiZf0S8biPzhYFZMdiHRseEt66gt9PSgTsQ2EZB04PZ3f2psAHhBSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i/h9UdQUe6HKGksMkkotjo5BNj4tG+SgMb2q8cRKxS4=; b=NeshoxuY4g/WAfq/sfy3JKJYulSf8eMw+y/zCNBHzfx9W4PjuUBN80U+HKh8Qezb66CbfnsA2zxn3alou2cEC3TQJIZbtrzUlni9zeKJf6bIvX7CAvtkpAkviaDL71cQC1CZht2DB3d4VyJNpoExNchph57IVSgyNsVSw5CitAl5J8XYpCfSZBPWDkO1kjDPuLVYzj6ulYRlLOg+Ezp3mPVK/wOwY8UZMHtyHSmQzx4jpisg0tNAOnzX4nzXAxeN73xWlVEUzp3MUoKIn/rsqfRsLLADy8h+uaLul5LT9z1DG3TesY9gukYEMTjRi9omlqqdWw9yxH94lAAA5EgCBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i/h9UdQUe6HKGksMkkotjo5BNj4tG+SgMb2q8cRKxS4=; b=LZsYEu1BUEuMBgjCgt2qnZVSTDyL9KeTT3kQNK3YMLUMzCyNlOR5DEl1dMFl/yeW2sgx1ZuvS+qMZaxfAPMi47z3o3JpLRiDa1LyJcByLqXp6DNIsgW8/PHO6+HXRmsy2PZok+r1KfMZDJoF1NEPDZLdJpV4wRyU/P69fC2r94y+xg34ReSr0phMFtXt/cZNqfVhgcAwAPDMk7Fr8eH4G0wVHAWY3JqRbyteaQRrH9MUMI3wNCEvcp4qfakVi1ojGy1xY+BwnaDQRYMTPgGWNKUTs5mwJbQoR9hVCgjJFaAjJnPRN+t3Sqoptmb3V4WIk3CJGMnFeyH4Vm//ysxl2A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by DU4PR04MB10717.eurprd04.prod.outlook.com (2603:10a6:10:584::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.29; Fri, 26 Jul 2024 15:07:44 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::21bf:975e:f24d:1612]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::21bf:975e:f24d:1612%4]) with mapi id 15.20.7784.020; Fri, 26 Jul 2024 15:07:44 +0000 From: Shenwei Wang To: Peter Chen , Pawel Laszczak , Shawn Guo , Sascha Hauer Cc: Roger Quadros , Greg Kroah-Hartman , Pengutronix Kernel Team , Fabio Estevam , Shenwei Wang , Frank Li , linux-usb@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com Subject: [PATCH v2] usb: cdns3: imx: simplify system pm using _force_suspend/_resume Date: Fri, 26 Jul 2024 10:07:31 -0500 Message-Id: <20240726150731.297443-1-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR03CA0035.namprd03.prod.outlook.com (2603:10b6:a03:33e::10) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|DU4PR04MB10717:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c8dff92-608d-4154-a6e3-08dcad84b3ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: h3DD/eXwW1uWpGX5f0eaoXtCkHmVvipKdoQcAdxGPsZhX+r1w5R7ALDkOrI0vPQ/UxHWoCC0Gs4iIl9ClzxFhl8zINL0N4GVn+63bakgDOtHX2xOVGU/jKwM9yMJyzn0Pz1tLZUapbLEN7wQWv6SBTYiebauqxPfqekV5mgLqkdq2tc/EdU3hOxAsZNO5nd6xPrF48sypNvK73G9m5iYL5YVOyWdb82aPtGHRxz/E+fiORUViRrUE7HQaKqBqf+2HNrZ3pt9R4Xh749CnsC5mC6qgI1/1Yu4wXt9QYWsVx65+ap08dV8s2/7a1zdQjiXEw2I7uyeG3nF46HvOzsGLpiiEaHr9/nae7SZJH/OArSeIToPN4LaF85bP/NuYrS0g857XYBM60JHBnTeO2a7fv7emJzKVAdjC/YO175x0nku/aH2zNX7laX11bHbmjJ5RWcXTNpxViVudpdgRUBJDd1uS+/vQnzhevxrYsqBMTsOOoB2ZJ5n+UNBNVA8xhAR1J36PKPkeNY5a4QS0Vmns4y8MQmXshxlphlYEtkbmeVdkedN0SZ60dxa7IaF8vnzh79/DoLve12zh6FdT90kA7PS04Q3Xa40EncKVg3lOmDVWaQYziSd/k5d2VvtQbJ2g6h/q4zVBwUnMJM/G+28J1XizGadgD3lMTvkUfEM5/hYQD9I1RWebUnUdXlgCIizDJVnlTgRpPRSOoLjisuxzvaUKko9qb7X6FzdKweOUgDvqHGTSi4mVntX+OMzp1xOyHAzn8z2GTgOtlDyu5Q2kUnIqqr9QSB4f58TQSu4PyiXbKra/CtDirJ7wmx++945M5bk/hSQUxFGIlT031+CgLXG7//ep7bdHVhgdE08UNG6on0yN+78YPSoYDSd3eizf/AkzuLbeOKtOyl1DblyHmqFjOWp6Qnt5cjGXmE/siYUvwgXFmtnCqEgoIRhfT/iHrMg8m1wEtQv62cxz3rpVo2nOXL+xs7BOMCG8oVVKk5cqm7oQdwvMk+yz4fcldKeNgnzd8dk509oKaLN3z0m61ekjrF+WEabDmJG8cvh+LLeBMmelXhsSmIu/J4JP/JeG69sDAXbh1WI/Kx40uqMuJwFscc/N+6fbU9r1M7FFuWsvVMgAYTbKaUcUzD0oPssZTrez37OtfIGUJGPNwkuusBTQ8IsEzOZcec90s1AcPbuK6E6/FVMCgge30NQFRd7swPw9SLaltjTcomW3gpB56eGVJwG+CePSeOnk3KumNCj/tOdU0F0XCY0tZhgb1lrrDD0/kMVbHZ3Gs4clMz3epZPyO9mueEsC403FAtKsAEF4cXA7sWR2yxxw3VryJm+UVIOqCJJK+YU6r8SsRGa9Xa16qPopSskpJc1atIAru80unJKJISOlFB1L61A98zpDKuf4mwXKA3TI5v3J9M3zg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(52116014)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /ONt4f2GHLDsDffYVm6N5pUc7Y7YqcDgrwmbIJ3bKRG366PrsaLPyNO+kEyAO3u0MlYrpEouZZFcKwf9nJjq0mGAWQ/1OJuYzwVPWm1J0O0FXmXAZ9NjfOritD4Qi8la5kkJ5k4xedd5POETDcwh4OnXUwSWhVRjmyDv6AmE8uNY8hl7b6WTCNCdHrtbQrtm+lvta5d9n97wSch9O+fkH1+oeGtj6iHmv0GaDcHuLujCjJiU0QiQr8HQcII60UO5sKB3rUnX8Bl8hmPNqMAH8AKU6TZz7Bdo/iArmNQ1+RqN+DSPJzuj7j/kquS2F12vEp1PC+MMjAVTaF6nl///nEQVBBweuF/3hM07w8r4yw7C6Z1IAERfChwxlfdQMn4kLPect3JKwnrqKU3K5v52qyliKAERCSFTEbvX8H5iatqrc5cbYbCSx0NfEAAiHOYpQW7nZTbCul4IizvWAtccNtFOJMdJI64aaQuj9n/Ogq8nVHE2B6YnICvAl70RFOrh1OwZavgVJHToJv/OBo7VN183bdQWp7jkY8JF5clWRmTTXHJAehesS8tcUYSxKslKYCukKV59ld5ZGChfLxGfAXbOkSkOOzevpC9rReSnZq0Pe1a7ACnPpgwZW0AAb1aOpwam9LUuQhGlLGtL5wKJ5rTEgFREVXYqjGED9yYo08beoceJ9qa6y05RkkI4DMs3uIhbcJ9iKuWgwzYmqPvOTY0Aej8A87WYHFBHX7oKwrX2bGRwiHwoQAtPbgzN1Pmux3Ilk3ZXYsUhAijjN8S/xWLJsOx0my39tPwc5w/Xp7GEi+3qCq66+Re2wGK9/5ARdt/UiPO3hoAPNk+G62QAezPaDWjxkjzauEpS9AMUn2ZYQDqMGHrR1xdyFnZfKXvYXbqtfjKQAypo2MeTzkErqi8/iKo9nuuzYFbf+jf6XXRemJjMtvkK7+XTrduYFqIz9pJx9dpJ1ZitQzUIR5Qig2yuBUxlnyO0AW4x6Dx9EK58HxUpH1nxfB3EdAV9fMB09RA2OGPqs2doIE6XryI0HLumYdifCRRay5NlRtbaGQKXBffE2HAHoBXdRyjOIxH6KvpEIFtf/bpIniXbdNreyxUnEjlrP3nOZM/rpbduuYVmvsoeIVsiFOFEY38TMysOZi/WJ4fUFH7jt00nZnJNM+T11B1H5XFa+CMmC/aQ9zdWzy6/0Xs9IMIEPaPh6c13kjQO97FhJDssxVoFjAMJvkl3/nHQnm1DKVPIebnxGjXcu8jmZRDN4sMYBTVCRQLDwKLpVVaOkP6OvJzHCv3pnkpNRYQpY2dDJVAFWCffvJaXU/P1y5wbF2jAe6XubBB+Pno3caQRbxU61+JZcgRvGHIevrBh1rKiSS3fpO9Rj4gndGZU0hIIxrWxk9P5DQrrNFPrSAymr0SjxcoSxTA4OmhMIS/gFeXIHDY8sKDgrjS1LvfuoKN9zhYxAXJMOwyHWuel8H3u2Haw6S4Q6wR8G2Nyz8rQSw6F1h6OLsN3AuVW8hVDi3qLq/9M7Kb99tQhiQ1QcQ9k4NOtzSZ6UNahdo4joAfD89RzkWBw03QGdqaU7YdBfkfouw4kEzNW/7gx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c8dff92-608d-4154-a6e3-08dcad84b3ee X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2024 15:07:44.8035 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WlQzSg7Wp4FEi2/eaYyij40fhM9CXvpxft3gGwlxHkbe2G99cWJv60uCr3CL/blBdCaoRCErcLMWlLauvLYVJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR04MB10717 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_080750_721146_DEC9ED5A X-CRM114-Status: GOOD ( 12.38 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org By utilizing _force_suspend and _force_resume, ensures a more consistent and simple approach to handling system sleep states. It also aligns the driver's PM behavior with the other drivers' common practices. Fixes: db3c4e366287 ("usb: cdns3: imx: Rework system PM to avoid duplicated operations") Reviewed-by: Frank Li Signed-off-by: Shenwei Wang --- Changes in V2: - revert the unneeded change of removing an extra blank line. drivers/usb/cdns3/cdns3-imx.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) -- 2.34.1 diff --git a/drivers/usb/cdns3/cdns3-imx.c b/drivers/usb/cdns3/cdns3-imx.c index 281de47e2a3b..bb9b435c61b4 100644 --- a/drivers/usb/cdns3/cdns3-imx.c +++ b/drivers/usb/cdns3/cdns3-imx.c @@ -373,22 +373,18 @@ 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 = pm_runtime_force_resume(dev); + if (ret) + return ret; + ret = pm_runtime_resume_and_get(dev); - if (ret < 0) { - dev_err(dev, "Could not get runtime PM.\n"); + if (ret) return ret; - } if (cdns_imx_is_power_lost(data)) { dev_dbg(dev, "resume from power lost\n"); @@ -397,6 +393,7 @@ static int __maybe_unused cdns_imx_system_resume(struct device *dev) cdns_imx_suspend(dev); } + pm_runtime_put_autosuspend(dev); return ret; } @@ -411,7 +408,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_system_suspend, cdns_imx_system_resume) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, cdns_imx_system_resume) }; static const struct of_device_id cdns_imx_of_match[] = {