From patchwork Wed May 1 12:56:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13650720 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 4871BC4345F for ; Wed, 1 May 2024 12:53:22 +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=801+5UMqnkQDw+uG3v3KWp9L+hVgvSG3COgtmIZYQm8=; b=4ji0HJt2igdbOyJwFiluSJlfTk GxO4dyCXeviwl3yOWRcH9rO/JzzXrgsnsmN7uIeLjKg9+yft2Tn+XOP8HAGgxvqiLRiR/9wSUDsOO LaKdR+ErakYNx6jtduPVNWYAxT26GfHb9rOymW/jLJgGEDjDQMKgeWzY+6qOi7PfipEgBT/rRogRe vVsxvw8fCywra+HHBss5ODhUkGO7jvT8P7hGOL/rjQ0c3y48PcaSNjPHMqm1jNdVL3jLSwejpigsv SvA90mQ1RizPUG2AsE4wMgjJLDKbscVZ14kIIt/ctdVsbYW78+xjeIxe9og2iLbOGNlnnvwW9LGaF +gJ1gdSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29SX-00000009aoz-28i1; Wed, 01 May 2024 12:53:17 +0000 Received: from mail-dbaeur03on20601.outbound.protection.outlook.com ([2a01:111:f403:260d::601] helo=EUR03-DBA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29SP-00000009afc-3pS4; Wed, 01 May 2024 12:53:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QpUpPWj3LUslORyhU7NqW0Z4XFf8H/CovD6oS76C+83yPoJscaMhBLW2LhlsK93q0el2gXTk0ZbrBtvUbvpSPwvNmYVJ9xkoIJMA628vKB4qFl125ZAyJn18sxfB/kqDJck8/qKmPYvWRvGVUNt6tDsJUPQUdihY61NiYKEGc5gJ/fSAL1cH9VZhPjghPD18l8p0YoH0Hl5n289qckXtQAoQIB5hTgGSoU08IpLOgO7NXPWFmou4vmG13slj0KCx89o2C2vQWizE+1u4twKLHbpX4rTWKTZvx2/QAnq4UvVb+e0X2sQgN9NAtHXmrjzH7cabLT3P1u7T8VqUUorFPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=YyGeWpCkYZh4WcKx5URim9X/pl2xw38Z9ho8YthB/aQ=; b=dZtKs39o1PgE1rl4YWTIZUQxv2i3w+xckFaDakRDfx50gW9lAyySMsfFSidtvbgOYhYCmUiR49C9yklB3MVOQE2uIrdfkKRJ4X6nGU+QJjFRBLAMh9G17WT4fxEwHNNU3mPD9hhN4WHKqAIkSdI8WPYOdburywYAlmOuUhUEYYkkpgcfOiVMuyjjGdBkIi4tq8oAnrL0S0yqBpv+gBBcaRLRxxpuyCVlMoAbtzEBLhHvV0bRNwKMPL3NTI6dMYnstGuCpkZwMOyRIEd9N1gqi1lkiIMJv/IrotZtDCD6yrYE17ogB76mReUZSAdKKSs/uyMG8Y3C7OLQ2xpvHsd+5g== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YyGeWpCkYZh4WcKx5URim9X/pl2xw38Z9ho8YthB/aQ=; b=mrDsVXkmUtziBoSBdjyLep7uqWVO4X5qKWOAYEszWk36fCksuvbygikVuT8Kke2s27TrfTKtCT9NqFDzrHvOX1f/wH/FNKRRKsGUC3x7/eIzJk1gY589zToZeZ4iLFja9Y3sP21qyn3B/9489XAxhk6jZu8+dlmncv7ApZ9gRZo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.28; Wed, 1 May 2024 12:52:57 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::d30b:44e7:e78e:662d%4]) with mapi id 15.20.7519.031; Wed, 1 May 2024 12:52:57 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:15 +0800 Subject: [PATCH 17/21] pinctrl: mediatek: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-17-797ceca46e5c@nxp.com> References: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> In-Reply-To: <20240501-pinctrl-cleanup-v1-0-797ceca46e5c@nxp.com> To: Linus Walleij , Thierry Reding , Jonathan Hunter , Dvorkin Dmitry , Wells Lu , Maxime Coquelin , Alexandre Torgue , Emil Renner Berthing , Jianlong Huang , Hal Feng , Orson Zhai , Baolin Wang , Chunyan Zhang , Viresh Kumar , Shiraz Hashim , soc@kernel.org, Krzysztof Kozlowski , Sylwester Nawrocki , Alim Akhtar , Geert Uytterhoeven , Patrice Chotard , Heiko Stuebner , Damien Le Moal , Ludovic Desroches , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , Chester Lin , Matthias Brugger , Ghennadi Procopciuc , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Sascha Hauer , Andrew Jeffery , Joel Stanley , Dan Carpenter Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-samsung-soc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-mediatek@lists.infradead.org, imx@lists.linux.dev, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714568179; l=2143; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=lm1PEdHATfoxwJUL9YMs41GxvVEK/pacMdZ5mWFlWX8=; b=9opStnvvifVa3C/7Di6MWEQ5dybv+YMYe/v16eI3vkA8ELbqt3EumCOS/cY4boy3ZcVAxR+Ys /w1RPbIr2kdCf3yCOuLiSFTt5g7rwevE2UcF77MN/YvcE4IrIOWCqeE X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0064.apcprd02.prod.outlook.com (2603:1096:4:54::28) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|DBAPR04MB7432:EE_ X-MS-Office365-Filtering-Correlation-Id: f1a3651a-3d30-46cc-ad5d-08dc69dd9fc2 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|52116005|7416005|376005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GiLW7Gm8BqH+fUZBSR/cAG7HdnrlKOi?= =?utf-8?q?jIjpaRvsoMOS2gn31bzkJaqJ2X50OklDy1mTx+mfUz8HfR5u0DKPiufpF8rYPTkHq?= =?utf-8?q?kJWakGNKhoeHS8AozQK4jvP8khHxWFuuCgyGvliahTKghNtmuTn/tfTgczlyTBKd6?= =?utf-8?q?Xmqy0eat/N+wkMYSNJMs2aeG4cvOyhyEQP0DPNQs2g1BRk2WMQHelJUwPYxRtlOCA?= =?utf-8?q?n0SGTxcvSk97J9nA2HIf2vsL35VqRv1GkR+EadO90wvxL8qNoU0LF22iJzLCA5Unz?= =?utf-8?q?M14WOEwE0V5uZt0aC7ufUTsawKZno5IkYshLvowvT2qbanNqgB7+OSSrlaHP6scTJ?= =?utf-8?q?4rdfLohjurdqu/SZfLd5fjf3eogwqBZ4OWU+kH/LgKHxD6WcE2Dj11f3XbCiSqxHT?= =?utf-8?q?d4x1lopC5Y1x/pqak++4Wx7wQ+PrAdSFcAmQDoD+SiComv6c3WwxM8z4BhFTbSze7?= =?utf-8?q?Qa3JMNGlvAV5mc14jBxx27M8YYxkLfMW5w9d0bJicqmPIx1D2lJ5I9IpeGAgf3VTk?= =?utf-8?q?aX9iDJ1H78T8DbSBfGPaSYS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S:(13230031)(52116005)(7416005)(376005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?PkL5u6HQEiqQpBGx1PSYwjbwrMZE?= =?utf-8?q?elTxjc5/TVfMsySYthIy55zR4gsop2ZTzV+unwCsV+S/mKPuXrrggMNDuivIF1RrI?= =?utf-8?q?HEP7tzUTFyixJP1OER7xUBgGvs0UWC1MtHwdkk2DQfakKu+/g0YUmaDT/qb4nna4X?= =?utf-8?q?CaUce1SpY3XxXIb5z4yANjYpCdcXsq31AQJuj6buAiMzrgw6/4AQqZkiiU7XohgeU?= =?utf-8?q?xGKIHw5tf28PIIxO4Lxw+LVoUMEvJDCLWioqS519sMc2VUpuK+pmh40rQ2YZfEJwX?= =?utf-8?q?VyXFLn59FkI6lp2sGE1OJA6xp9iBpGEKOAmbCpX5BWiZMtiGqdWPmlZuqvTtlVYnW?= =?utf-8?q?AqyMwrWl2rTBc5a2DFVnMlgp8edGC2HO5Eu6682F+eOWJLz1TJtXwDSPgw7kmm5T9?= =?utf-8?q?kupa5HDpIbXsVEpEermD220ta1FzwecSBslBx1O0d4wQGVMCxbFHTy7bSZInFLB3y?= =?utf-8?q?itXY9b0iEVO+CZXZtnYrBTlurGOAm2zbXOLo5mgzdi28FeeXpTJ1/bSvwJeCL0iiW?= =?utf-8?q?bhgQBPaYsB0+vVHOlTKBze02db8jRQp5vQw50F7+Q14GxMsT4i218j8wxZg7p7/F3?= =?utf-8?q?ttBwQOEiPtHvgemOftuPTdA1LXgOp936aNE+AN/xET7DoRy4gugmrWSyiKAX4Mswc?= =?utf-8?q?Bk5OWseHeouCu3hCki/y2GCpnGpAjBcNwv8iE9Yr5/tJQqlR42esHc0/P5XC8DpxT?= =?utf-8?q?HEDTXGpl+xUslBZ52UbS4qqus+Ea3kmbUlDNWebmZmOF+ExHCGBCgOhr9prjEFpOt?= =?utf-8?q?COTpkSl0FfdYnVwHp9DA98po1fM6I5YnwAqbY5lXR7d/YQfqSafwx9j+xEQkDh/ZR?= =?utf-8?q?OiQQbRhzJQL7j58Ba82dChGsmfaPL5XnnquozJjQI8UxC/kR/KFvPZOdASpH326so?= =?utf-8?q?x5+oylfIMV/R+tfGiWr+N0C/KTeNF7o/tllOX7zh04ZUgdEnFBI603KYEgjmJXsbs?= =?utf-8?q?NV5lW4scceP+wD6/dCTcxSZWT8waA/U6yBEP+1VQPbkGZ7fI+IvmUapimJwwii0mN?= =?utf-8?q?/r8XgNtTf4tJ+2sRRjGpBc3rDnlmQWqCiVO2BdOWoBGzJdf9GEzRmasdn5wGEMeK0?= =?utf-8?q?nqnYnIOH+5auDXgvwwZUNoyGrnHO0awoUNSmv5FdC4JFecqQVWSyvRIqE7r1wplFD?= =?utf-8?q?TlgwPrbawLJ6VeLgXCAadnav5KuHAW/YMmg0UsA/XY6zSI2kXV4II0OdNGUrGB7OS?= =?utf-8?q?ODjX5GM6wlLf9EWTxLD5lTf0xEOgX8hTiFBlW87guARSgBCf4D9+lmtl4H2s1zIXe?= =?utf-8?q?BpBRHtLDy0clFTPf7ApHb8RtZ40IzRtKI6Zp1LgAK6WV5YSErr5vtUmEiP/HaLoJ0?= =?utf-8?q?MnZrDeS4jOaNzt8/eWCWdylTtkqDXaJXor1BC9uLdrFSkPY396RXfpar9LuVzOYnO?= =?utf-8?q?4ZcQjC3oLfyS2JfCvLkFMrMtoXB3c06dF9fkUarnicyG19mWBFhVIeRKfHl5HCGT2?= =?utf-8?q?04S/eoGXi2XAS74CO44kD90M0IHxPXxNqFbT9KLdqIj9btkvBFLQPHA61ryC+yhtO?= =?utf-8?q?BZ8pzmXye8wu?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1a3651a-3d30-46cc-ad5d-08dc69dd9fc2 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:52:57.0101 (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: D3oLRc6l+FkKfo79zh0DsHLNILeEjROEGdxGeEg0+nNZJ2mSCQbwMXmvOULDFDez2sxfMOKB3TAK1TIdpXdBYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_055310_177743_505601DE X-CRM114-Status: GOOD ( 11.54 ) 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 scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan --- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 4 +--- drivers/pinctrl/mediatek/pinctrl-paris.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index d39afc122516..91edb539925a 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -621,7 +621,6 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np_config, struct pinctrl_map **map, unsigned *num_maps) { - struct device_node *np; unsigned reserved_maps; int ret; @@ -629,12 +628,11 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; reserved_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = mtk_pctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } } diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index b19bc391705e..e12316c42698 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -536,7 +536,6 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned *num_maps) { - struct device_node *np; unsigned reserved_maps; int ret; @@ -544,13 +543,12 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = 0; reserved_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = mtk_pctrl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); if (ret < 0) { pinctrl_utils_free_map(pctldev, *map, *num_maps); - of_node_put(np); return ret; } }