2018-08-29 20:06:32

by Rob Herring (Arm)

[permalink] [raw]
Subject: [PATCH] soc: fsl/qe: Use of_get_child_by_name helper

Use the of_get_child_by_name() helper instead of open coding searching
for the 'firmware' child node. This removes directly accessing the name
pointer as well.

Cc: Qiang Zhao <[email protected]>
Cc: Li Yang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Rob Herring <[email protected]>
---
drivers/soc/fsl/qe/qe.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c
index 2ef6fc6487c1..612d9c551be5 100644
--- a/drivers/soc/fsl/qe/qe.c
+++ b/drivers/soc/fsl/qe/qe.c
@@ -588,11 +588,7 @@ struct qe_firmware_info *qe_get_firmware_info(void)
}

/* Find the 'firmware' child node */
- for_each_child_of_node(qe, fw) {
- if (strcmp(fw->name, "firmware") == 0)
- break;
- }
-
+ fw = of_get_child_by_name(qe, "firmware");
of_node_put(qe);

/* Did we find the 'firmware' node? */
--
2.17.1



2018-08-30 02:49:23

by Zhao Qiang

[permalink] [raw]
Subject: RE: [PATCH] soc: fsl/qe: Use of_get_child_by_name helper

From: Rob Herring <[email protected]>
date: 2018/8/30 4:04

> To: Qiang Zhao <[email protected]>
> Cc: [email protected]; Leo Li <[email protected]>;
> [email protected]; [email protected]
> Subject: [PATCH] soc: fsl/qe: Use of_get_child_by_name helper
>
> Use the of_get_child_by_name() helper instead of open coding searching for the
> 'firmware' child node. This removes directly accessing the name pointer as well.
>
> Cc: Qiang Zhao <[email protected]>
> Cc: Li Yang <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Rob Herring <[email protected]>
> ---
> drivers/soc/fsl/qe/qe.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index
> 2ef6fc6487c1..612d9c551be5 100644
> --- a/drivers/soc/fsl/qe/qe.c
> +++ b/drivers/soc/fsl/qe/qe.c
> @@ -588,11 +588,7 @@ struct qe_firmware_info *qe_get_firmware_info(void)
> }
>
> /* Find the 'firmware' child node */
> - for_each_child_of_node(qe, fw) {
> - if (strcmp(fw->name, "firmware") == 0)
> - break;
> - }
> -
> + fw = of_get_child_by_name(qe, "firmware");
> of_node_put(qe);
>
> /* Did we find the 'firmware' node? */
> --

Acked-by: Qiang Zhao <[email protected]>

2018-08-30 17:06:31

by Leo Li

[permalink] [raw]
Subject: Re: [PATCH] soc: fsl/qe: Use of_get_child_by_name helper

On Wed, Aug 29, 2018 at 9:49 PM Qiang Zhao <[email protected]> wrote:
>
> From: Rob Herring <[email protected]>
> date: 2018/8/30 4:04
>
> > To: Qiang Zhao <[email protected]>
> > Cc: [email protected]; Leo Li <[email protected]>;
> > [email protected]; [email protected]
> > Subject: [PATCH] soc: fsl/qe: Use of_get_child_by_name helper
> >
> > Use the of_get_child_by_name() helper instead of open coding searching for the
> > 'firmware' child node. This removes directly accessing the name pointer as well.
> >
> > Cc: Qiang Zhao <[email protected]>
> > Cc: Li Yang <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Rob Herring <[email protected]>

Merged for next. Thanks.

Regards,
Leo