All of lore.kernel.org
 help / color / mirror / Atom feed
* [18/21] edac: cpc925: use for_each_of_cpu_node iterator
  2018-09-05 19:37 ` Rob Herring
@ 2018-09-05 19:37 ` Rob Herring
  -1 siblings, 0 replies; 94+ messages in thread
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: Borislav Petkov, Mauro Carvalho Chehab, linux-edac

Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
has the side effect of defaulting to iterating using "cpu" node names in
preference to the deprecated (for FDT) device_type == "cpu".

Cc: Borislav Petkov <bp@alien8.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
---
Please ack and I will take via the DT tree. This is dependent on the
first 2 patches.

 drivers/edac/cpc925_edac.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

--
2.17.1

diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
index 2c98e020df05..3c0881ac9880 100644
--- a/drivers/edac/cpc925_edac.c
+++ b/drivers/edac/cpc925_edac.c
@@ -593,8 +593,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)
 /******************** CPU err device********************************/
 static u32 cpc925_cpu_mask_disabled(void)
 {
-	struct device_node *cpus;
-	struct device_node *cpunode = NULL;
+	struct device_node *cpunode;
 	static u32 mask = 0;

 	/* use cached value if available */
@@ -603,20 +602,8 @@ static u32 cpc925_cpu_mask_disabled(void)

 	mask = APIMASK_ADI0 | APIMASK_ADI1;

-	cpus = of_find_node_by_path("/cpus");
-	if (cpus == NULL) {
-		cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
-		return 0;
-	}
-
-	while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
+	for_each_of_cpu_node(cpunode) {
 		const u32 *reg = of_get_property(cpunode, "reg", NULL);
-
-		if (strcmp(cpunode->type, "cpu")) {
-			cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
-			continue;
-		}
-
 		if (reg == NULL || *reg > 2) {
 			cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode);
 			continue;
@@ -633,9 +620,6 @@ static u32 cpc925_cpu_mask_disabled(void)
 				"Assuming PI id is equal to CPU MPIC id!\n");
 	}

-	of_node_put(cpunode);
-	of_node_put(cpus);
-
 	return mask;
 }


^ permalink raw reply related	[flat|nested] 94+ messages in thread
* [18/21] edac: cpc925: use for_each_of_cpu_node iterator
  2018-09-06 11:12 ` [PATCH 18/21] " Rob Herring
@ 2018-09-06 12:20 ` Borislav Petkov
  -1 siblings, 0 replies; 94+ messages in thread
From: Borislav Petkov @ 2018-09-06 12:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab,
	linux-edac

On Thu, Sep 06, 2018 at 06:12:51AM -0500, Rob Herring wrote:
> I should have noted this. It's not the kernel's job to validate the DT
> and certainly not some driver's job to validate cpu nodes. It's bad
> enough that some random driver is parsing cpu nodes. If they are
> missing or are crap, you should get warnings or messages well before
> this point.

That is useful info for the commit message, I'd say.

In any case:

Acked-by: Borislav Petkov <bp@suse.de>

^ permalink raw reply	[flat|nested] 94+ messages in thread
* [18/21] edac: cpc925: use for_each_of_cpu_node iterator
  2018-09-06  8:35 ` [PATCH 18/21] " Borislav Petkov
@ 2018-09-06 11:12 ` Rob Herring
  -1 siblings, 0 replies; 94+ messages in thread
From: Rob Herring @ 2018-09-06 11:12 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: devicetree, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab,
	linux-edac

On Thu, Sep 6, 2018 at 3:35 AM Borislav Petkov <bp@alien8.de> wrote:
>
> On Wed, Sep 05, 2018 at 02:37:35PM -0500, Rob Herring wrote:
> > Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
> > has the side effect of defaulting to iterating using "cpu" node names in
> > preference to the deprecated (for FDT) device_type == "cpu".
> >
> > Cc: Borislav Petkov <bp@alien8.de>
> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > Cc: linux-edac@vger.kernel.org
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> > Please ack and I will take via the DT tree. This is dependent on the
> > first 2 patches.
>
> Completely unknown territory for me so I'd trust your judgement. Staring
> at 1/21, the conversion looks ok except the removal of those prints that
> a cpu nodes are not present - I wonder if they even meant anything or
> were just there during driver development...

I should have noted this. It's not the kernel's job to validate the DT
and certainly not some driver's job to validate cpu nodes. It's bad
enough that some random driver is parsing cpu nodes. If they are
missing or are crap, you should get warnings or messages well before
this point.

Rob

^ permalink raw reply	[flat|nested] 94+ messages in thread
* [18/21] edac: cpc925: use for_each_of_cpu_node iterator
  2018-09-05 19:37 ` [PATCH 18/21] " Rob Herring
@ 2018-09-06  8:35 ` Borislav Petkov
  -1 siblings, 0 replies; 94+ messages in thread
From: Borislav Petkov @ 2018-09-06  8:35 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-kernel, Mauro Carvalho Chehab, linux-edac

On Wed, Sep 05, 2018 at 02:37:35PM -0500, Rob Herring wrote:
> Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This
> has the side effect of defaulting to iterating using "cpu" node names in
> preference to the deprecated (for FDT) device_type == "cpu".
> 
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: linux-edac@vger.kernel.org
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Please ack and I will take via the DT tree. This is dependent on the
> first 2 patches.

Completely unknown territory for me so I'd trust your judgement. Staring
at 1/21, the conversion looks ok except the removal of those prints that
a cpu nodes are not present - I wonder if they even meant anything or
were just there during driver development...

>  drivers/edac/cpc925_edac.c | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
> index 2c98e020df05..3c0881ac9880 100644
> --- a/drivers/edac/cpc925_edac.c
> +++ b/drivers/edac/cpc925_edac.c
> @@ -593,8 +593,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)
>  /******************** CPU err device********************************/
>  static u32 cpc925_cpu_mask_disabled(void)
>  {
> -	struct device_node *cpus;
> -	struct device_node *cpunode = NULL;
> +	struct device_node *cpunode;
>  	static u32 mask = 0;
> 
>  	/* use cached value if available */
> @@ -603,20 +602,8 @@ static u32 cpc925_cpu_mask_disabled(void)
> 
>  	mask = APIMASK_ADI0 | APIMASK_ADI1;
> 
> -	cpus = of_find_node_by_path("/cpus");
> -	if (cpus == NULL) {
> -		cpc925_printk(KERN_DEBUG, "No /cpus node !\n");

This thing...

> -		return 0;
> -	}
> -
> -	while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
> +	for_each_of_cpu_node(cpunode) {
>  		const u32 *reg = of_get_property(cpunode, "reg", NULL);
> -
> -		if (strcmp(cpunode->type, "cpu")) {
> -			cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);

... and this thing.

Thx.

^ permalink raw reply	[flat|nested] 94+ messages in thread
* [PATCH 00/21] DT cpu node iterator
@ 2018-09-05 19:37 ` Rob Herring
  0 siblings, 0 replies; 94+ messages in thread
From: Rob Herring @ 2018-09-05 19:37 UTC (permalink / raw)
  To: devicetree, linux-kernel
  Cc: linux-fbdev, Rich Felker, Catalin Marinas, linux-sh,
	Vitaly Bordug, Benjamin Herrenschmidt, Palmer Dabbelt,
	Will Deacon, dri-devel, Stefan Kristiansson, H. Peter Anvin,
	linux-riscv, Frank Rowand, Thomas Gleixner, Jonas Bonn,
	linux-c6x-dev, Yoshinori Sato, Michael Ellerman, Joerg Roedel,
	Magnus Damm, Russell King, linux-clk, Ingo Molnar, Mark Salter,
	Albert Ou, Bartlomiej Zolnierkiewicz, Aurelien Jacquiot, openrisc,
	Borislav Petkov, nios2-dev, Stafford Horne, Mauro Carvalho Chehab,
	linux-arm-kernel, linux-edac, Michal Simek, Stephen Boyd,
	linux-renesas-soc, iommu, Simon Horman, Ley Foon Tan,
	linuxppc-dev

This series adds an iterator for cpu nodes and converts users over to use
it or of_get_cpu_node in some cases. This allows us to remove the
dependency on device_type property for cpu nodes though removing that
from DTS files will have to wait for some time. In some cases, this makes
the DT search more strict by only looking in /cpus child nodes rather
than any node with the device_type == cpu. The iterator also honors the
status property which is often forgotten.

I've only tested on ARM under QEMU and compiled powerpc.

Rob

Rob Herring (21):
  of: Add cpu node iterator for_each_of_cpu_node()
  of: Support matching cpu nodes with no 'reg' property
  ARM: use for_each_of_cpu_node iterator
  ARM: topology: remove unneeded check for /cpus node
  ARM: shmobile: use for_each_of_cpu_node iterator
  arm64: use for_each_of_cpu_node iterator
  c6x: use for_each_of_cpu_node iterator
  microblaze: get cpu node with of_get_cpu_node
  nios2: get cpu node with of_get_cpu_node
  openrisc: use for_each_of_cpu_node iterator
  powerpc: use for_each_of_cpu_node iterator
  powerpc: 4xx: get cpu node with of_get_cpu_node
  powerpc: 8xx: get cpu node with of_get_cpu_node
  riscv: use for_each_of_cpu_node iterator
  SH: use for_each_of_cpu_node iterator
  x86: DT: use for_each_of_cpu_node iterator
  clk: mvebu: use for_each_of_cpu_node iterator
  edac: cpc925: use for_each_of_cpu_node iterator
  iommu: fsl_pamu: use for_each_of_cpu_node iterator
  of: use for_each_of_cpu_node iterator
  fbdev: fsl-diu: get cpu node with of_get_cpu_node

 arch/arm/kernel/devtree.c                 |  5 +--
 arch/arm/kernel/topology.c                |  6 ---
 arch/arm/mach-shmobile/pm-rcar-gen2.c     |  8 +---
 arch/arm/mach-shmobile/pm-rmobile.c       |  2 +-
 arch/arm/mach-shmobile/timer.c            | 10 +----
 arch/arm64/kernel/smp.c                   |  2 +-
 arch/c6x/kernel/setup.c                   | 11 ++---
 arch/microblaze/kernel/cpu/cpuinfo.c      |  4 +-
 arch/nios2/kernel/cpuinfo.c               |  4 +-
 arch/openrisc/kernel/setup.c              |  3 +-
 arch/powerpc/platforms/4xx/soc.c          |  2 +-
 arch/powerpc/platforms/8xx/m8xx_setup.c   |  5 ++-
 arch/powerpc/platforms/powermac/feature.c | 51 ++++++++---------------
 arch/powerpc/platforms/powermac/setup.c   | 15 +++----
 arch/riscv/kernel/smpboot.c               |  2 +-
 arch/sh/boards/of-generic.c               |  2 +-
 arch/x86/kernel/devicetree.c              |  2 +-
 drivers/clk/mvebu/clk-cpu.c               |  4 +-
 drivers/edac/cpc925_edac.c                | 20 +--------
 drivers/iommu/fsl_pamu.c                  |  2 +-
 drivers/of/base.c                         | 43 ++++++++++++++++++-
 drivers/of/of_numa.c                      | 15 +------
 drivers/video/fbdev/fsl-diu-fb.c          |  2 +-
 include/linux/of.h                        | 11 +++++
 24 files changed, 111 insertions(+), 120 deletions(-)

--
2.17.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 94+ messages in thread

end of thread, other threads:[~2018-11-01 16:00 UTC | newest]

Thread overview: 94+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-05 19:37 [18/21] edac: cpc925: use for_each_of_cpu_node iterator Rob Herring
2018-09-05 19:37 ` [PATCH 18/21] " Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2018-09-06 12:20 [18/21] " Borislav Petkov
2018-09-06 12:20 ` [PATCH 18/21] " Borislav Petkov
2018-09-06 11:12 [18/21] " Rob Herring
2018-09-06 11:12 ` [PATCH 18/21] " Rob Herring
2018-09-06  8:35 [18/21] " Borislav Petkov
2018-09-06  8:35 ` [PATCH 18/21] " Borislav Petkov
2018-09-05 19:37 [PATCH 00/21] DT cpu node iterator Rob Herring
2018-09-05 19:37 ` Rob Herring
2018-09-05 19:37 ` [OpenRISC] " Rob Herring
2018-09-05 19:37 ` Rob Herring
2018-09-05 19:37 ` Rob Herring
2018-09-05 19:37 ` Rob Herring
2018-09-05 19:37 ` Rob Herring
2018-09-05 19:37 ` [PATCH 01/21] of: Add cpu node iterator for_each_of_cpu_node() Rob Herring
2018-09-06  8:45   ` Geert Uytterhoeven
2018-10-30 14:18   ` Michael Ellerman
2018-10-30 14:20     ` Michael Ellerman
2018-10-30 15:00       ` Rob Herring
2018-10-30 15:00         ` Rob Herring
2018-11-01 10:52         ` Michael Ellerman
2018-11-01 10:52           ` Michael Ellerman
2018-11-01 15:12           ` Segher Boessenkool
2018-11-01 15:12             ` Segher Boessenkool
2018-11-01 15:57             ` Rob Herring
2018-11-01 15:57               ` Rob Herring
2018-09-05 19:37 ` [PATCH 02/21] of: Support matching cpu nodes with no 'reg' property Rob Herring
2018-09-05 19:37 ` [PATCH 03/21] ARM: use for_each_of_cpu_node iterator Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-05 19:37 ` [PATCH 04/21] ARM: topology: remove unneeded check for /cpus node Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-05 19:37 ` [PATCH 05/21] ARM: shmobile: use for_each_of_cpu_node iterator Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-06  8:52   ` Geert Uytterhoeven
2018-09-06  8:52     ` Geert Uytterhoeven
2018-09-06  8:56   ` Simon Horman
2018-09-06  8:56     ` Simon Horman
2018-09-05 19:37 ` [PATCH 06/21] arm64: " Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-06 10:04   ` Will Deacon
2018-09-06 10:04     ` Will Deacon
2018-09-05 19:37 ` [PATCH 07/21] c6x: " Rob Herring
2018-09-05 19:37 ` [PATCH 08/21] microblaze: get cpu node with of_get_cpu_node Rob Herring
2018-09-10 14:56   ` Michal Simek
2018-09-10 14:56     ` Michal Simek
2018-09-10 20:49     ` Rob Herring
2018-09-11 12:15       ` Michal Simek
2018-09-11 12:15         ` Michal Simek
2018-09-05 19:37 ` [PATCH 09/21] nios2: " Rob Herring
2018-09-05 19:37 ` [OpenRISC] [PATCH 10/21] openrisc: use for_each_of_cpu_node iterator Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-06  9:12   ` [OpenRISC] " Stafford Horne
2018-09-06  9:12     ` Stafford Horne
2018-09-05 19:37 ` [PATCH 11/21] powerpc: " Rob Herring
2018-09-05 19:37 ` [PATCH 12/21] powerpc: 4xx: get cpu node with of_get_cpu_node Rob Herring
2018-09-05 19:37 ` [PATCH 13/21] powerpc: 8xx: " Rob Herring
2018-09-05 19:37 ` [PATCH 14/21] riscv: use for_each_of_cpu_node iterator Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-10 13:37   ` Christoph Hellwig
2018-09-10 13:37     ` Christoph Hellwig
2018-09-10 13:51     ` Rob Herring
2018-09-10 13:51       ` Rob Herring
2018-09-18 22:53   ` Palmer Dabbelt
2018-09-18 22:53     ` Palmer Dabbelt
2018-09-05 19:37 ` [PATCH 15/21] SH: " Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-05 19:37 ` [PATCH 16/21] x86: DT: " Rob Herring
2018-09-06  8:15   ` Thomas Gleixner
2018-09-05 19:37 ` [PATCH 17/21] clk: mvebu: " Rob Herring
2018-09-06  1:47   ` Stephen Boyd
2018-09-06  1:47     ` Stephen Boyd
     [not found] ` <20180905193738.19325-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2018-09-05 19:37   ` [PATCH 19/21] iommu: fsl_pamu: " Rob Herring
2018-09-05 19:37     ` Rob Herring
2018-09-07 12:54   ` [PATCH 00/21] DT cpu node iterator Michal Simek
2018-09-07 12:54     ` [OpenRISC] " Michal Simek
2018-09-07 12:54     ` Michal Simek
2018-09-07 13:58     ` Rob Herring
2018-09-07 13:58       ` Rob Herring
2018-09-07 13:58       ` [OpenRISC] " Rob Herring
2018-09-07 13:58       ` Rob Herring
2018-09-07 13:58       ` Rob Herring
2018-09-07 13:58       ` Rob Herring
2018-09-05 19:37 ` [PATCH 20/21] of: use for_each_of_cpu_node iterator Rob Herring
2018-10-31 12:46   ` NXP P50XX/e5500 secondary CPUs not onlined with current mainline (was [PATCH 20/21] of: use for_each_of_cpu_node iterator) Michael Ellerman
2018-10-31 14:25     ` Rob Herring
2018-11-01 10:55       ` Michael Ellerman
2018-11-01 10:55         ` Michael Ellerman
2018-09-05 19:37 ` [PATCH 21/21] fbdev: fsl-diu: get cpu node with of_get_cpu_node Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-05 19:37   ` Rob Herring
2018-09-11  3:34   ` Timur Tabi
2018-09-11  3:34     ` Timur Tabi
2018-09-11  3:34     ` Timur Tabi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.