From patchwork Fri Aug 16 15:31:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13766565 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 010CDC3DA4A for ; Fri, 16 Aug 2024 15:45:06 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: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=LbHR44bLM4FZ52+TjzVnIlbfMCn5qE1DnTHfiWLJ7c8=; b=LkgrUovhqZb+ipuAv89mfcC3Kc qgfMvDrdOWCEpI52KYetyB4qIs1EZWUx7jiNM1jwO6cSEd9WK7akURlPZxJig6e27KjTwyirIiT0q x9whvfMvkb++LePUOLM3i7yrw2+t/FzwsRSbwU3YaP+/Hjb4J9GWDcu6hicnExGAsTL23SmX4qldS Jskc1HW/0DKWz9WeiCvoclvjYIcaEt2LlIeFrJF+UMtexrRXa86eCiL7SqjqFAC3c+8YcDIRFKrEO yYRNJtxoG0Qee+7+fSuPGfYRzkGEI1l62L2rrsawszwfZZ+Ax2qMsHQo59OtG29/RqvAgIil7u/4O P4OtHL3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sez8I-0000000DRq3-1gXi; Fri, 16 Aug 2024 15:44:54 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyvw-0000000DOdl-48dM for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Aug 2024 15:32:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=LbHR44bLM4FZ52+TjzVnIlbfMCn5qE1DnTHfiWLJ7c8=; b=So0h236C5vALhhbeOxO+pJAPe/ Cpwjd+5cr1MXQfzprE1oYwCM2PWoKdv0VjRhoxBgdLtMkhgei0OPL2y+Q0uI59fFKlFIqwxCrEO2d EU7ybcwSqiUuYHn5w1fJoMm3T+yqtX+NlRM7EIz+Mg5nCbkWE29uQzgPMYIrcWjL3m3Zj46ZqXS1m xtswOTq+PwgKVTKj0UCkM9wSdo5/Z/29XJxVDmrgWYZFWnzMAdJtPxlnSHL61Dp5U7XjqbJgBDbks n+3gOXcefaVBqOGgl2T0P6lz3AQS0k7lWaeXe6v3xHej2J4OSi4MRMSctms1e1r33zNg13K6jZbf+ YIvMaMyw==; Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyvt-00000008hVo-2UR4 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:32:07 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5320d8155b4so2859449e87.3 for ; Fri, 16 Aug 2024 08:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723822322; x=1724427122; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LbHR44bLM4FZ52+TjzVnIlbfMCn5qE1DnTHfiWLJ7c8=; b=ofzi6kDHShCKll/hsNHqm+NNc18cgEzl9bjGmBG++flv+GRldSsADrSgtzjU2VNqTo opTPr2U+Ky7v67JgyuawGFO/hbAw6c9C5+ITHmYZ+v2jy5/hijv0gtHQUZ+IwUTWtBjn NrtPO3mWTcfzwiIdZHmgGu6EOuT4DmJH5ACTIkfZQcIhd7OC43hgzTVKfokHwp4PCSyH NNp3ywRsFizbZyjnoSeaB3Nc9zEUa2W6uh5Via3AZmn8/zcJ1nC7qTSdWGzuKqepzs7H gWOzD08Nsc34/cHGGJB/0EAHuWoqn3BTkcIodjqy6LZ10CBwP5OfJM3if6Y0kab57mme la2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723822322; x=1724427122; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LbHR44bLM4FZ52+TjzVnIlbfMCn5qE1DnTHfiWLJ7c8=; b=P0OoK2yvKFvSB7KcV8kAY5pt4eSH8sO9f0Gl4brlpmIVYg77p112rZQdMek18ztjak iSKDWGm/omqKOtHT2S/QID6JJpQs0VhZjK5rLphu2oq7I+AP/oMbwarlNXoUrJ0VLicI c+FhwqCoCgl0Nl/BeVr2bO3ceJj6E5ZW/IUuDatiu9hL6jRRMg5SgkM8I5/dKJTdgzy4 qg/LpLd1y9OBo82FJZVB9JIsNokNvnpvm0lsAd/W4YwEe7vl9C+Gmwh6veqss542qakb iW8PQbKJpY/Nyp303OimtmffLSVaF0W5p2aorzDBKQIiYRFTKHz16hSFRjoyzHJI+S/s 2ScA== X-Forwarded-Encrypted: i=1; AJvYcCV6BshOfipOHEQo7i6KUOSjf2S4Pw2aBkY2NiKUP7TQdWsoh5MUah4Jn3EsAk+y9Src07JQvRrKc5tuZSatS2ZjWIFM6D0fT2tB1s/OOWUv4hewemY= X-Gm-Message-State: AOJu0YxWWM4EQJCQHttOn8dfGe7NKNho92JXwb7IFfzCSI3MlHnY09Lc yBkO71N325rXM3IXW6fzIvAWuHliBhOsGOuowlJvsnidmOSZQhvJdBZojSh4vYQ= X-Google-Smtp-Source: AGHT+IHxActLiG1YjVcFGYIn8S8tpL7GYn5YjKZvtEnowQwIDKLJw+P78NbSRNVlVr9yhYxdj5YjcA== X-Received: by 2002:a05:6512:3a8d:b0:533:966:72cb with SMTP id 2adb3069b0e04-5331c6e324bmr2378225e87.48.1723822321846; Fri, 16 Aug 2024 08:32:01 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-371898497f0sm3853661f8f.39.2024.08.16.08.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:32:01 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 17:31:37 +0200 Subject: [PATCH 05/17] leds: 88pm860x: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-var-v1-5-1d0292802470@linaro.org> References: <20240816-cleanup-h-of-node-put-var-v1-0-1d0292802470@linaro.org> In-Reply-To: <20240816-cleanup-h-of-node-put-var-v1-0-1d0292802470@linaro.org> To: Pavel Machek , Lee Jones , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Riku Voipio , Orson Zhai , Baolin Wang , Chunyan Zhang , =?utf-8?q?Marek_Beh=C3=BAn?= Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1266; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=OVXsaLaHpAF5uH0owWFBXjKO4nS2BM2WznX7TKsIhSw=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmv3DdGtKK9vF/Igsn3otgQXRhwFYgtdI8zMghG N6WWewQV0WJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr9w3QAKCRDBN2bmhouD 19gEEACXTE/Bt5Piq+7QmHZKIKxE1e5XsrbSqm+4ImFiwaVig9kbXgGQLSXRH5UEENiLqiPpXwb cGBK827MslxTx5lvc0eqR0xGw5V0SUzmr24svS0ymsfjoLQvv0gpM5IIT8/j9xELhWXIvzDq9Eq NxoLtGrjXoWOkh2UU6ivt+4pSlksA3XINGNsi/nJBBe+x05EcF0F/Xhkrp8eaz0B3eYuQ7y/xIM ijNujYDLau798JvaH9MxCHeJykRB6NgKBBae8AzwIQamvrRPgKQM+KwzMVvEGCOohOrgibC49Mh 231FWX5ZK/ciy22x3L13xDzYEAfAtuZLNAPGLovVhPGnAkeTBnJLHrPLa26Ab1+t1O8oYSL5SoB +Cu4/Hegu3x+oE4M/EugmWJlSuSXJCIYcPDXv37kaN6dNfUfCI2r6WR6yyOgpb3yGtIMdNrCZiv kNFB7MweAhEoln+tKaWZtathfLXF2PMhC6ikSGMWp17TLFwxy3nO5PARn/xkUj2OgHgjGy24ZVb OBobeUnbLjcKLj6LZcBbcKRadYhL5H1xYV9W3aGmCX/LIwvQGNrKQ2dNpaVgX+bPie592yDYuJP n2mb05+YBpkWuLztzlqcQAWqhRVggciLTuzTJZXz9fe1mGRy3B5l8npgdzp5ZHx7IvTCqjYKS7t QMf28Mjz4M4dbnA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_163206_018541_10F348C4 X-CRM114-Status: GOOD ( 12.28 ) 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 Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/leds/leds-88pm860x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c index 033ab5fed38a..81238376484b 100644 --- a/drivers/leds/leds-88pm860x.c +++ b/drivers/leds/leds-88pm860x.c @@ -115,7 +115,7 @@ static int pm860x_led_set(struct led_classdev *cdev, static int pm860x_led_dt_init(struct platform_device *pdev, struct pm860x_led *data) { - struct device_node *nproot, *np; + struct device_node *nproot; int iset = 0; if (!dev_of_node(pdev->dev.parent)) @@ -125,12 +125,11 @@ static int pm860x_led_dt_init(struct platform_device *pdev, dev_err(&pdev->dev, "failed to find leds node\n"); return -ENODEV; } - for_each_available_child_of_node(nproot, np) { + for_each_available_child_of_node_scoped(nproot, np) { if (of_node_name_eq(np, data->name)) { of_property_read_u32(np, "marvell,88pm860x-iset", &iset); data->iset = PM8606_LED_CURRENT(iset); - of_node_put(np); break; } }