Patchwork [-next] TTY: hvsi: use for_each_compatible_node() macro

login
register
mail settings
Submitter Wei Yongjun
Date Dec. 4, 2012, 5:16 a.m.
Message ID <CAPgLHd-bpkWo6PeKrB1VqCiYMxCvphvMbs34Raoh89Wm0ubK-A@mail.gmail.com>
Download mbox | patch
Permalink /patch/203557/
State Accepted, archived
Commit 7943b310001fd7858154bc3af2a78e0dd6bfea03
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Wei Yongjun - Dec. 4, 2012, 5:16 a.m.
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Use for_each_compatible_node() macro instead of open coding it.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/tty/hvc/hvsi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Grant Likely - Dec. 5, 2012, 11:36 p.m.
On Tue, 4 Dec 2012 00:16:18 -0500, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Use for_each_compatible_node() macro instead of open coding it.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  drivers/tty/hvc/hvsi.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
> index 5b95b4f..70e0ef7 100644
> --- a/drivers/tty/hvc/hvsi.c
> +++ b/drivers/tty/hvc/hvsi.c
> @@ -1187,9 +1187,7 @@ static int __init hvsi_console_init(void)
>  	hvsi_wait = poll_for_state; /* no irqs yet; must poll */
>  
>  	/* search device tree for vty nodes */
> -	for (vty = of_find_compatible_node(NULL, "serial", "hvterm-protocol");
> -			vty != NULL;
> -			vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) {
> +	for_each_compatible_node(vty, "serial", "hvterm-protocol") {
>  		struct hvsi_struct *hp;
>  		const uint32_t *vtermno, *irq;
>  
> 
>

Patch

diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
index 5b95b4f..70e0ef7 100644
--- a/drivers/tty/hvc/hvsi.c
+++ b/drivers/tty/hvc/hvsi.c
@@ -1187,9 +1187,7 @@  static int __init hvsi_console_init(void)
 	hvsi_wait = poll_for_state; /* no irqs yet; must poll */
 
 	/* search device tree for vty nodes */
-	for (vty = of_find_compatible_node(NULL, "serial", "hvterm-protocol");
-			vty != NULL;
-			vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) {
+	for_each_compatible_node(vty, "serial", "hvterm-protocol") {
 		struct hvsi_struct *hp;
 		const uint32_t *vtermno, *irq;