mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] hwmon: (emc2305) Simplify with scoped for each OF child loop
@ 2025-12-24 11:07 Krzysztof Kozlowski
  2025-12-24 11:07 ` [PATCH 2/3] hwmon: (max6639) " Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 11:07 UTC (permalink / raw)
  To: Guenter Roeck, Ban Feng, linux-hwmon, linux-kernel; +Cc: Krzysztof Kozlowski

Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/hwmon/emc2305.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
index ceae96c07ac4..8f80a39574f3 100644
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -605,7 +605,6 @@ static int emc2305_probe(struct i2c_client *client)
 {
 	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
-	struct device_node *child;
 	struct emc2305_data *data;
 	struct emc2305_platform_data *pdata;
 	int vendor;
@@ -681,12 +680,10 @@ static int emc2305_probe(struct i2c_client *client)
 		/* Parse and check for the available PWM child nodes */
 		if (pwm_childs > 0) {
 			i = 0;
-			for_each_child_of_node(dev->of_node, child) {
+			for_each_child_of_node_scoped(dev->of_node, child) {
 				ret = emc2305_set_single_tz(dev, child, i);
-				if (ret != 0) {
-					of_node_put(child);
+				if (ret != 0)
 					return ret;
-				}
 				i++;
 			}
 		} else {
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] hwmon: (max6639) Simplify with scoped for each OF child loop
  2025-12-24 11:07 [PATCH 1/3] hwmon: (emc2305) Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2025-12-24 11:07 ` Krzysztof Kozlowski
  2026-01-12 21:28   ` Guenter Roeck
  2025-12-24 11:07 ` [PATCH 3/3] hwmon: (nct7363) " Krzysztof Kozlowski
  2026-01-12 21:28 ` [PATCH 1/3] hwmon: (emc2305) " Guenter Roeck
  2 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 11:07 UTC (permalink / raw)
  To: Guenter Roeck, Ban Feng, linux-hwmon, linux-kernel; +Cc: Krzysztof Kozlowski

Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/hwmon/max6639.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c
index 99140a2ca995..a0a1dbbda887 100644
--- a/drivers/hwmon/max6639.c
+++ b/drivers/hwmon/max6639.c
@@ -563,7 +563,6 @@ static int max6639_init_client(struct i2c_client *client,
 {
 	struct device *dev = &client->dev;
 	const struct device_node *np = dev->of_node;
-	struct device_node *child;
 	int i, err;
 	u8 target_duty;
 
@@ -582,15 +581,13 @@ static int max6639_init_client(struct i2c_client *client,
 	data->target_rpm[0] = 4000;
 	data->target_rpm[1] = 4000;
 
-	for_each_child_of_node(np, child) {
+	for_each_child_of_node_scoped(np, child) {
 		if (strcmp(child->name, "fan"))
 			continue;
 
 		err = max6639_probe_child_from_dt(client, child, data);
-		if (err) {
-			of_node_put(child);
+		if (err)
 			return err;
-		}
 	}
 
 	for (i = 0; i < MAX6639_NUM_CHANNELS; i++) {
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] hwmon: (nct7363) Simplify with scoped for each OF child loop
  2025-12-24 11:07 [PATCH 1/3] hwmon: (emc2305) Simplify with scoped for each OF child loop Krzysztof Kozlowski
  2025-12-24 11:07 ` [PATCH 2/3] hwmon: (max6639) " Krzysztof Kozlowski
@ 2025-12-24 11:07 ` Krzysztof Kozlowski
  2026-01-12 21:29   ` Guenter Roeck
  2026-01-12 21:28 ` [PATCH 1/3] hwmon: (emc2305) " Guenter Roeck
  2 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-24 11:07 UTC (permalink / raw)
  To: Guenter Roeck, Ban Feng, linux-hwmon, linux-kernel; +Cc: Krzysztof Kozlowski

Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/hwmon/nct7363.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/nct7363.c b/drivers/hwmon/nct7363.c
index 71cef794835d..4946d59ff807 100644
--- a/drivers/hwmon/nct7363.c
+++ b/drivers/hwmon/nct7363.c
@@ -396,7 +396,6 @@ static const struct regmap_config nct7363_regmap_config = {
 static int nct7363_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
-	struct device_node *child;
 	struct nct7363_data *data;
 	struct device *hwmon_dev;
 	int ret;
@@ -409,12 +408,10 @@ static int nct7363_probe(struct i2c_client *client)
 	if (IS_ERR(data->regmap))
 		return PTR_ERR(data->regmap);
 
-	for_each_child_of_node(dev->of_node, child) {
+	for_each_child_of_node_scoped(dev->of_node, child) {
 		ret = nct7363_present_pwm_fanin(dev, child, data);
-		if (ret) {
-			of_node_put(child);
+		if (ret)
 			return ret;
-		}
 	}
 
 	/* Initialize the chip */
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] hwmon: (emc2305) Simplify with scoped for each OF child loop
  2025-12-24 11:07 [PATCH 1/3] hwmon: (emc2305) Simplify with scoped for each OF child loop Krzysztof Kozlowski
  2025-12-24 11:07 ` [PATCH 2/3] hwmon: (max6639) " Krzysztof Kozlowski
  2025-12-24 11:07 ` [PATCH 3/3] hwmon: (nct7363) " Krzysztof Kozlowski
@ 2026-01-12 21:28 ` Guenter Roeck
  2 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-01-12 21:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Ban Feng, linux-hwmon, linux-kernel

On Wed, Dec 24, 2025 at 12:07:03PM +0100, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] hwmon: (max6639) Simplify with scoped for each OF child loop
  2025-12-24 11:07 ` [PATCH 2/3] hwmon: (max6639) " Krzysztof Kozlowski
@ 2026-01-12 21:28   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-01-12 21:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Ban Feng, linux-hwmon, linux-kernel

On Wed, Dec 24, 2025 at 12:07:04PM +0100, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] hwmon: (nct7363) Simplify with scoped for each OF child loop
  2025-12-24 11:07 ` [PATCH 3/3] hwmon: (nct7363) " Krzysztof Kozlowski
@ 2026-01-12 21:29   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-01-12 21:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Ban Feng, linux-hwmon, linux-kernel

On Wed, Dec 24, 2025 at 12:07:05PM +0100, Krzysztof Kozlowski wrote:
> Use scoped for-each loop when iterating over device nodes to make code a
> bit simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-12 21:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-24 11:07 [PATCH 1/3] hwmon: (emc2305) Simplify with scoped for each OF child loop Krzysztof Kozlowski
2025-12-24 11:07 ` [PATCH 2/3] hwmon: (max6639) " Krzysztof Kozlowski
2026-01-12 21:28   ` Guenter Roeck
2025-12-24 11:07 ` [PATCH 3/3] hwmon: (nct7363) " Krzysztof Kozlowski
2026-01-12 21:29   ` Guenter Roeck
2026-01-12 21:28 ` [PATCH 1/3] hwmon: (emc2305) " Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®