From patchwork Wed May 1 12:56:00 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: 13650591 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 7EFA5C4345F for ; Wed, 1 May 2024 12:49: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: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=AFe2CilLvxJpxKhPCz1UEuGpMY0igqHuPGg7Q/hVPSE=; b=Wb5UvRAYwf2NHwIcfruwhH/WBI SI9GoHe4EnwodQ6Yc9/wZhk2KWESKuWmncva5JEiJ13kALmf36vBgXLzsDQXSJMN0hR2PXF/wFCom cdNLdJn6iOkl6BJ+jDRFA1m+UY0UzDXrxuHQtZ20QFiqO/RLPsfADsO/+eLrw0grF//AyoUE6oNui XRqlRfPyEE/TDcn/WR6ZmRePzYKc93o5rd16wvaO2h6EgHfekqXHatvMU9Pr1L3dcBYckbSp3kj1j KwHyJxvFl6V0A76Kvs+y0gyzIrf77PKpJOipDV97GrC/ePnlM77G+ntMuvjj99RlLGdVIcWVO5ftg EyvaUKvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29OQ-00000009YJ6-19zI; Wed, 01 May 2024 12:49:02 +0000 Received: from mail-db3eur04on061e.outbound.protection.outlook.com ([2a01:111:f400:fe0c::61e] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s29OM-00000009YFd-0cFs; Wed, 01 May 2024 12:49:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BtUM1Zx26FAYDaCIfLxu7fGXSfjyfDqQKjq00DL9+51H8D0XXZHA3IPYETXlSw66QVS0BoVG1oHXsBHdbt/XhMAIypbf/frw4PpOFejJa/Vd16yjg89Ol20W4V1IE4kNtKmDZR/cIMSqPpqmM36JeV0/6mZwR1Dw5kupM9MuSny11X0/+/gossdQveqI3lo8Wjhe89ZlUV/GZtuw6A44tUSqu//fqXcvdX1fs2k1XCZ4yQ46b18dScuPfczImTaRTCLWNqcyM5w3EcShgyT0I5Nr8oTp8jP/12aUFgh/SkqEQtZAzL5NQ58IuQmQbif1WGBTjvnTAN6azSY5evLZhg== 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=fdVrOSBRAxxFKx+tFjA4FVBPMccJECy0Uh+F82a+UOw=; b=O8iZYvIqc2v0bQ1IuXZD62LHarNTgg+Nw1FuIHAOmNvpcnArOCcdoqkKU1JWpr+5XOJETBRgCaVmn/CsLUxlPVM1/qdlHn76Oml0eIpA4y2BhVITYsYSCjYZ2sqI6ro5wrMoF+PrI9a/DAJwOBv55JOkBIj1lKDJrNfHaoN9ZtAB4S/rn55C56lkocHnMYmLdoI5wCr+KmTES1rPTs0Us0bgucFF8JezsMawHk1dz01RpZ2aRmLfD1Kn8sag5UPVFo5ulVB6MEQuwBGxO83x/u7Rr8oANJDgyZhuG/It0aMNhSGAivHRygkA09Bo9MYR2tVIlymjxykcGDSMoRFdQg== 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=fdVrOSBRAxxFKx+tFjA4FVBPMccJECy0Uh+F82a+UOw=; b=St/H2kBGw1IKsi/DaryohVBFsNhSXuGD2J28Nt3bd+SJvh7Ydcyh7dpn4JL2Jbi0VwIgmfoA3mdBdiOhoV9zNowsOOq92DLi53vC7Sd1bGVnf3iXUlrvb4W5x0BhUKy2Xs1pZE+zUZJDqzIJtxqFi7MHWgKoRrHMX8WoRzerpyw= 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 DB9PR04MB9284.eurprd04.prod.outlook.com (2603:10a6:10:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Wed, 1 May 2024 12:48:54 +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:48:54 +0000 From: "Peng Fan (OSS)" Date: Wed, 01 May 2024 20:56:00 +0800 Subject: [PATCH 02/21] pinctrl: tegra: Use scope based of_node_put() cleanups Message-Id: <20240501-pinctrl-cleanup-v1-2-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=2500; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=HWFw/UIgLMd6Ej1stcfUoXIfV6KFRULjDzCXoqwdlCc=; b=C5u5mDNdj00sFDZuSa9UWjL1tsHbOZz4YakGZqcS0xoSlLSwLVG2R5/NNhIluvh+BjLh8Vf7s CYFLuu1OxMhDtwRO+rjL+B7PKrWEibGnZZ1fjjdhVzBQmcHrpNNLoVw 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_|DB9PR04MB9284:EE_ X-MS-Office365-Filtering-Correlation-Id: cb754a66-66c0-4c35-06b2-08dc69dd0f54 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|52116005|7416005|366007|38350700005|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?I5OYzWNyBTGLhQ0qI12q8+AsCxdigY/?= =?utf-8?q?KLxxuKhQ2yuZag25GXw0XSOyAmFv9SUrcdz2s4GeZ0FRXD0mwbmsWR9LIit2kcdap?= =?utf-8?q?lpdODHHg4iyoMqP6E4BRaMI4gdsERQt8ZDvXDa14ZtlObqhxvuwbxX2KV8sH8IjD3?= =?utf-8?q?HqWvgFUP4ijs9qjrdr3XDjkg6t+3pNZWnxx9tSlJ2hVJQ0PUXTQNig55+wx8YjOrv?= =?utf-8?q?3sick0hDkwTyubtZyv+bcuNM7DCHTZgeN/n36416qdRZu7zzOkdQjOjyzMmNEmZON?= =?utf-8?q?KuxfikEqmZXzoTG6dlteDxvDazOcuAqjHxmEA0HDrQKt84xZav/BaBQDBTR+C6pdO?= =?utf-8?q?xiqlYxzV58VMDli9EAHB4wWfhKaIIwDx0Wel1/kGc5ZUF4ozWMkm4oOaTwBJQeCpK?= =?utf-8?q?6lb1kYgGZrYj1ChZew3pqptG/dIz8uQINeOJ3vTJgmdR3GJ2ZihqBMC0xYuYwjYrJ?= =?utf-8?q?+HI1DD+P7g9TV3vAjpm/2PTPDtJ7Q5+9257vspIuVQ1Dbs/jhEUmdVSBd8lfem6R5?= =?utf-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od.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(52116005)(7416005)(366007)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?lnUM3dE4li4XmahbRcUTxDx1bRDW?= =?utf-8?q?eP330aY6qMYBoHdCnhGSh/jrrNs8joaz4/gzv6J9bDjpHEpy6Ne2FauX3LY+jKKZx?= =?utf-8?q?4h+8niF3bLO6r7BJHV4OZXKxMejGLglHdomc0u3CH7NuapAgCT8dfYwEXI2dPwgyp?= =?utf-8?q?GKKK708mlZxDUs13WNitYHVYEQpqSR9p41E/OC/Gzg9AmpYOwoWk/RGZjKD/NCueS?= =?utf-8?q?7qRbBYGlRNK3vo03qxvb58ght2JV916ElefQHm8BdrMcJKL11S2DNNl90ZgUb4WoH?= =?utf-8?q?7o2RsQg8x2mMFZzfzRvRQBwMO8jy0lJqqaH8KpVHVgOUlqDBgt707c4dXUOkZphG6?= =?utf-8?q?YWejMrKdf1HoGIGtGvHUFKsLEbLL8l4f7+KII22smrLDgig7+jc4/m7HrzOqHgU77?= =?utf-8?q?OcXi4qX1K5Sj8bsU2W7UAa8gDIfVkxTkqKD88l7y5sDMJGSpAsjqaPVxGJPgXsDID?= =?utf-8?q?yqOQr+7D93ulARbljTM3MOmB9kDVewiwYKcTPSg/+h3EUxGE29POnzaxbwXdjRnVZ?= =?utf-8?q?5vj2rfZqJE3NbrKqREd9yOa7cpPvSb141QhtApwr29Aiw/blOiELI98l+eeFPPif7?= =?utf-8?q?uzucicPQD8TwKh8fuuXzuDmzuXcmrqBWBJpBPg02bVz63p643Tx57JLpp5CtM7g7l?= =?utf-8?q?HdLvBFSMU0TJWQPXWFlu08pAK1l9bM4+TxoBfrmddTryLOAXcy1syLeDrtGKCvmjJ?= =?utf-8?q?WnqnT+0iHiCHEWFyx6kA437o9+/TIzlpOfq/p31mn8u0wYqqGebP1dlrRcQ1kYj5k?= =?utf-8?q?2SBG10qU3eU03loLVNIb5CbLG01qWc3hxvE/iFYbr0/9DWSpeBJOjtwLnI7lwJfaj?= =?utf-8?q?DZ/ADKVXDDFvEAzRtp8q+RAmXkxZhXpQB7CNYg6Z2C5Lg+H9GuLwxwTq/aFhl+Cfm?= =?utf-8?q?S3Hst2A8X+ptRwYosxVCZGJwcFrSInntpXLqym5u2in+SU9z2flLpPA18LpRmA4bQ?= =?utf-8?q?WWayGwemA/oGQOSVy0/I3FkE0QWNS6AS0zlOIu7fD4fHCbEgBiMP79J9XJwAAw1z4?= =?utf-8?q?c3GMWHncL4+Z3NdU9XGAFugOgYvzJdWf3elq8CLg6LBXSOTcXCmt9GC2CPQ78ddrb?= =?utf-8?q?8R75g3aRha5h3d5KI/dkgJymAAHlMqj7IwZFWbkhlFSI2XTTfj8SP+9mIdYlWVVWP?= =?utf-8?q?IYZ9ebNfa6t7dnuZlECRipz1X5Td7A5f+YKsfBiYEmMrivv5fF4BvAA9xRVojW7Vi?= =?utf-8?q?0Tr2nMgSuA2mW2acPzIkG2MwPljPz87PANUENoH8GlmfhfSQA9MxX1WNf9BxWBgN0?= =?utf-8?q?2zARB45Okv6rCeXUh1Q118syIyj+bLpqyWwGlCeJgHVBZ4bzr1ZLELtLX0ktA3LM7?= =?utf-8?q?dAmmiiNTIQFIjbYvYL1MM+D1JLnOsEktIwN9vcdsb56ebfUEo64Alqd+sDYlIQNdB?= =?utf-8?q?PemiMhpUHjy9hI6e118YMkX9lh94DzJ/DcAhwmyYGt+QIlywDsCuLXjVAtxVR4P2B?= =?utf-8?q?ZlVJNR3E/e8kTyiLAi9ebnq6uGnxIkhba9F/zrAoQaHifRMfEkDZVjjTG4PhdTvwT?= =?utf-8?q?PBK9XJROdLxE?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb754a66-66c0-4c35-06b2-08dc69dd0f54 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:48:54.6730 (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: FT/DQq33uv22k5h2D/q7d0r+R/Pqjofvm3IEi18jKGnU56jr/GVnE2Loef6PhAtU5CmwT2c9e2bct2uKi9tMmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9284 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_054858_326309_3FD2DF3F X-CRM114-Status: GOOD ( 12.97 ) 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/tegra/pinctrl-tegra-xusb.c | 7 ++----- drivers/pinctrl/tegra/pinctrl-tegra.c | 10 +++------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c index 96ef57a7d385..49c5edeba87f 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c @@ -238,20 +238,17 @@ static int tegra_xusb_padctl_dt_node_to_map(struct pinctrl_dev *pinctrl, { struct tegra_xusb_padctl *padctl = pinctrl_dev_get_drvdata(pinctrl); unsigned int reserved_maps = 0; - struct device_node *np; int err; *num_maps = 0; *maps = NULL; - for_each_child_of_node(parent, np) { + for_each_child_of_node_scoped(parent, np) { err = tegra_xusb_padctl_parse_subnode(padctl, np, maps, &reserved_maps, num_maps); - if (err < 0) { - of_node_put(np); + if (err < 0) return err; - } } return 0; diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c index ccfa3870a67d..69088609a0c8 100644 --- a/drivers/pinctrl/tegra/pinctrl-tegra.c +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c @@ -188,20 +188,18 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, unsigned *num_maps) { unsigned reserved_maps; - struct device_node *np; int ret; reserved_maps = 0; *map = NULL; *num_maps = 0; - for_each_child_of_node(np_config, np) { + for_each_child_of_node_scoped(np_config, np) { ret = tegra_pinctrl_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; } } @@ -759,17 +757,15 @@ DEFINE_NOIRQ_DEV_PM_OPS(tegra_pinctrl_pm, tegra_pinctrl_suspend, tegra_pinctrl_r static bool tegra_pinctrl_gpio_node_has_range(struct tegra_pmx *pmx) { - struct device_node *np; + struct device_node *np __free(device_node) = + of_find_compatible_node(NULL, NULL, pmx->soc->gpio_compatible); bool has_prop = false; - np = of_find_compatible_node(NULL, NULL, pmx->soc->gpio_compatible); if (!np) return has_prop; has_prop = of_find_property(np, "gpio-ranges", NULL); - of_node_put(np); - return has_prop; }