From patchwork Fri Aug 16 15:31:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13766530 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 C5268C3DA4A for ; Fri, 16 Aug 2024 15:36: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: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=SlPHB4gr+L6a3Oj22+1JrD6FFL140QqYHUkR8oZywNI=; b=V9BakhVIHg04UZq2bueOzh7w87 zcYPBkj2jN2k7whl9ng2EA8wZgU1Q/kX9+f0LHdK1mrLp7JCfpQAX+9ZgghITyVxgePHeLpH6UOtG q7xyNOWwlKWFsk5kTRWZaIwmcx9AAjByRLQbcRGikv3CLw+qf+CgOWCMjoXGCX5CMBEbAbZsutT7W U/mh10iwfNRJpdFEWLO3YeZuYNh4jlfp+5vSvv4TpiY4Nr9LRa06Iv2jNhSM+4e0eCR9JVaRG3N7p IHou86nVohZ16YxceEy4mCbkyBq8FHnDUIkhn1WGKhrZAZ08ORCHy/dZ0U9o7X1wrxQ+OTc7XkDKY U1ME6M1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyze-0000000DPsS-22Vz; Fri, 16 Aug 2024 15:35:58 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyvs-0000000DOaG-2rON for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:32:06 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4280ca0791bso15645215e9.1 for ; Fri, 16 Aug 2024 08:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723822323; x=1724427123; 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=SlPHB4gr+L6a3Oj22+1JrD6FFL140QqYHUkR8oZywNI=; b=rn8RkvDPMJ1BPEq3mb6RREZ0L34p5bOt9dr8AYia0uOR9o9uKA8wjv2T/web08cv0Z TldHDGedN/U0BDSXJqE2rHCj7ppEfNpAGZ+wRNEKFFgYCrqtx4DydmeRji5e6DjHFn9Q eQ5uRGBMnXNpwAyfLBDtjw1ku1jrs8YyI8vo5l9cLey1qac8oIH8viZowG63lMIq1OIF 1rKUYVOs6wQ83yCC/ghLkrSWbiZVxgy/ptm+d4I/AlsjfGXjpqQudUyex5L2+4fOrYI9 9opKWcUttUQnoeMmgKsjc7cfflSyWjYPVcF7EBG1TQ7JEuW8jLt94qLRbN7A3H1u3ZlC 1IHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723822323; x=1724427123; 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=SlPHB4gr+L6a3Oj22+1JrD6FFL140QqYHUkR8oZywNI=; b=tAT96pDtusC2s176YgNKm3Kw1g38GamNdGj8sLT150uAB2yxt7LlpZCfNaw+gJSqEP pWjsgLGe0f9mSj6mSfIGjSu11WzBBTyR5NPd//LQrOKr3+1rw0HWVeOUxJaOAAXlOp6J y5rwdJYdWeqXP5PtkPtQ6yGl9jraqPuIAKdwiL/Kfmd2Zut4Uoxj4lBjtuGx5RChqUQu Jr3fv4SoZZZIx02bVCKIDwbGv/anvevu5O4Y2qw6oteoaiISeKblmw85ydwh9uuxzJrQ /mGFkIQE2n66N+kIxiJ8HizQigXkis8b5dnLxSDW5wXqcF3PB29EVkCyEokq0Pj1wHTA w4YQ== X-Forwarded-Encrypted: i=1; AJvYcCUrUe/3E21ynRK6JOkiBtCu6qYbg7Qx4CUzYkuFFtCGuoDGaY3ICggt7ogH+tSgOcIZwlckZ54NVoEbwNjhyMic2RW51GYnM2FIZcKfL5NFw6mI2xo= X-Gm-Message-State: AOJu0Yy0dC3xBdUh4aA/VzLbHhcCr7ENbUW2y8L9AN4wwyIfJClR/Ejq EZjmpBQdFuU1y50J87rvEdsJka/cCsEYHoiNxwMPudWEyVaisZqnOS/G7lmz4SCAyvIkhHcsMjS c X-Google-Smtp-Source: AGHT+IFBqViSqYS/Qn+XxO+w4C7+CaQs7V1F2BGvW2XzllPgvjc7cAPVBUQf03iTq4tSEpEg3x4Iag== X-Received: by 2002:a05:600c:3589:b0:426:6388:d59f with SMTP id 5b1f17b1804b1-429ed7a6224mr21796435e9.1.1723822323342; Fri, 16 Aug 2024 08:32:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:32:02 -0700 (PDT) From: Krzysztof Kozlowski Date: Fri, 16 Aug 2024 17:31:38 +0200 Subject: [PATCH 06/17] leds: aw2013: Simplify with scoped for each OF child loop MIME-Version: 1.0 Message-Id: <20240816-cleanup-h-of-node-put-var-v1-6-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=1390; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=jPAa7n3fQCOZoqW7oKViIUd50z7rPIx9W0P9wLhVk9w=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmv3DerHRigkFM7NozDs05CzB4VVyXWnkCs7tkx sIk5q1y1CuJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZr9w3gAKCRDBN2bmhouD 18ZrD/97YWODT5Z5+DTebBI3wZE+0JSm6MgT/9fQqSV/jAaNDxPDxtcrU9f1tlmGpI9FQ3ztA1w 5kIZXiEWrzUgc01OD/J1u+jXMzVC1rntgQmcCz3eR3mo7vdPoClcn8T4O64bLR388bwI+a/olF8 ujcI81Zj77ajVSpsdceGMgG+REsRgUhZioX3In0qTtBtjFsadb/4L8RWNBVOt0AO5upLV8A/3gn JF6ZkJUcMAY0Qi0Da3wK33LBIxv2tlml2WyLQR7yfSeNJ+dBKo3cAPBXVC/GV/put6MdXTZbbOG ntf71ez6jrXpLB9FsKzXgKCZzAXfFyaj7c6KDKJZ0qdComtXvSZ9+mSp1BaMRlT4eBSVFgM3cZR aKo+cuCf9Ncg2VJFtXFtMzUFZexM9DjBvAC1DEpVp+NIeqZRM3mp7qsMfRUG9nTl2RVE3i62Yer peM1zsF7ZPtFOxd4B+nLZz4t6+pY9/fwPN8b5qz6rLrUQw6zir30lR/BIxNcgMmuFUK2hhjIedu zkFHEl6XDKHT1SYYpTDgvlWsGjQll18W4iojiDomjGXNaDHA6idfH18a2C2nDQ0S6Grm5I/A4RB 9B5KZAgZi4zpiIw7aIsDRpYPQKDdovhX36Zqllgl60VZ5jN4ls0x1PBS4nHla9fOA5RQvPNMBvL PMAHdiIqEHJcgMA== 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_083204_806144_88FD5528 X-CRM114-Status: GOOD ( 13.24 ) 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-aw2013.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-aw2013.c b/drivers/leds/leds-aw2013.c index 6475eadcb0df..216755d6010f 100644 --- a/drivers/leds/leds-aw2013.c +++ b/drivers/leds/leds-aw2013.c @@ -263,7 +263,7 @@ static int aw2013_blink_set(struct led_classdev *cdev, static int aw2013_probe_dt(struct aw2013 *chip) { - struct device_node *np = dev_of_node(&chip->client->dev), *child; + struct device_node *np = dev_of_node(&chip->client->dev); int count, ret = 0, i = 0; struct aw2013_led *led; @@ -273,7 +273,7 @@ static int aw2013_probe_dt(struct aw2013 *chip) regmap_write(chip->regmap, AW2013_RSTR, AW2013_RSTR_RESET); - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { struct led_init_data init_data = {}; u32 source; u32 imax; @@ -304,10 +304,8 @@ static int aw2013_probe_dt(struct aw2013 *chip) ret = devm_led_classdev_register_ext(&chip->client->dev, &led->cdev, &init_data); - if (ret < 0) { - of_node_put(child); + if (ret < 0) return ret; - } i++; }