On Sat, Sep 13, 2014 at 12:41 AM, Thomas Falcon <tlfal...@linux.vnet.ibm.com> wrote: > When removing a cpu, this patch makes sure that values > gotten from or passed to firmware are in the correct > endian format. > > Signed-off-by: Thomas Falcon <tlfal...@linux.vnet.ibm.com> > --- > Changes in v2: > > Followed suggestions from Michael Ellerman: > Conversion of intserv to cpu endian occurs once. > Conversion of drc_index to cpu endian occurs once > using of_property_read_u32. > --- > arch/powerpc/platforms/pseries/dlpar.c | 20 +++++++++++--------- > arch/powerpc/platforms/pseries/hotplug-cpu.c | 10 ++++++---- > 2 files changed, 17 insertions(+), 13 deletions(-) > > diff --git a/arch/powerpc/platforms/pseries/dlpar.c > b/arch/powerpc/platforms/pseries/dlpar.c > index 9e9f30b2..343dfdf 100644 > --- a/arch/powerpc/platforms/pseries/dlpar.c > +++ b/arch/powerpc/platforms/pseries/dlpar.c > @@ -444,7 +444,8 @@ static int dlpar_offline_cpu(struct device_node *dn) > int rc = 0; > unsigned int cpu; > int len, nthreads, i; > - const u32 *intserv; > + const __be32 *intserv; > + u32 thread; > > intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len); > if (!intserv) > @@ -454,8 +455,9 @@ static int dlpar_offline_cpu(struct device_node *dn) > > cpu_maps_update_begin(); > for (i = 0; i < nthreads; i++) { > + thread = be32_to_cpu(intserv[i]); > for_each_present_cpu(cpu) { > - if (get_hard_smp_processor_id(cpu) != intserv[i]) > + if (get_hard_smp_processor_id(cpu) != thread) > continue; > > if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE) > @@ -477,14 +479,14 @@ static int dlpar_offline_cpu(struct device_node *dn) > * Upgrade it's state to CPU_STATE_OFFLINE. > */ > set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); > - BUG_ON(plpar_hcall_norets(H_PROD, intserv[i]) > + BUG_ON(plpar_hcall_norets(H_PROD, thread) > != H_SUCCESS); > __cpu_die(cpu); > break; > } > if (cpu == num_possible_cpus()) > printk(KERN_WARNING "Could not find cpu to offline " > - "with physical id 0x%x\n", intserv[i]); > + "with physical id 0x%x\n", thread); > } > cpu_maps_update_done(); > > @@ -496,15 +498,15 @@ out: > static ssize_t dlpar_cpu_release(const char *buf, size_t count) > { > struct device_node *dn; > - const u32 *drc_index; > + const u32 drc_index; > int rc; > > dn = of_find_node_by_path(buf); > if (!dn) > return -EINVAL; > > - drc_index = of_get_property(dn, "ibm,my-drc-index", NULL); > - if (!drc_index) { > + rc = of_property_read_u32(dn, "ibm,my-drc-index", &drc_index);
Use of const for drc_index causes compilation problems. Warning on Fedora 20 BE arch/powerpc/platforms/pseries/dlpar.c: In function ‘dlpar_cpu_release’: arch/powerpc/platforms/pseries/dlpar.c:508:2: warning: passing argument 3 of ‘of_property_read_u32’ discards ‘const’ qualifier from pointer target type [enabled by default] rc = of_property_read_u32(dn, "ibm,my-drc-index", &drc_index); ^ In file included from arch/powerpc/platforms/pseries/dlpar.c:18:0: include/linux/of.h:699:19: note: expected ‘u32 *’ but argument is of type ‘const u32 *’ static inline int of_property_read_u32(const struct device_node *np, Error on Ubuntu 14.04 LE arch/powerpc/platforms/pseries/dlpar.c: In function ‘dlpar_cpu_release’: arch/powerpc/platforms/pseries/dlpar.c:508:2: error: passing argument 3 of ‘of_property_read_u32’ discards ‘const’ qualifier from pointer target type [-Werror] rc = of_property_read_u32(dn, "ibm,my-drc-index", &drc_index); ^ In file included from arch/powerpc/platforms/pseries/dlpar.c:18:0: include/linux/of.h:699:19: note: expected ‘u32 *’ but argument is of type ‘const u32 *’ static inline int of_property_read_u32(const struct device_node *np, ^ cc1: all warnings being treated as errors Regards, Bharata. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev