linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linuxppc-dev@lists.ozlabs.org,
	Segher Boessenkool <segher@kernel.crashing.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [v2,5/5] powerpc/pseries: re-use code from of_helpers module
Date: Fri, 14 Aug 2015 21:51:59 +1000 (AEST)	[thread overview]
Message-ID: <20150814115200.0F4E1140293@ozlabs.org> (raw)
In-Reply-To: <1439292189-78925-5-git-send-email-andriy.shevchenko@linux.intel.com>

On Tue, 2015-11-08 at 11:23:09 UTC, Andy Shevchenko wrote:
> The derive_parent() has similar semantics to what we have in newly introduced
> of_helpers module. The replacement reduces code base and propagates the actual
> error code to the caller.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/powerpc/platforms/pseries/dlpar.c | 31 +++++--------------------------
>  1 file changed, 5 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
> index 47d9cebe..b7f243c 100644
> --- a/arch/powerpc/platforms/pseries/dlpar.c
> +++ b/arch/powerpc/platforms/pseries/dlpar.c
> @@ -18,6 +18,8 @@
>  #include <linux/cpu.h>
>  #include <linux/slab.h>
>  #include <linux/of.h>
> +
> +#include "of_helpers.h"
>  #include "offline_states.h"
>  #include "pseries.h"
>  
> @@ -244,36 +246,13 @@ cc_error:
>  	return first_dn;
>  }
>  
> -static struct device_node *derive_parent(const char *path)
> -{
> -	struct device_node *parent;
> -	char *last_slash;
> -
> -	last_slash = strrchr(path, '/');
> -	if (last_slash == path) {
> -		parent = of_find_node_by_path("/");
> -	} else {
> -		char *parent_path;
> -		int parent_path_len = last_slash - path + 1;
> -		parent_path = kmalloc(parent_path_len, GFP_KERNEL);
> -		if (!parent_path)
> -			return NULL;
> -
> -		strlcpy(parent_path, path, parent_path_len);
> -		parent = of_find_node_by_path(parent_path);
> -		kfree(parent_path);
> -	}
> -
> -	return parent;
> -}
> -
>  int dlpar_attach_node(struct device_node *dn)
>  {
>  	int rc;
>  
> -	dn->parent = derive_parent(dn->full_name);
> -	if (!dn->parent)
> -		return -ENOMEM;
> +	dn->parent = pseries_of_derive_parent(dn->full_name);
> +	if (IS_ERR(dn->parent))
> +		return PTR_ERR(dn_parent);
                                 ^
				 ?

There are cross compilers on kernel.org, or on Ubuntu you can just:

$ apt-get install gcc-powerpc-linux-gnu
$ make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-gcc

cheers

  reply	other threads:[~2015-08-14 11:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 11:23 [PATCH v2 1/5] powerpc/pseries: extract of_helpers module Andy Shevchenko
2015-08-11 11:23 ` [PATCH v2 2/5] powerpc/pseries: fix a potential memory leak Andy Shevchenko
2015-08-11 11:23 ` [PATCH v2 3/5] powerpc/pseries: replace kmalloc + strlcpy Andy Shevchenko
2015-08-11 11:23 ` [PATCH v2 4/5] powerpc/pseries: handle nodes without '/' Andy Shevchenko
2015-08-11 11:23 ` [PATCH v2 5/5] powerpc/pseries: re-use code from of_helpers module Andy Shevchenko
2015-08-14 11:51   ` Michael Ellerman [this message]
2015-09-30 16:19     ` [v2,5/5] " Andy Shevchenko
2015-10-01  2:56       ` Michael Ellerman
2015-10-01  7:02         ` Denis Kirjanov
2015-10-01  8:39           ` Andy Shevchenko
2015-10-01  9:32             ` Denis Kirjanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150814115200.0F4E1140293@ozlabs.org \
    --to=mpe@ellerman.id.au \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).