Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244222

Re: [PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify code

From Julia Lawall <julia.lawall@lip6.fr>
Newsgroups linux.kernel
Subject Re: [PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify code
Date 2015-10-11 22:50 +0200
Message-ID <qivJ8-2Fs-19@gated-at.bofh.it> (permalink)
References <qivzr-2sI-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, 11 Oct 2015, Christophe JAILLET wrote:

> of_get_next_parent can be used to simplify the while() loop and
> avoid the need of a temp variable.

Can you do something with the loop in __of_translate_address, in 
drivers/of/address.c?  Is there not an iterator for this?

julia


> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  arch/powerpc/sysdev/mpc5xxx_clocks.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/mpc5xxx_clocks.c b/arch/powerpc/sysdev/mpc5xxx_clocks.c
> index f4f0301..5732926 100644
> --- a/arch/powerpc/sysdev/mpc5xxx_clocks.c
> +++ b/arch/powerpc/sysdev/mpc5xxx_clocks.c
> @@ -13,7 +13,6 @@
>  
>  unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
>  {
> -	struct device_node *np;
>  	const unsigned int *p_bus_freq = NULL;
>  
>  	of_node_get(node);
> @@ -22,9 +21,7 @@ unsigned long mpc5xxx_get_bus_frequency(struct device_node *node)
>  		if (p_bus_freq)
>  			break;
>  
> -		np = of_get_parent(node);
> -		of_node_put(node);
> -		node = np;
> +		node = of_get_next_parent(node);
>  	}
>  	of_node_put(node);
>  
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify code Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2015-10-11 22:40 +0200
  Re: [PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify  code Julia Lawall <julia.lawall@lip6.fr> - 2015-10-11 22:50 +0200
    Re: [PATCH] powerpc/mpc5xxx: Use of_get_next_parent to simplify code Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2015-10-12 07:10 +0200
  Re: powerpc/mpc5xxx: Use of_get_next_parent to simplify code Michael Ellerman <mpe@ellerman.id.au> - 2015-10-14 06:10 +0200
    [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially freed memory Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2015-10-15 08:00 +0200
      Re: [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially  freed memory Michael Ellerman <mpe@ellerman.id.au> - 2015-10-15 08:40 +0200
        Re: [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially freed  memory Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2015-10-16 08:30 +0200
          Re: [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially  freed memory Gabriel Paubert <paubert@iram.es> - 2015-10-16 09:50 +0200
          Re: [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially  freed memory Michael Ellerman <mpe@ellerman.id.au> - 2015-10-16 11:50 +0200
            Re: [PATCH v2] powerpc/mpc5xxx: Avoid dereferencing potentially freed  memory Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2015-10-16 22:10 +0200
  Re: powerpc/mpc5xxx: Use of_get_next_parent to simplify code Michael Ellerman <mpe@ellerman.id.au> - 2015-10-15 13:20 +0200

csiph-web