From patchwork Wed May 1 12:56:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 13650675 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 6B189C4345F for ; Wed, 1 May 2024 12:52:25 +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=WIuAc0VVRMhJaNUT57EnWzpiNFFTTJmiuHBlUCCAP08=; b=O0l+YHivJ9fiqmGe2msW5/q4iN GFqetCihrAMOJwKQCtvybIsS63bXJSpy6a4OoepCpa8lpQmB+YcGA2KGWDQTSkaMiNlSvUaIEoygi YDFetUxmkK+9KVZVruTOzVSs/74nKLNfA+egYYXTg8Z3i0lBJ7sD0ifhxQwxF5b1NuzXooeHv+EGX 090+TNQBkvunFFTdTf2uKg9t416mN4brzC6ZuzQxcPHtqGHUQsdJUZsUT5MlHdL4NhcOasIALsIjm asWJtX+OGEA1r4tYZY4G1HlShA5JpyJkgwetTWiuFT5XnIHh9RwmRw0akTCNXSJF3b/vdIHE8+Bk0 PYBwYFJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29Rb-00000009aEh-3uK1; Wed, 01 May 2024 12:52:19 +0000 Received: from mail-he1eur01on0603.outbound.protection.outlook.com ([2a01:111:f400:fe1e::603] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29RY-00000009a7r-40N0; Wed, 01 May 2024 12:52:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FHKYXhSHTJ9CRRmSXyMxJ8eBbJfoWIPRlZumxz4YH5QTfT5dI7D+Y8O4KDmaMZ9NgmuKvxB5wLooMj3JBPKgQSSJO5D+/Po7N/0IyFud4OQrNb4X15VWEiVo2CL8Hl5Kv5/ijJMOLUS8LclOOO/MSqNjBAW5taaChz+1Wau2zk48XrOB0taMC3wyqkMwf/X0LZq/7X4sJT5yN8QTw11DHvqw7+t/ZEqKk6LLwnx7mu8MfWBahI+VcTPDPwVoKUAbYyh8COb4EFodLjTUIsQbt7w9sqL162/i8pkwae5+FwHlr64t2M9OVqw0sInjz54Z20FwEGEuBwHCiJ6bTuDIzg== 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=jwSQeOuBtaXKgwm8vbTLzd1pc6GMs3D2WpIMolNx338=; b=bTqFgfRXnYWK3gHt2R66SDy2R7ajOl+qz5hjlLUFEb+3gmyv1ZPuEa0VasK/8MDIkU9fgO47zEfYMovP9ocoOJYf7Ms+Guz51h5mIJoP+WZlGmRKqi9SDm/799icLa1ujVDDam09soHWOVXaG7eIzeA5o33Qd04C2KY5e0dBIJW8Li2FSyhUehy+QZV6BR0CHpdypBARFczkmfdXUagwgbcNwjXjJvZPbtSf4FsLgvtrYbfKg4P+yELmVg3LgIcryCpTfGP0r7nR/UlMDEO/wR/4z1qThrSp165PGlr7JYR4B7CiD8ZI71U+gTR3PdeuCpqaa0IkkFCMpj+BkSsIXg== 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=jwSQeOuBtaXKgwm8vbTLzd1pc6GMs3D2WpIMolNx338=; b=ZKYeqlWLS/AdM5XC6NCh8Rp/qCNsPRMQn0dI5CNK7D90agHFXJpnKWO3O4ZsihfG/hms4q248fRvH1ghI2cuuI46OykyXNokFJ1cpiXAQ1iJVBM/qY+5QJAKOHNBmCIiGTuDlDl92XraNhHzQ36uvQTDQz/hQ4zsN5Roz7kvz0M= 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 DBAPR04MB7448.eurprd04.prod.outlook.com (2603:10a6:10:1a6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.38; Wed, 1 May 2024 12:52:08 +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:08 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:12 +0800 Subject: [PATCH 14/21] pinctrl: at91: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-14-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=3508; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=DsW52PKsk9s0VQOO79Vygj7HmsG35ZlCr2kUzApk7jg=; b=1cdQjjCVZD4XTvl7jD/+3a4DFvCSK+DbvouTIkodDirgS/P5DNB2U/LQnNk0QE9haDZudVF3v E+GOjqUPfNdAbyJ5f1Dr9PQyXKF6GnAn1dpDh7P5hmY2qLKYBSab073 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_|DBAPR04MB7448:EE_ X-MS-Office365-Filtering-Correlation-Id: c1a8b2ff-c9b0-4825-dbda-08dc69dd8302 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|1800799015|376005|7416005|52116005|366007|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/+UmSXQkdCvAH7xazB+XKVHoY1Lp8Ce?= =?utf-8?q?8uvi4SR+zREfsPfm8rFwIZ8xRONQaULsJ7/g/MluAowRdlMNUs3Dek4GZpts5q6Gy?= =?utf-8?q?LAeXpXcpIRWUbRjV8BQJ/fjQrZ+lQEqjLPH1HEZYxHVy+f10XUWFWsh9UJJfd29FK?= =?utf-8?q?GQtOPCxdyrMl2whBL1Oxy56sB6h0foS0tdv9cyPTWBKwMMs+1v/Y0smJV5nhcPY7w?= =?utf-8?q?/B7ccMwMTGYkuY40cipgFlwMZ9STB2t7uTU/RZlo6W6mQkurJU6v/W9EOEYz5AXyX?= =?utf-8?q?Yx0/eLMVhTfvbEkhTO+Hm7A+V+0nW/zEp41dcAN6lBFbj8R2eroq3ZZPHpW7V79A+?= =?utf-8?q?GyG5XDswzMkb4gc1Ao20q/DIrcVbOBDZ/U/KMlbWluNeeBNwXXuNXsTCMDWz6NrDb?= =?utf-8?q?NdTJJS5u9F7PRvJQqVAMLy9z7o2uzDzwJQIZ3pEQfdlT7XCK09X/8csSed2JJHsGu?= =?utf-8?q?/W/0B+G6Z2bgoFn9fg5WTf8QdWj2Pb7IAiRond7ZAoXcE2Fbx6DRZSzrhPdpE5zhs?= =?utf-8?q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prd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(52116005)(366007)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?P/o3sCLQU1SjyCfOAJ3JtfXnOVA3?= =?utf-8?q?saGM6dDBsyb9/DWyeQrxJRaAEumUNHdxzrouEnD12QPGQT6eWkgAW14wP8piGchlp?= =?utf-8?q?WAg//sq9cEL/fryjYPhEFGCQd2nmrFwSXM03S9Ma3TSFgV1Ei566KvfAg3v9tOoTJ?= =?utf-8?q?0yccbxMWAYnttGpum/pGAQxWPQrmlBVvfih43rZkUgg8u47rgzCssCYuC6EuZ8Hjv?= =?utf-8?q?ehNQbjK3JdWpVVd8w+9EPSahbYlFYtORmWXP9CU0Kw4/NkgjBuw3cPCYfpyFediks?= =?utf-8?q?/5ilsYweg8ARgnrSOGVEa18P1FiPg2KXHThvTSwisSi/aLRNJU7Hi1LGcY0CUMrG9?= =?utf-8?q?WhrXziDqHq12/pnjWEEEHGQyi0yvOTbv312q954YE2xFTE/5n/FSdMqoOf9F4Fyi9?= =?utf-8?q?eeS75wp1+zFOcnYvFBB3mOb7kGX3XtJvukEHJdgXivb/cC+VYsFxzzkT2lwJs4v5k?= =?utf-8?q?BQ79Sfxt2mDcKQJxJUt3p2RZ5QInvY22PC0I+/3SpLpXMIQVu9g36dDpyFaqXkw6Y?= =?utf-8?q?XwbMTR+yuwfHAuOt6WtHrdy+j8XHQoYuSZySGHTGee/vj8pC09a4ldpPQCV195mGF?= =?utf-8?q?5TYlaNqkl2Sjc/D0JLWFF642hSJbOeCxI/52k40/I7OO9WKWumlJLPuJTop/wmfnk?= =?utf-8?q?aKiL/db8k3YeKjCtse4yDZBLKYFPKpXoInhYYaV8asK0oLF/W/L+bha//y6Q8Yz4Z?= =?utf-8?q?oP/0WSzKiGXJz8Ogp0lRwNZliUjaXso7tSXuHt4lVd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uthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2024 12:52:08.7592 (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: +p1DJvd9ZG11gV5c3BC+frDLn4qMRBqxL0203eoK/HfYhX4xeIDB+3pmdc02l9InHrExMp4T1fUbWYaVNVbo6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7448 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_055217_296439_C1737DB0 X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=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/pinctrl-at91-pio4.c | 7 ++----- drivers/pinctrl/pinctrl-at91.c | 17 +++++------------ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index a27c01fcbb47..8b01d312305a 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -632,7 +632,6 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned int *num_maps) { - struct device_node *np; unsigned int reserved_maps; int ret; @@ -648,13 +647,11 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, ret = atmel_pctl_dt_subnode_to_map(pctldev, np_config, map, &reserved_maps, num_maps); if (ret) { - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map, &reserved_maps, num_maps); - if (ret < 0) { - of_node_put(np); + if (ret < 0) break; - } } } diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 5aa9d5c533c6..cc32db0797e6 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c @@ -292,7 +292,7 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev, struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); const struct at91_pin_group *grp; struct pinctrl_map *new_map; - struct device_node *parent; + struct device_node *parent __free(device_node) = NULL; int map_num = 1; int i; @@ -325,7 +325,6 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev, new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; new_map[0].data.mux.function = parent->name; new_map[0].data.mux.group = np->name; - of_node_put(parent); /* create config map */ new_map++; @@ -1244,7 +1243,6 @@ static int at91_pinctrl_parse_groups(struct device_node *np, static int at91_pinctrl_parse_functions(struct device_node *np, struct at91_pinctrl *info, u32 index) { - struct device_node *child; struct at91_pmx_func *func; struct at91_pin_group *grp; int ret; @@ -1267,14 +1265,12 @@ static int at91_pinctrl_parse_functions(struct device_node *np, if (!func->groups) return -ENOMEM; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { func->groups[i] = child->name; grp = &info->groups[grp_index++]; ret = at91_pinctrl_parse_groups(child, grp, info, i++); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0; @@ -1296,7 +1292,6 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, int i, j, ngpio_chips_enabled = 0; uint32_t *tmp; struct device_node *np = dev->of_node; - struct device_node *child; if (!np) return -ENODEV; @@ -1349,14 +1344,12 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev, i = 0; - for_each_child_of_node(np, child) { + for_each_child_of_node_scoped(np, child) { if (of_device_is_compatible(child, gpio_compat)) continue; ret = at91_pinctrl_parse_functions(child, info, i++); - if (ret) { - of_node_put(child); + if (ret) return dev_err_probe(dev, ret, "failed to parse function\n"); - } } return 0;