From patchwork Fri Aug 16 15:31:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13766562 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 627D2C3DA4A for ; Fri, 16 Aug 2024 15:42:30 +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=d4o6NVK+5RxP9AE82dc0tQeAqHho4Q+RR5k5EOL8qCE=; b=R5NmmiY+YjRtuPju0cejPMmeE1 WIygSFegxOohOFodkg8ATfG1pKpNwhOMmzcwkM/vihjNJuDrchwaL4P6wX/gJRMJzjQf9AN8yk8KP IiwQAmw0u/AlEvy3lfqP3hy8Rt9+Cv7fz1oKkhoVDszyKaiGr7CTp86jowS+5n17AIKCqj8UtIhZE 4Go9FlTbQAbz89Ve3Dv48P2qgCe5bYLG428zb9Fz8oss+XzLCJAu6DH6VvP6jTFzAF0xoc3sPVgGG bCGvhrGbXKcUgjPdytjhTejZ8i9UTsfukmoqyoepKpvlwXGVpE1XG1vgMHjbsHmNqXWfcs3suLiXo /XiaPLqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sez5m-0000000DREW-0ERF; Fri, 16 Aug 2024 15:42:18 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyw8-0000000DOkC-0H0d for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:32:21 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52efd530a4eso3409264e87.0 for ; Fri, 16 Aug 2024 08:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723822338; x=1724427138; 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=d4o6NVK+5RxP9AE82dc0tQeAqHho4Q+RR5k5EOL8qCE=; b=zdNSQZPq+sg7oSjKetLbyXH+I98NHd0t2llUatFbrQvlwq9B/XN/IOdzrudTIHLXTs P+3ghVK357MIdImRhnFk/FHSJqxbw7s/Tk8HDZQzYm85vYB1SvRWcshpUldMO4SONS2e ALk/bLoERBb7Et0dBBVCrUbtVCkGc9TymEU30pyKLjb3MylyANoXQVgERFomSrO1gCfK v1oiB0hgbuqBIV9CAB8SgMfgrcqfRP2kSK7bIgPHcKcsEUzu1bYXG0j+4Lru/WMlGsgt s3Rk698cpvZGHOikMHFk74shbhYGwbEchXSuZVW4+0YW17tznQmincoeQ+N0sh6D26gU xPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723822338; x=1724427138; 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=d4o6NVK+5RxP9AE82dc0tQeAqHho4Q+RR5k5EOL8qCE=; b=fNNGcu+bYGGFtIJGxqN/G95IU2kyVPo0HtuhruJNn+3hh8VdDvLA0dbGPwOhA3WT2K GceMipF3GWl5Lermu2rEQqw9hjznd9HrIevJJwZPLPdqjqk2i6sVOFPbE0iqqSXZ5Yej OTfRlhCCdU4c9i3+MxajOH48cafam1x5IGts0EZUJCcCCbrxFHrpf7l1w3EJ4FUbsmjd kbNzAz6hy2LeTwNoGZzoj2Y+5uGnhBrEE7XIW2LJD7tiQC8g5Co7d4gQQw3CbhiIOaJa 2yRgnRkPHnf1HLUg6mHRWuZF/WfBQLQBOExTtBRvc5GGn3V8/ErHxrdmZwuSiWQDyvvT e33w== X-Forwarded-Encrypted: i=1; AJvYcCXBLM89DPO5DTUg/0z1uCgMoDhmslhPVXjjFhqPfF5irpIeIOltucV9yV4OaVkac//nReamnF62deGl2FlSaj12uwVnBP06xooewH+TWIoB9xlEQZc= X-Gm-Message-State: AOJu0YxuY6Oa42ueHJN1no6l7+qBZzn3FutyGTpoI6QdzRrSRuMmeDFu 26LguTYWEgGieBCGaJ2sLObeq0hs2fzr4D3DNm0YcbHlYFfAsVGknBpZ2Iu1L+CwrEDlRIbphRV m X-Google-Smtp-Source: AGHT+IET/CjplVHoqhJT1dgGbpnM7bOR/IOJJFLcUpaq7hdaaWtUXfMeQ9ArJ1WuxrwkKCsQRRpLyg== X-Received: by 2002:a05:6512:3d1e:b0:533:d7d:a34e with SMTP id 2adb3069b0e04-5331c695987mr2342012e87.7.1723822337538; Fri, 16 Aug 2024 08:32:17 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:32:17 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 17:31:48 +0200 Subject: [PATCH 16/17] leds: turris-omnia: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-var-v1-16-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=1244; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=HqurU8v6FoUuPIeHjxpMhqt9yfUTtSWFQuHadg1beqc=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmv3Dn/4FodrZqZy9l8ymKC3RzvyZz5qUjuY2CL I8dXCHswfSJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr9w5wAKCRDBN2bmhouD 1/k9D/9UMNk7RM3WQGHAruhcdLJVhguE7sJuyHNKcv0JiIT7rLqrxgI0kl0TXtijoBLQifUtmXZ n35/z2TOA0jMGVqDPqGfeNVLVubMwH2nrI2Ni5HcdxRIcVmOI5Qx8hGIAXD8y0+OJYkM+e9+MMW 09hTenPhrVmvb8M7YhycHH1JSDV9cQj5pWdYrcf9X259N9O2dQzVfpdI4UA9GtQqSNLEkbuW9Hp y74zqYk3zBvM3xAlvg43roVpp4MqjH45PtJ11CNOOpMNAVh4KO+73Sx7Y/Zxhc/iHv18ky49WfS lGjmWX7aYivBbwfKDQrc1uuJsio9CXHKui9IFVREXod3XAW8dFzQmBJhlmrhp2ppVcf3wqOCd/g v2zH8BG+SM+ulHja62+nlUfuD6B6vDBpNLRKLkHC0jKuhUb2yXe4OFT17v8Vwkzs6/t0vCbKIoW idbzDQf82L1WtL+yWv/brsico0O/8/FBiODTt15BMAZ4wYOG5YrOem6kGbv8kSxea9vP+S7vpdO 9JpanPlCJQ8Z4xlCm3uumDcswywrJ9FhFvqonNLpVQfBwk6gcMt7q1GkAsIB0P6LjEgEHgdm3qD ZGlGjHkSWXHGIFYWFg5IYbAYfEzX3nOZJAkkSKxMA+DQOjYqzxql8WnOoHOeUfh0p5rdk1Os5pI C3oB8c3EPtY7V/g== 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_083220_135172_18D16987 X-CRM114-Status: GOOD ( 13.63 ) 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 Reviewed-by: Marek BehĂșn --- drivers/leds/leds-turris-omnia.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c index 39f740be058f..1ef942b5cefa 100644 --- a/drivers/leds/leds-turris-omnia.c +++ b/drivers/leds/leds-turris-omnia.c @@ -452,7 +452,7 @@ static int omnia_mcu_get_features(const struct i2c_client *client) static int omnia_leds_probe(struct i2c_client *client) { struct device *dev = &client->dev; - struct device_node *np = dev_of_node(dev), *child; + struct device_node *np = dev_of_node(dev); struct omnia_leds *leds; struct omnia_led *led; int ret, count; @@ -497,12 +497,10 @@ static int omnia_leds_probe(struct i2c_client *client) } led = &leds->leds[0]; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { ret = omnia_led_register(client, led, child); - if (ret < 0) { - of_node_put(child); + if (ret < 0) return ret; - } led += ret; }