Message ID | 20230319150141.67824-2-robh@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] edac: cpc925: Drop unused memory size DT parsing | expand |
On Sun, Mar 19, 2023 at 10:01:41AM -0500, Rob Herring wrote: > Replace open coded reading of CPU nodes' "reg" properties with > of_get_cpu_hwid() dedicated for this purpose. > > Signed-off-by: Rob Herring <robh@kernel.org> > --- > drivers/edac/cpc925_edac.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c > index ee193aae8e14..0182436c1b5a 100644 > --- a/drivers/edac/cpc925_edac.c > +++ b/drivers/edac/cpc925_edac.c > @@ -557,13 +557,13 @@ static u32 cpc925_cpu_mask_disabled(void) > mask = APIMASK_ADI0 | APIMASK_ADI1; > > for_each_of_cpu_node(cpunode) { > - const u32 *reg = of_get_property(cpunode, "reg", NULL); > - if (reg == NULL || *reg > 2) { > + int hwid = of_get_cpu_hwid(cpunode, 0); > + if ((hwid < 0) || (hwid > 2)) { > cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode); > continue; > } > > - mask &= ~APIMASK_ADI(*reg); > + mask &= ~APIMASK_ADI(hwid); > } > > if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) { > -- $ grep CPC925 .config CONFIG_EDAC_CPC925=m $ make ARCH=powerpc CROSS_COMPILE=/home/boris/src/crosstool/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ... ERROR: modpost: ".of_get_cpu_hwid" [drivers/edac/cpc925_edac.ko] undefined! make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1 make: *** [Makefile:1980: modpost] Error 2
On Tue, Apr 18, 2023 at 07:50:00PM +0200, Borislav Petkov wrote: > On Sun, Mar 19, 2023 at 10:01:41AM -0500, Rob Herring wrote: > > Replace open coded reading of CPU nodes' "reg" properties with > > of_get_cpu_hwid() dedicated for this purpose. > > > > Signed-off-by: Rob Herring <robh@kernel.org> > > --- > > drivers/edac/cpc925_edac.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c > > index ee193aae8e14..0182436c1b5a 100644 > > --- a/drivers/edac/cpc925_edac.c > > +++ b/drivers/edac/cpc925_edac.c > > @@ -557,13 +557,13 @@ static u32 cpc925_cpu_mask_disabled(void) > > mask = APIMASK_ADI0 | APIMASK_ADI1; > > > > for_each_of_cpu_node(cpunode) { > > - const u32 *reg = of_get_property(cpunode, "reg", NULL); > > - if (reg == NULL || *reg > 2) { > > + int hwid = of_get_cpu_hwid(cpunode, 0); > > + if ((hwid < 0) || (hwid > 2)) { > > cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode); > > continue; > > } > > > > - mask &= ~APIMASK_ADI(*reg); > > + mask &= ~APIMASK_ADI(hwid); > > } > > > > if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) { > > -- > > $ grep CPC925 .config > CONFIG_EDAC_CPC925=m > > $ make ARCH=powerpc CROSS_COMPILE=/home/boris/src/crosstool/gcc-11.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux- > ... > ERROR: modpost: ".of_get_cpu_hwid" [drivers/edac/cpc925_edac.ko] undefined! > make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1 > make: *** [Makefile:1980: modpost] Error 2 I'd rather not export of_get_cpu_hwid() which is otherwise only used in arch code. I think I'll rewrite this in terms of for_each_possible_cpu() and topology_core_id(). Though that would make a UP build not enable core 1, but that seems undesirable anyways. Rob
On Wed, Apr 19, 2023 at 01:45:47PM -0500, Rob Herring wrote: > I'd rather not export of_get_cpu_hwid() which is otherwise only used in > arch code. I think I'll rewrite this in terms of for_each_possible_cpu() > and topology_core_id(). Though that would make a UP build not enable > core 1, but that seems undesirable anyways. TBH I'm not sure this driver is even worth any effort besides simply deleting it. I see one commit which reads like someone was really using it: ce395088832b ("cpc925_edac: Support single-processor configurations") but that one is from 2011 and since then it has received only API modifications/cleanups. But if I delete it, someone might crawl out of the woodwork and say it is still used...
+Arnd, Michael E On Wed, Apr 19, 2023 at 1:55 PM Borislav Petkov <bp@alien8.de> wrote: > > On Wed, Apr 19, 2023 at 01:45:47PM -0500, Rob Herring wrote: > > I'd rather not export of_get_cpu_hwid() which is otherwise only used in > > arch code. I think I'll rewrite this in terms of for_each_possible_cpu() > > and topology_core_id(). Though that would make a UP build not enable > > core 1, but that seems undesirable anyways. > > TBH I'm not sure this driver is even worth any effort besides simply > deleting it. I see one commit which reads like someone was really using > it: > > ce395088832b ("cpc925_edac: Support single-processor configurations") > > but that one is from 2011 and since then it has received only API > modifications/cleanups. > > But if I delete it, someone might crawl out of the woodwork and say it > is still used... Yeah, I came to that conclusion as well. It's only used by "maple" (aka PPC970FX Evaluation Board) as the kernel has to instantiate this device (rather than DT). Seems like a 20 year old eval board is unlikely to have any users, so perhaps the whole platform could be removed. Rob
diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c index ee193aae8e14..0182436c1b5a 100644 --- a/drivers/edac/cpc925_edac.c +++ b/drivers/edac/cpc925_edac.c @@ -557,13 +557,13 @@ static u32 cpc925_cpu_mask_disabled(void) mask = APIMASK_ADI0 | APIMASK_ADI1; for_each_of_cpu_node(cpunode) { - const u32 *reg = of_get_property(cpunode, "reg", NULL); - if (reg == NULL || *reg > 2) { + int hwid = of_get_cpu_hwid(cpunode, 0); + if ((hwid < 0) || (hwid > 2)) { cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode); continue; } - mask &= ~APIMASK_ADI(*reg); + mask &= ~APIMASK_ADI(hwid); } if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
Replace open coded reading of CPU nodes' "reg" properties with of_get_cpu_hwid() dedicated for this purpose. Signed-off-by: Rob Herring <robh@kernel.org> --- drivers/edac/cpc925_edac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)