Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH -next RESEND 0/2] mfd: Use for_each_child_of_node_scoped()
@ 2024-08-26  9:27 Jinjie Ruan
  2024-08-26  9:27 ` [PATCH -next RESEND 1/2] mfd: max77620: " Jinjie Ruan
  2024-08-26  9:27 ` [PATCH -next RESEND 2/2] mfd: qcom-spmi-pmic: " Jinjie Ruan
  0 siblings, 2 replies; 5+ messages in thread
From: Jinjie Ruan @ 2024-08-26  9:27 UTC (permalink / raw)
  To: lee, linux-kernel, linux-arm-msm, krzk, jic23; +Cc: ruanjinjie

Use scoped for_each_available_child_of_node_scoped() when iterating over
device nodes to make code a bit simpler.

Jinjie Ruan (2):
  mfd: max77620: Use for_each_child_of_node_scoped()
  mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()

 drivers/mfd/max77620.c       | 5 ++---
 drivers/mfd/qcom-spmi-pmic.c | 5 +----
 2 files changed, 3 insertions(+), 7 deletions(-)

-- 
2.34.1


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

* [PATCH -next RESEND 1/2] mfd: max77620: Use for_each_child_of_node_scoped()
  2024-08-26  9:27 [PATCH -next RESEND 0/2] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
@ 2024-08-26  9:27 ` Jinjie Ruan
  2024-08-30  7:43   ` (subset) " Lee Jones
  2024-08-26  9:27 ` [PATCH -next RESEND 2/2] mfd: qcom-spmi-pmic: " Jinjie Ruan
  1 sibling, 1 reply; 5+ messages in thread
From: Jinjie Ruan @ 2024-08-26  9:27 UTC (permalink / raw)
  To: lee, linux-kernel, linux-arm-msm, krzk, jic23; +Cc: ruanjinjie

Avoids the need for manual cleanup of_node_put() in early exits
from the loop.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/mfd/max77620.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
index 74ef3f6d576c..89b30ef91f4f 100644
--- a/drivers/mfd/max77620.c
+++ b/drivers/mfd/max77620.c
@@ -400,7 +400,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
 static int max77620_initialise_fps(struct max77620_chip *chip)
 {
 	struct device *dev = chip->dev;
-	struct device_node *fps_np, *fps_child;
+	struct device_node *fps_np;
 	u8 config;
 	int fps_id;
 	int ret;
@@ -414,10 +414,9 @@ static int max77620_initialise_fps(struct max77620_chip *chip)
 	if (!fps_np)
 		goto skip_fps;
 
-	for_each_child_of_node(fps_np, fps_child) {
+	for_each_child_of_node_scoped(fps_np, fps_child) {
 		ret = max77620_config_fps(chip, fps_child);
 		if (ret < 0) {
-			of_node_put(fps_child);
 			of_node_put(fps_np);
 			return ret;
 		}
-- 
2.34.1


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

* [PATCH -next RESEND 2/2] mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()
  2024-08-26  9:27 [PATCH -next RESEND 0/2] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
  2024-08-26  9:27 ` [PATCH -next RESEND 1/2] mfd: max77620: " Jinjie Ruan
@ 2024-08-26  9:27 ` Jinjie Ruan
  2024-08-30  7:56   ` (subset) " Lee Jones
  1 sibling, 1 reply; 5+ messages in thread
From: Jinjie Ruan @ 2024-08-26  9:27 UTC (permalink / raw)
  To: lee, linux-kernel, linux-arm-msm, krzk, jic23; +Cc: ruanjinjie

Avoids the need for manual cleanup of_node_put() in early exits
from the loop.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/mfd/qcom-spmi-pmic.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index eab5bf6cff10..b4b178caf754 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -84,7 +84,6 @@ static const struct of_device_id pmic_spmi_id_table[] = {
 static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, struct qcom_spmi_dev *ctx)
 {
 	struct device_node *spmi_bus;
-	struct device_node *child;
 	int function_parent_usid, ret;
 	u32 pmic_addr;
 
@@ -108,10 +107,9 @@ static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, str
 	 */
 	spmi_bus = of_get_parent(sdev->dev.of_node);
 	sdev = ERR_PTR(-ENODATA);
-	for_each_child_of_node(spmi_bus, child) {
+	for_each_child_of_node_scoped(spmi_bus, child) {
 		ret = of_property_read_u32_index(child, "reg", 0, &pmic_addr);
 		if (ret) {
-			of_node_put(child);
 			sdev = ERR_PTR(ret);
 			break;
 		}
@@ -125,7 +123,6 @@ static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, str
 				 */
 				sdev = ERR_PTR(-EPROBE_DEFER);
 			}
-			of_node_put(child);
 			break;
 		}
 	}
-- 
2.34.1


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

* Re: (subset) [PATCH -next RESEND 1/2] mfd: max77620: Use for_each_child_of_node_scoped()
  2024-08-26  9:27 ` [PATCH -next RESEND 1/2] mfd: max77620: " Jinjie Ruan
@ 2024-08-30  7:43   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2024-08-30  7:43 UTC (permalink / raw)
  To: lee, linux-kernel, linux-arm-msm, krzk, jic23, Jinjie Ruan

On Mon, 26 Aug 2024 17:27:33 +0800, Jinjie Ruan wrote:
> Avoids the need for manual cleanup of_node_put() in early exits
> from the loop.
> 
> 

Applied, thanks!

[1/2] mfd: max77620: Use for_each_child_of_node_scoped()
      commit: 2b96330e5ac0426087e34e55494e2c2a6a96a8b2

--
Lee Jones [李琼斯]


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

* Re: (subset) [PATCH -next RESEND 2/2] mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()
  2024-08-26  9:27 ` [PATCH -next RESEND 2/2] mfd: qcom-spmi-pmic: " Jinjie Ruan
@ 2024-08-30  7:56   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2024-08-30  7:56 UTC (permalink / raw)
  To: lee, linux-kernel, linux-arm-msm, krzk, jic23, Jinjie Ruan

On Mon, 26 Aug 2024 17:27:34 +0800, Jinjie Ruan wrote:
> Avoids the need for manual cleanup of_node_put() in early exits
> from the loop.
> 
> 

Applied, thanks!

[2/2] mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()
      commit: 12d219610d11d2c0917961680ca5fee369b500db

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2024-08-30  7:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  9:27 [PATCH -next RESEND 0/2] mfd: Use for_each_child_of_node_scoped() Jinjie Ruan
2024-08-26  9:27 ` [PATCH -next RESEND 1/2] mfd: max77620: " Jinjie Ruan
2024-08-30  7:43   ` (subset) " Lee Jones
2024-08-26  9:27 ` [PATCH -next RESEND 2/2] mfd: qcom-spmi-pmic: " Jinjie Ruan
2024-08-30  7:56   ` (subset) " Lee Jones

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