linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.3 1/7] powerpc: Use of_property_present() for testing DT property presence
@ 2023-05-09  3:54 Sasha Levin
  2023-05-09  3:54 ` [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support Sasha Levin
  0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2023-05-09  3:54 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Rob Herring, srikar, nathanl, gregkh, ruanjinjie,
	linuxppc-dev, martin.petersen, krzk, ldufour, windhl, alexs,
	osalvador

From: Rob Herring <robh@kernel.org>

[ Upstream commit 857d423c74228cfa064f79ff3a16b163fdb8d542 ]

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.

Signed-off-by: Rob Herring <robh@kernel.org>
[mpe: Drop change in ppc4xx_probe_pci_bridge(), formatting]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230310144657.1541039-1-robh@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/kernel/legacy_serial.c          | 8 ++++----
 arch/powerpc/platforms/44x/iss4xx.c          | 2 +-
 arch/powerpc/platforms/44x/ppc476.c          | 2 +-
 arch/powerpc/platforms/cell/spu_manage.c     | 2 +-
 arch/powerpc/platforms/powermac/pic.c        | 3 +--
 arch/powerpc/platforms/powernv/opal-lpc.c    | 2 +-
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 +-
 arch/powerpc/platforms/pseries/vio.c         | 2 +-
 arch/powerpc/sysdev/mpic_msgr.c              | 2 +-
 9 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index f048c424c525b..1a3b7f3513b40 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -171,11 +171,11 @@ static int __init add_legacy_soc_port(struct device_node *np,
 	/* We only support ports that have a clock frequency properly
 	 * encoded in the device-tree.
 	 */
-	if (of_get_property(np, "clock-frequency", NULL) == NULL)
+	if (!of_property_present(np, "clock-frequency"))
 		return -1;
 
 	/* if reg-offset don't try to use it */
-	if ((of_get_property(np, "reg-offset", NULL) != NULL))
+	if (of_property_present(np, "reg-offset"))
 		return -1;
 
 	/* if rtas uses this device, don't try to use it as well */
@@ -237,7 +237,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
 	 * Note: Don't even try on P8 lpc, we know it's not directly mapped
 	 */
 	if (!of_device_is_compatible(isa_brg, "ibm,power8-lpc") ||
-	    of_get_property(isa_brg, "ranges", NULL)) {
+	    of_property_present(isa_brg, "ranges")) {
 		taddr = of_translate_address(np, reg);
 		if (taddr == OF_BAD_ADDR)
 			taddr = 0;
@@ -268,7 +268,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
 	 * compatible UARTs on PCI need all sort of quirks (port offsets
 	 * etc...) that this code doesn't know about
 	 */
-	if (of_get_property(np, "clock-frequency", NULL) == NULL)
+	if (!of_property_present(np, "clock-frequency"))
 		return -1;
 
 	/* Get the PCI address. Assume BAR 0 */
diff --git a/arch/powerpc/platforms/44x/iss4xx.c b/arch/powerpc/platforms/44x/iss4xx.c
index c5f82591408c1..812765cf06324 100644
--- a/arch/powerpc/platforms/44x/iss4xx.c
+++ b/arch/powerpc/platforms/44x/iss4xx.c
@@ -52,7 +52,7 @@ static void __init iss4xx_init_irq(void)
 
 	/* Find top level interrupt controller */
 	for_each_node_with_property(np, "interrupt-controller") {
-		if (of_get_property(np, "interrupts", NULL) == NULL)
+		if (!of_property_present(np, "interrupts"))
 			break;
 	}
 	if (np == NULL)
diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c
index 7c91ac5a5241b..70556fd10f6b4 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -122,7 +122,7 @@ static void __init ppc47x_init_irq(void)
 
 	/* Find top level interrupt controller */
 	for_each_node_with_property(np, "interrupt-controller") {
-		if (of_get_property(np, "interrupts", NULL) == NULL)
+		if (!of_property_present(np, "interrupts"))
 			break;
 	}
 	if (np == NULL)
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index f1ac4c7420690..74567b32c48c2 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -402,7 +402,7 @@ static int __init of_has_vicinity(void)
 	struct device_node *dn;
 
 	for_each_node_by_type(dn, "spe") {
-		if (of_find_property(dn, "vicinity", NULL))  {
+		if (of_property_present(dn, "vicinity"))  {
 			of_node_put(dn);
 			return 1;
 		}
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 8c8d8e0a7d137..7425f94e271e5 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -475,8 +475,7 @@ static int __init pmac_pic_probe_mpic(void)
 
 	/* We can have up to 2 MPICs cascaded */
 	for_each_node_by_type(np, "open-pic") {
-		if (master == NULL &&
-		    of_get_property(np, "interrupts", NULL) == NULL)
+		if (master == NULL && !of_property_present(np, "interrupts"))
 			master = of_node_get(np);
 		else if (slave == NULL)
 			slave = of_node_get(np);
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index d129d6d45a500..a16f07cdab267 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -403,7 +403,7 @@ void __init opal_lpc_init(void)
 		return;
 
 	/* Does it support direct mapping ? */
-	if (of_get_property(np, "ranges", NULL)) {
+	if (of_property_present(np, "ranges")) {
 		pr_info("OPAL: Found memory mapped LPC bus on chip %d\n",
 			opal_lpc_chip_id);
 		isa_bridge_init_non_pci(np);
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 982e5e4b5e065..1a3cb313976a4 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -493,7 +493,7 @@ static bool valid_cpu_drc_index(struct device_node *parent, u32 drc_index)
 	bool found = false;
 	int rc, index;
 
-	if (of_find_property(parent, "ibm,drc-info", NULL))
+	if (of_property_present(parent, "ibm,drc-info"))
 		return drc_info_valid_index(parent, drc_index);
 
 	/* Note that the format of the ibm,drc-indexes array is
diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index 770df9351aaa9..d54306a936d55 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -1440,7 +1440,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
 	viodev->dev.bus = &vio_bus_type;
 	viodev->dev.release = vio_dev_release;
 
-	if (of_get_property(viodev->dev.of_node, "ibm,my-dma-window", NULL)) {
+	if (of_property_present(viodev->dev.of_node, "ibm,my-dma-window")) {
 		if (firmware_has_feature(FW_FEATURE_CMO))
 			vio_cmo_set_dma_ops(viodev);
 		else
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index d75064fb7d12f..1a3ac0b5dd89c 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -116,7 +116,7 @@ static unsigned int mpic_msgr_number_of_blocks(void)
 
 		for (;;) {
 			snprintf(buf, sizeof(buf), "mpic-msgr-block%d", count);
-			if (!of_find_property(aliases, buf, NULL))
+			if (!of_property_present(aliases, buf))
 				break;
 
 			count += 1;
-- 
2.39.2


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

* [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
  2023-05-09  3:54 [PATCH AUTOSEL 6.3 1/7] powerpc: Use of_property_present() for testing DT property presence Sasha Levin
@ 2023-05-09  3:54 ` Sasha Levin
  2023-05-09  4:18   ` Randy Dunlap
  0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2023-05-09  3:54 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, arnd, linus.walleij, linuxppc-dev, andriy.shevchenko,
	Pali Rohár

From: Pali Rohár <pali@kernel.org>

[ Upstream commit 22fdf79171e8509db54599fd2c05ef0022ee83f5 ]

ULI1575 PCIe south bridge exists only on some Freescale boards. Allow to
disable CONFIG_FSL_ULI1575 symbol when it is not explicitly selected and
only implied. This is achieved by marking symbol as visible by providing
short description. Also adds dependency for this symbol to prevent enabling
it on platforms on which driver does not compile.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230409000812.18904-7-pali@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/platforms/Kconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index d41dad227de84..608ac0290e3aa 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -261,7 +261,9 @@ config CPM2
 	  on it (826x, 827x, 8560).
 
 config FSL_ULI1575
-	bool
+	bool "ULI1575 PCIe south bridge support"
+	depends on FSL_SOC_BOOKE || PPC_86xx
+	select FSL_PCI
 	select GENERIC_ISA_DMA
 	help
 	  Supports for the ULI1575 PCIe south bridge that exists on some
-- 
2.39.2


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

* Re: [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
  2023-05-09  3:54 ` [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support Sasha Levin
@ 2023-05-09  4:18   ` Randy Dunlap
  2023-05-09  7:14     ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Randy Dunlap @ 2023-05-09  4:18 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: arnd, linus.walleij, linuxppc-dev, andriy.shevchenko,
	Pali Rohár

Hi--

Just a heads up. This patch can cause build errors.
I sent a patch for these on 2023-APR-28:
  https://lore.kernel.org/linuxppc-dev/20230429043519.19807-1-rdunlap@infradead.org/

Michael, I think this is your area if I'm not mistaken.


On 5/8/23 20:54, Sasha Levin wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> [ Upstream commit 22fdf79171e8509db54599fd2c05ef0022ee83f5 ]
> 
> ULI1575 PCIe south bridge exists only on some Freescale boards. Allow to
> disable CONFIG_FSL_ULI1575 symbol when it is not explicitly selected and
> only implied. This is achieved by marking symbol as visible by providing
> short description. Also adds dependency for this symbol to prevent enabling
> it on platforms on which driver does not compile.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> Link: https://msgid.link/20230409000812.18904-7-pali@kernel.org
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  arch/powerpc/platforms/Kconfig | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
> index d41dad227de84..608ac0290e3aa 100644
> --- a/arch/powerpc/platforms/Kconfig
> +++ b/arch/powerpc/platforms/Kconfig
> @@ -261,7 +261,9 @@ config CPM2
>  	  on it (826x, 827x, 8560).
>  
>  config FSL_ULI1575
> -	bool
> +	bool "ULI1575 PCIe south bridge support"
> +	depends on FSL_SOC_BOOKE || PPC_86xx
> +	select FSL_PCI
>  	select GENERIC_ISA_DMA
>  	help
>  	  Supports for the ULI1575 PCIe south bridge that exists on some

-- 
~Randy

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

* Re: [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
  2023-05-09  4:18   ` Randy Dunlap
@ 2023-05-09  7:14     ` Michael Ellerman
  2023-05-09  7:18       ` Pali Rohár
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2023-05-09  7:14 UTC (permalink / raw)
  To: Randy Dunlap, Sasha Levin, linux-kernel, stable
  Cc: linuxppc-dev, linus.walleij, andriy.shevchenko, Pali Rohár,
	arnd

Randy Dunlap <rdunlap@infradead.org> writes:
> Hi--
>
> Just a heads up. This patch can cause build errors.
> I sent a patch for these on 2023-APR-28:
>   https://lore.kernel.org/linuxppc-dev/20230429043519.19807-1-rdunlap@infradead.org/
>
> Michael, I think this is your area if I'm not mistaken.

Yes. The fix is in my fixes branch as:
  536d948a8dee ("powerpc/fsl_uli1575: fix kconfig warnings and build errors")

But I don't think this commit (22fdf79171e8) really warrants going to
stable, it's a nice-to-have but doesn't fix any pressing bugs.

cheers

> On 5/8/23 20:54, Sasha Levin wrote:
>> From: Pali Rohár <pali@kernel.org>
>> 
>> [ Upstream commit 22fdf79171e8509db54599fd2c05ef0022ee83f5 ]
>> 
>> ULI1575 PCIe south bridge exists only on some Freescale boards. Allow to
>> disable CONFIG_FSL_ULI1575 symbol when it is not explicitly selected and
>> only implied. This is achieved by marking symbol as visible by providing
>> short description. Also adds dependency for this symbol to prevent enabling
>> it on platforms on which driver does not compile.
>> 
>> Signed-off-by: Pali Rohár <pali@kernel.org>
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>> Link: https://msgid.link/20230409000812.18904-7-pali@kernel.org
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>>  arch/powerpc/platforms/Kconfig | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
>> index d41dad227de84..608ac0290e3aa 100644
>> --- a/arch/powerpc/platforms/Kconfig
>> +++ b/arch/powerpc/platforms/Kconfig
>> @@ -261,7 +261,9 @@ config CPM2
>>  	  on it (826x, 827x, 8560).
>>  
>>  config FSL_ULI1575
>> -	bool
>> +	bool "ULI1575 PCIe south bridge support"
>> +	depends on FSL_SOC_BOOKE || PPC_86xx
>> +	select FSL_PCI
>>  	select GENERIC_ISA_DMA
>>  	help
>>  	  Supports for the ULI1575 PCIe south bridge that exists on some
>
> -- 
> ~Randy

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

* Re: [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
  2023-05-09  7:14     ` Michael Ellerman
@ 2023-05-09  7:18       ` Pali Rohár
  2023-05-18 17:47         ` Sasha Levin
  0 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2023-05-09  7:18 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Sasha Levin, arnd, linus.walleij, Randy Dunlap, linux-kernel,
	stable, andriy.shevchenko, linuxppc-dev

On Tuesday 09 May 2023 17:14:48 Michael Ellerman wrote:
> Randy Dunlap <rdunlap@infradead.org> writes:
> > Hi--
> >
> > Just a heads up. This patch can cause build errors.
> > I sent a patch for these on 2023-APR-28:
> >   https://lore.kernel.org/linuxppc-dev/20230429043519.19807-1-rdunlap@infradead.org/
> >
> > Michael, I think this is your area if I'm not mistaken.
> 
> Yes. The fix is in my fixes branch as:
>   536d948a8dee ("powerpc/fsl_uli1575: fix kconfig warnings and build errors")
> 
> But I don't think this commit (22fdf79171e8) really warrants going to
> stable, it's a nice-to-have but doesn't fix any pressing bugs.

Exactly. And also this patch alone without 1/8 would not work as in 1/8
https://lore.kernel.org/all/20230409000812.18904-2-pali@kernel.org/ was
added static inline variant of function which is used when ULI is
disabled.

> cheers
> 
> > On 5/8/23 20:54, Sasha Levin wrote:
> >> From: Pali Rohár <pali@kernel.org>
> >> 
> >> [ Upstream commit 22fdf79171e8509db54599fd2c05ef0022ee83f5 ]
> >> 
> >> ULI1575 PCIe south bridge exists only on some Freescale boards. Allow to
> >> disable CONFIG_FSL_ULI1575 symbol when it is not explicitly selected and
> >> only implied. This is achieved by marking symbol as visible by providing
> >> short description. Also adds dependency for this symbol to prevent enabling
> >> it on platforms on which driver does not compile.
> >> 
> >> Signed-off-by: Pali Rohár <pali@kernel.org>
> >> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> >> Link: https://msgid.link/20230409000812.18904-7-pali@kernel.org
> >> Signed-off-by: Sasha Levin <sashal@kernel.org>
> >> ---
> >>  arch/powerpc/platforms/Kconfig | 4 +++-
> >>  1 file changed, 3 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
> >> index d41dad227de84..608ac0290e3aa 100644
> >> --- a/arch/powerpc/platforms/Kconfig
> >> +++ b/arch/powerpc/platforms/Kconfig
> >> @@ -261,7 +261,9 @@ config CPM2
> >>  	  on it (826x, 827x, 8560).
> >>  
> >>  config FSL_ULI1575
> >> -	bool
> >> +	bool "ULI1575 PCIe south bridge support"
> >> +	depends on FSL_SOC_BOOKE || PPC_86xx
> >> +	select FSL_PCI
> >>  	select GENERIC_ISA_DMA
> >>  	help
> >>  	  Supports for the ULI1575 PCIe south bridge that exists on some
> >
> > -- 
> > ~Randy

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

* Re: [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support
  2023-05-09  7:18       ` Pali Rohár
@ 2023-05-18 17:47         ` Sasha Levin
  0 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2023-05-18 17:47 UTC (permalink / raw)
  To: Pali Rohár
  Cc: arnd, linus.walleij, Randy Dunlap, linux-kernel, stable,
	andriy.shevchenko, linuxppc-dev

On Tue, May 09, 2023 at 09:18:35AM +0200, Pali Rohár wrote:
>On Tuesday 09 May 2023 17:14:48 Michael Ellerman wrote:
>> Randy Dunlap <rdunlap@infradead.org> writes:
>> > Hi--
>> >
>> > Just a heads up. This patch can cause build errors.
>> > I sent a patch for these on 2023-APR-28:
>> >   https://lore.kernel.org/linuxppc-dev/20230429043519.19807-1-rdunlap@infradead.org/
>> >
>> > Michael, I think this is your area if I'm not mistaken.
>>
>> Yes. The fix is in my fixes branch as:
>>   536d948a8dee ("powerpc/fsl_uli1575: fix kconfig warnings and build errors")
>>
>> But I don't think this commit (22fdf79171e8) really warrants going to
>> stable, it's a nice-to-have but doesn't fix any pressing bugs.
>
>Exactly. And also this patch alone without 1/8 would not work as in 1/8
>https://lore.kernel.org/all/20230409000812.18904-2-pali@kernel.org/ was
>added static inline variant of function which is used when ULI is
>disabled.

I'll drop it, thanks!

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2023-05-18 17:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09  3:54 [PATCH AUTOSEL 6.3 1/7] powerpc: Use of_property_present() for testing DT property presence Sasha Levin
2023-05-09  3:54 ` [PATCH AUTOSEL 6.3 6/7] powerpc/fsl_uli1575: Allow to disable FSL_ULI1575 support Sasha Levin
2023-05-09  4:18   ` Randy Dunlap
2023-05-09  7:14     ` Michael Ellerman
2023-05-09  7:18       ` Pali Rohár
2023-05-18 17:47         ` Sasha Levin

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).