From patchwork Sat Dec 28 01:14:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 13922234 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 D33CCE7718B for ; Sat, 28 Dec 2024 01:24:02 +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:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=dMs9LoaToIJ+gozHx+CKfcyWbPCk3fjmjLVoS+x3j5E=; b=mLngfqJNHRsq0SZbLXtJnw1Xa0 sTjDI2DhNl4ZYbXe/X8XvLcPLkpU3S2Ah3Q5nINPpnK4jqRIHDRaPSiDXM+hTedp3RPTfOS6EW207 UF2p8XeIHwqBUO7b6wBQE3u+UeVn+sKykNmEePZS4pi4Aul9dYfyyZ4saWV+XbtsBGOjeLL3CrAHB jjWo1rKaRVrnUqmoZ4INBb7JaIm+qcgGJFVux7egrKcrniEXqLF80e8Rc/ziXHnRrk6kqI5ggldSv DfBj4uItpXHDdCzwkp/a/pm3UvL0K116wbiURA2ZzBjCFA67kyc07Lyk+85LTay4ENhktJPSWVDwh UysQLCYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tRLYb-00000001Cpq-2gnk; Sat, 28 Dec 2024 01:23:57 +0000 Received: from mail-vi1eur02on20618.outbound.protection.outlook.com ([2a01:111:f403:2607::618] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tRLQl-00000001BCO-0yPN; Sat, 28 Dec 2024 01:15:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=olPMx0tE6Ed7jYvTX0V9egv8YIGEugwqDV0iITMiFZezT1oYT7/8Zz9jvFnsKfpsIRpZkyuO5miIklunKno1OLDxzzjzZOh4izeWWdt+VX3j2+MVWjjoGjAoKoHMmatYQKZ2R9ZldqBUEUHpm4Dd//NfqPzxEDcGscrocV12fQ6xNrLUETFM+NorUMIDPRNFPuTSempe/5O83GLSZVr29MZchLGstIjW2TzW4eFF6LrRdrnbZzQw+3lsI5gvS4+NYOfd2Wbqp9mXjV/gvNS9dUX1NyfEThs0BHhTIskq2O4v04Q4HlihmMBSqRng5ERqIKX9vVz8lcRq7Hfoo0sciQ== 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=tvRxcJQkTcUxL+UY0CT1LkbMh/5QCJDI8WvxLfFze6k=; b=NdZO4KK6Cnnw4xzoOm5Q6YfK8kZvbawsHzox7CCkum8NdHeT5jCpWpl/7NKdb+jsIivo9XdnDfeUaPW17O4TvNzHkUzVBVGkyKwpr64uMtTlQtmioB14+oS+3TuboxVhzDAAu1kiL/b5z1Xhj0+MnTvQPQjRJ3EUKgTxDfrdYnR8TMl6X6s1CEsMVmGvM2WLX8uq3Gl1W+pGG7bH7FC0Gm0byZhkhLa/NbP8itsVQCuMWsls5vvVdN1nURqvdUpbhCtE8XY6iB9/XHn/MzrDW1yTSrgycb8MkblB7tz6CJ6GsjqI6jjh6XNvYTG/d8mfN4MaR15W2ZUJxYM3qPoZEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tvRxcJQkTcUxL+UY0CT1LkbMh/5QCJDI8WvxLfFze6k=; b=fEXGWJJn5P4XNa0sBDtpmP4Mai2h0uOC9b66ZC+Q1ZeRfeaoDlkDtiSVfIVM8mypCgYZxFYnjrDE3JHAfzevvUtMwxGWia5baxtDcRiQJBGPv1YEb2FQaBDEFrY3uoolISyGPba2FYhDFwGmYRyDq/IsnOptfN/MSsC0hD3MKteJm7whbZJwpWo/1SC2lduAFN6Nzwn0kIdZkqXU9KYRmLpCVnNlfoneMIcwST8iRRcb3jNfNZBaDrgCC1gNikHMcmGPqGUKN+NkArdXPK2UT8rGBZIPPlponZXr7V0Qz8OKvQxvGlh9NuqhylK7Tgvn11bpbcWnIWUp68rd5BK1Eg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AM0PR04MB7140.eurprd04.prod.outlook.com (2603:10a6:208:192::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.15; Sat, 28 Dec 2024 01:15:44 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%5]) with mapi id 15.20.8293.000; Sat, 28 Dec 2024 01:15:44 +0000 From: "Peng Fan (OSS)" Date: Sat, 28 Dec 2024 09:14:42 +0800 Subject: [PATCH 06/12] rtc: stm32: Use resource managed API to simplify code Message-Id: <20241228-wake_irq-v1-6-09cfca77cd47@nxp.com> References: <20241228-wake_irq-v1-0-09cfca77cd47@nxp.com> In-Reply-To: <20241228-wake_irq-v1-0-09cfca77cd47@nxp.com> To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , Dmitry Torokhov , Alexandre Belloni , Maxime Coquelin , Alexandre Torgue , Linus Walleij , Conor Dooley , Daire McNamara Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-riscv@lists.infradead.org, Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1735348488; l=1529; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=3L5kSry1bFWI+vzXqFXX2mukiWSnq2LH9PLt8NvYjoY=; b=B3T68jTJq1CEoyhrigYxE+0meJO14wNaqx5QKL+LOdMajmlDmTiJD1lez46bwXprMXVKEvpGi mJWb21WGEHODrDQuLK0flOSEZPL8Qlp3R2EjTV1CpPGtdR9Qqxe+1vD X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0099.apcprd02.prod.outlook.com (2603:1096:4:92::15) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AM0PR04MB7140:EE_ X-MS-Office365-Filtering-Correlation-Id: c3ef80ce-50f7-4fb6-f7e3-08dd26dd271a X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?P9XXyQn08p5anJARNCBGIVRI2oIWLj5?= =?utf-8?q?cqbJ+stz1BvjF0fbx6TIR0k/gBQ0VG1W/yvQzwt2O2OvT0SqpwxQihMg+U2kXM/MR?= =?utf-8?q?vGmR6FFCg4dCBuUk5+/a9Pk6txTb7QUHOnI/rOQj3OtrlTCnQkpIkkNG/i1x/i2/U?= =?utf-8?q?kqhXVzXg2pAoUuPX8vwf803WClEuE7NHioTKpTUxwjFqR0BbFxdMqm0M5N6U43hEv?= =?utf-8?q?4za0qB4Q0L0Isdv3NEwKhEUk0EnAkoQ1s9EBLcJG2ItO8FcaXj/LTfZTTqgxl1UlK?= =?utf-8?q?1U346cZoKdMkBrEjSRR4CZundMcOXRyc8sKn3UO7In4Qja2zQ7pgxblfcY1RcPolI?= =?utf-8?q?cdRwWs/1ZFFIlbAqRbDw2sEsZJMk2ZYH3OlQlU6MI8CxNMruXNvnxZ2BZ6/YhSusj?= =?utf-8?q?YtgEjUPABAa0v/VZf1yGUwgMPLl9r8TdwYzbFJE9q/e99glhZF1/AVyXnZN92Jsya?= =?utf-8?q?d1YXnQ/8341HhrFuq//ktFKCmaZ1S6ADMUjg+RPED2fMa6b14lAjGt7rpv7xcQMO2?= =?utf-8?q?/M7nBhEa8cKL4v0DPgfL3aPX4p4nvbELvxyzjCNKrKZNETKr9oiKJWmetF5UjZwsO?= =?utf-8?q?/Z9qiSSLyWamda+tQ4gnd07PY5g/gAGKkPVw/PDDF1qiO451aTNVW9K5k8tMnXhdQ?= =?utf-8?q?/t5QT34h+1R9zjmmooGF22f+vBMXg/pujXIh25iFIZDsFI4SxW/1HGVXybBshoNh6?= =?utf-8?q?oeM9oyM9E2GUbbl9XK/CR49A22OKeOU9uvxRVXRNjQ1tmQ0lcyW38eQBNZ8f3mW+v?= =?utf-8?q?v7q/8hvzXvkwqLfpXj4DzxYJ8xelxcyykfMCVfxK1+5KV9sCnbG3fT0WqmPX6HJH/?= =?utf-8?q?HTATGpqwwlWiqao5pjScXFjXf2HyhA08Tt1hMixROK3P1F+AO8tY7O4SjzTr/NIxg?= =?utf-8?q?XlMajhtmrqaQIgUARDNIV7QXZqcHqGqOzHcVl84zEgZYWJoHWox3MVqSUsAZTBg8a?= =?utf-8?q?jvE00aREr7PDmPwsVS8t8aj2za/iIT8bFe0vBB4/3dqd8BnUzpN7ev7EcsLnqD5Y7?= =?utf-8?q?27fOaGgCFtAPnTOqbtOm72awgaa+MaADLmiEaqDKH9/sUePxdyYj7z5mMx8d/29vV?= =?utf-8?q?425XjfsbS11cQB7RMJQ11DmPaidlfifYlFyiiB6k43Pnel2TsmsD+oKs6uCnMOtio?= =?utf-8?q?xn4fFv0tOOkA9slGyVCYh/r2AIx15aFt1DPjxPxJbRzEQnjEC6737qPm3j+8+1Pe+?= =?utf-8?q?7jZyH/io1FPLxnHFBUUhhmSuV/GTF6m0g/cd38UZXrEQ1KJxZeaGN5zLYYGxjt4DM?= =?utf-8?q?TjG3dDmqVIdlicTofF9urx2EzeI5mUfXmBFVI/KTbAiWptjcTWySD8DuoFAtUtyKN?= =?utf-8?q?xq3CPg2X/HSzR76Zm1bvLPibFtD7nVDetkC/IHcONL4dVkyA/utVYuMn+abuKvUnZ?= =?utf-8?q?SsBeCEsSrdl1+oOfqSEReT2t+3QIzDy8Q=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(7416014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS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r5kX19bY/fSB8zec+R6FwzNCHlrlJkWhbVFZ3W+97CSpjj9Qqa?= =?utf-8?q?b9CkRNXWvzWRMZvbtwoZipJfIb1DNFxU1YnjjLezgc5OIANVBPJFcGBA9lS6uSqpy?= =?utf-8?q?21yskW+96Bfirn1y+M0hGkTJ1epKHHrlaUOFUq8dIXKHRV00vXKB9LpB582nHC9vS?= =?utf-8?q?SxQBSa2Y6kz4J2XrfPSagHdDVJpzK93hR6mwKEPuS+z6kbmvN6rpRWtWpDzgH39M+?= =?utf-8?q?F8faWmYNRVJSIbRzS7hocTQrw/fNJ2w7aqztl/FiOfWWcKuWglJD5b/Wx66tQxrkp?= =?utf-8?q?QjH6deNVb203ls1Hhnre7TfOM7yyZv5JGJqLtRNUKyktZRrg2NGc6jtTv8dqMwDW/?= =?utf-8?q?KwcMtyMrP+r5+2l5y8BFRsQe+GicC+Y2OcyoSuwUL1OSUP+sWAsNvLhmSq5pmtaRA?= =?utf-8?q?PyKTvH5Tr4KDPVqpsT2WmhDYv/Rcz3QxeacnGrbcoMuoktspUY5vUfTuYnYWQ/tEW?= =?utf-8?q?sF3L4weeFH+aRafDhbf0gwwKN2Ok61Zy7BktKO/BL7/8rimftErM4OwCPgHNziJz/?= =?utf-8?q?VmFhiMWclgGMxl/Gm3m6TOhB8gbObafcB3ayxQPddJCPG8cpaNvG955FUjQFqp77R?= =?utf-8?q?Xnen/PhQYTV5b/0URp7yKjLdQ++3qKg4mAPmAhEhiN8Di4O6yEifLJVbdDObGHOnt?= =?utf-8?q?0pqQzRAsfaXz?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3ef80ce-50f7-4fb6-f7e3-08dd26dd271a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2024 01:15:44.3329 (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: EASzHYX0Y9Nate1j5d6Lk4cnEVHCD/u8gP/xBHIzZk1pkFSOr8l8qigS2Jf+nvLIykTkPagclVuGWw56ni4Vcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241227_171551_282567_FA1550A5 X-CRM114-Status: GOOD ( 10.15 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Peng Fan Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the error handling code and 'driver.remove()' hook. Signed-off-by: Peng Fan --- drivers/rtc/rtc-stm32.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c index 9f1a019ec8afa57245c6d40d378ec50fdcd64deb..183017b0d33d10481f94891de24cf2eee95893f5 100644 --- a/drivers/rtc/rtc-stm32.c +++ b/drivers/rtc/rtc-stm32.c @@ -1151,11 +1151,11 @@ static int stm32_rtc_probe(struct platform_device *pdev) goto err; } - ret = device_init_wakeup(&pdev->dev, true); + ret = devm_device_init_wakeup(&pdev->dev); if (ret) goto err; - ret = dev_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm); + ret = devm_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm); if (ret) goto err; @@ -1216,9 +1216,6 @@ static int stm32_rtc_probe(struct platform_device *pdev) if (rtc->data->need_dbp) regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0); - dev_pm_clear_wake_irq(&pdev->dev); - device_init_wakeup(&pdev->dev, false); - return ret; } @@ -1245,9 +1242,6 @@ static void stm32_rtc_remove(struct platform_device *pdev) /* Enable backup domain write protection if needed */ if (rtc->data->need_dbp) regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0); - - dev_pm_clear_wake_irq(&pdev->dev); - device_init_wakeup(&pdev->dev, false); } static int stm32_rtc_suspend(struct device *dev)