Message ID | 1439292189-78925-5-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Michael Ellerman |
Headers | show |
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
On Fri, 2015-08-14 at 21:51 +1000, Michael Ellerman wrote: > 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 Thanks! I tried today and the above the only problem with the series. Would you like me to resend whole series? > > cheers
On Wed, 2015-09-30 at 19:19 +0300, Andy Shevchenko wrote: > On Fri, 2015-08-14 at 21:51 +1000, Michael Ellerman wrote: > > On Tue, 2015-11-08 at 11:23:09 UTC, Andy Shevchenko wrote: > > > 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 > > Thanks! I tried today and the above the only problem with the series. > Would you like me to resend whole series? I'd like someone to test it. I gather that you haven't because it didn't compile. I assume you don't have access to hardware to test it on? cheers
On 10/1/15, Michael Ellerman <mpe@ellerman.id.au> wrote: > On Wed, 2015-09-30 at 19:19 +0300, Andy Shevchenko wrote: >> On Fri, 2015-08-14 at 21:51 +1000, Michael Ellerman wrote: >> > On Tue, 2015-11-08 at 11:23:09 UTC, Andy Shevchenko wrote: >> > > 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 >> >> Thanks! I tried today and the above the only problem with the series. >> Would you like me to resend whole series? > > I'd like someone to test it. I gather that you haven't because it didn't > compile. Oh yeah, totally untested: CC arch/powerpc/platforms/pseries/dlpar.o arch/powerpc/platforms/pseries/dlpar.c: In function 'dlpar_attach_node': arch/powerpc/platforms/pseries/dlpar.c:255:18: error: 'dn_parent' undeclared (first use in this function) return PTR_ERR(dn_parent); ^ arch/powerpc/platforms/pseries/dlpar.c:255:18: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.build:258: recipe for target 'arch/powerpc/platforms/pseries/dlpar.o' failed make[2]: *** [arch/powerpc/platforms/pseries/dlpar.o] Error 1 scripts/Makefile.build:403: recipe for target 'arch/powerpc/platforms/pseries' failed make[1]: *** [arch/powerpc/platforms/pseries] Error 2 Makefile:941: recipe for target 'arch/powerpc/platforms' failed make: *** [arch/powerpc/platforms] Error 2 > > I assume you don't have access to hardware to test it on? > > cheers > > > > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev
On Thu, 2015-10-01 at 10:02 +0300, Denis Kirjanov wrote: > On 10/1/15, Michael Ellerman <mpe@ellerman.id.au> wrote: > > On Wed, 2015-09-30 at 19:19 +0300, Andy Shevchenko wrote: > > > On Fri, 2015-08-14 at 21:51 +1000, Michael Ellerman wrote: > > > > On Tue, 2015-11-08 at 11:23:09 UTC, Andy Shevchenko wrote: > > > > > 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 > > > > > > Thanks! I tried today and the above the only problem with the > > > series. > > > Would you like me to resend whole series? > > > > I'd like someone to test it. I gather that you haven't because it > > didn't > > compile. > > Oh yeah, totally untested: > > CC arch/powerpc/platforms/pseries/dlpar.o > arch/powerpc/platforms/pseries/dlpar.c: In function > 'dlpar_attach_node': > arch/powerpc/platforms/pseries/dlpar.c:255:18: error: 'dn_parent' > undeclared (first use in this function) > return PTR_ERR(dn_parent); > ^ > arch/powerpc/platforms/pseries/dlpar.c:255:18: note: each undeclared > identifier is reported only once for each function it appears in > scripts/Makefile.build:258: recipe for target > 'arch/powerpc/platforms/pseries/dlpar.o' failed > make[2]: *** [arch/powerpc/platforms/pseries/dlpar.o] Error 1 > scripts/Makefile.build:403: recipe for target > 'arch/powerpc/platforms/pseries' failed > make[1]: *** [arch/powerpc/platforms/pseries] Error 2 > Makefile:941: recipe for target 'arch/powerpc/platforms' failed > make: *** [arch/powerpc/platforms] Error 2 Like I mentioned earlier this is the only one issue to compile the series. Can you fix it and try on real HW? > > > > > I assume you don't have access to hardware to test it on? > > > > cheers > > > > > > > > _______________________________________________ > > Linuxppc-dev mailing list > > Linuxppc-dev@lists.ozlabs.org > > https://lists.ozlabs.org/listinfo/linuxppc-dev
On 10/1/15, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Thu, 2015-10-01 at 10:02 +0300, Denis Kirjanov wrote: >> On 10/1/15, Michael Ellerman <mpe@ellerman.id.au> wrote: >> > On Wed, 2015-09-30 at 19:19 +0300, Andy Shevchenko wrote: >> > > On Fri, 2015-08-14 at 21:51 +1000, Michael Ellerman wrote: >> > > > On Tue, 2015-11-08 at 11:23:09 UTC, Andy Shevchenko wrote: >> > > > > 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 >> > > >> > > Thanks! I tried today and the above the only problem with the >> > > series. >> > > Would you like me to resend whole series? >> > >> > I'd like someone to test it. I gather that you haven't because it >> > didn't >> > compile. >> >> Oh yeah, totally untested: >> >> CC arch/powerpc/platforms/pseries/dlpar.o >> arch/powerpc/platforms/pseries/dlpar.c: In function >> 'dlpar_attach_node': >> arch/powerpc/platforms/pseries/dlpar.c:255:18: error: 'dn_parent' >> undeclared (first use in this function) >> return PTR_ERR(dn_parent); >> ^ >> arch/powerpc/platforms/pseries/dlpar.c:255:18: note: each undeclared >> identifier is reported only once for each function it appears in >> scripts/Makefile.build:258: recipe for target >> 'arch/powerpc/platforms/pseries/dlpar.o' failed >> make[2]: *** [arch/powerpc/platforms/pseries/dlpar.o] Error 1 >> scripts/Makefile.build:403: recipe for target >> 'arch/powerpc/platforms/pseries' failed >> make[1]: *** [arch/powerpc/platforms/pseries] Error 2 >> Makefile:941: recipe for target 'arch/powerpc/platforms' failed >> make: *** [arch/powerpc/platforms] Error 2 > > Like I mentioned earlier this is the only one issue to compile the > series. Can you fix it and try on real HW? Please resend the updates series and then I'll test it. Thanks! > >> >> > >> > I assume you don't have access to hardware to test it on? >> > >> > cheers >> > >> > >> > >> > _______________________________________________ >> > Linuxppc-dev mailing list >> > Linuxppc-dev@lists.ozlabs.org >> > https://lists.ozlabs.org/listinfo/linuxppc-dev > > -- > Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Intel Finland Oy >
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); rc = of_attach_node(dn); if (rc) {
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(-)