* [PATCH 1/2] powerpc/smp: Drop superfluous NULL check
@ 2020-03-13 11:20 Michael Ellerman
2020-03-13 11:20 ` [PATCH 2/2] powerpc/smp: Use IS_ENABLED() to avoid #ifdef Michael Ellerman
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Michael Ellerman @ 2020-03-13 11:20 UTC (permalink / raw)
To: linuxppc-dev; +Cc: srikar
We don't need the NULL check of np, the result is the same because the
OF helpers cope with NULL, of_node_to_nid(NULL) == NUMA_NO_NODE (-1).
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/smp.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 37c12e3bab9e..aae61a3b3201 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1197,11 +1197,8 @@ int get_physical_package_id(int cpu)
*/
if (pkg_id == -1 && firmware_has_feature(FW_FEATURE_LPAR)) {
struct device_node *np = of_get_cpu_node(cpu, NULL);
-
- if (np) {
- pkg_id = of_node_to_nid(np);
- of_node_put(np);
- }
+ pkg_id = of_node_to_nid(np);
+ of_node_put(np);
}
#endif /* CONFIG_PPC_SPLPAR */
--
2.21.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] powerpc/smp: Use IS_ENABLED() to avoid #ifdef
2020-03-13 11:20 [PATCH 1/2] powerpc/smp: Drop superfluous NULL check Michael Ellerman
@ 2020-03-13 11:20 ` Michael Ellerman
2020-03-13 14:54 ` Srikar Dronamraju
2020-03-13 14:46 ` [PATCH 1/2] powerpc/smp: Drop superfluous NULL check Srikar Dronamraju
2020-04-01 12:53 ` Michael Ellerman
2 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2020-03-13 11:20 UTC (permalink / raw)
To: linuxppc-dev; +Cc: srikar
We can avoid the #ifdef by using IS_ENABLED() in the existing
condition check.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/smp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index aae61a3b3201..6d2a3a3666f0 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1189,18 +1189,17 @@ int get_physical_package_id(int cpu)
{
int pkg_id = cpu_to_chip_id(cpu);
-#ifdef CONFIG_PPC_SPLPAR
/*
* If the platform is PowerNV or Guest on KVM, ibm,chip-id is
* defined. Hence we would return the chip-id as the result of
* get_physical_package_id.
*/
- if (pkg_id == -1 && firmware_has_feature(FW_FEATURE_LPAR)) {
+ if (pkg_id == -1 && firmware_has_feature(FW_FEATURE_LPAR) &&
+ IS_ENABLED(CONFIG_PPC_SPLPAR)) {
struct device_node *np = of_get_cpu_node(cpu, NULL);
pkg_id = of_node_to_nid(np);
of_node_put(np);
}
-#endif /* CONFIG_PPC_SPLPAR */
return pkg_id;
}
--
2.21.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] powerpc/smp: Drop superfluous NULL check
2020-03-13 11:20 [PATCH 1/2] powerpc/smp: Drop superfluous NULL check Michael Ellerman
2020-03-13 11:20 ` [PATCH 2/2] powerpc/smp: Use IS_ENABLED() to avoid #ifdef Michael Ellerman
@ 2020-03-13 14:46 ` Srikar Dronamraju
2020-04-01 12:53 ` Michael Ellerman
2 siblings, 0 replies; 5+ messages in thread
From: Srikar Dronamraju @ 2020-03-13 14:46 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
* Michael Ellerman <mpe@ellerman.id.au> [2020-03-13 22:20:19]:
> We don't need the NULL check of np, the result is the same because the
> OF helpers cope with NULL, of_node_to_nid(NULL) == NUMA_NO_NODE (-1).
>
Looks good to me.
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> arch/powerpc/kernel/smp.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 37c12e3bab9e..aae61a3b3201 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -1197,11 +1197,8 @@ int get_physical_package_id(int cpu)
> */
> if (pkg_id == -1 && firmware_has_feature(FW_FEATURE_LPAR)) {
> struct device_node *np = of_get_cpu_node(cpu, NULL);
> -
> - if (np) {
> - pkg_id = of_node_to_nid(np);
> - of_node_put(np);
> - }
> + pkg_id = of_node_to_nid(np);
> + of_node_put(np);
> }
> #endif /* CONFIG_PPC_SPLPAR */
>
> --
> 2.21.1
>
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] powerpc/smp: Use IS_ENABLED() to avoid #ifdef
2020-03-13 11:20 ` [PATCH 2/2] powerpc/smp: Use IS_ENABLED() to avoid #ifdef Michael Ellerman
@ 2020-03-13 14:54 ` Srikar Dronamraju
0 siblings, 0 replies; 5+ messages in thread
From: Srikar Dronamraju @ 2020-03-13 14:54 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
* Michael Ellerman <mpe@ellerman.id.au> [2020-03-13 22:20:20]:
> We can avoid the #ifdef by using IS_ENABLED() in the existing
> condition check.
>
Looks good to me.
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> arch/powerpc/kernel/smp.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index aae61a3b3201..6d2a3a3666f0 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -1189,18 +1189,17 @@ int get_physical_package_id(int cpu)
> {
> int pkg_id = cpu_to_chip_id(cpu);
>
> -#ifdef CONFIG_PPC_SPLPAR
> /*
> * If the platform is PowerNV or Guest on KVM, ibm,chip-id is
> * defined. Hence we would return the chip-id as the result of
> * get_physical_package_id.
> */
> - if (pkg_id == -1 && firmware_has_feature(FW_FEATURE_LPAR)) {
> + if (pkg_id == -1 && firmware_has_feature(FW_FEATURE_LPAR) &&
> + IS_ENABLED(CONFIG_PPC_SPLPAR)) {
> struct device_node *np = of_get_cpu_node(cpu, NULL);
> pkg_id = of_node_to_nid(np);
> of_node_put(np);
> }
> -#endif /* CONFIG_PPC_SPLPAR */
>
> return pkg_id;
> }
> --
> 2.21.1
>
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] powerpc/smp: Drop superfluous NULL check
2020-03-13 11:20 [PATCH 1/2] powerpc/smp: Drop superfluous NULL check Michael Ellerman
2020-03-13 11:20 ` [PATCH 2/2] powerpc/smp: Use IS_ENABLED() to avoid #ifdef Michael Ellerman
2020-03-13 14:46 ` [PATCH 1/2] powerpc/smp: Drop superfluous NULL check Srikar Dronamraju
@ 2020-04-01 12:53 ` Michael Ellerman
2 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2020-04-01 12:53 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: srikar
On Fri, 2020-03-13 at 11:20:19 UTC, Michael Ellerman wrote:
> We don't need the NULL check of np, the result is the same because the
> OF helpers cope with NULL, of_node_to_nid(NULL) == NUMA_NO_NODE (-1).
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Series applied to powerpc next.
https://git.kernel.org/powerpc/c/4b4d181d63518334070a877ba789211bde77da9e
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-01 13:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 11:20 [PATCH 1/2] powerpc/smp: Drop superfluous NULL check Michael Ellerman
2020-03-13 11:20 ` [PATCH 2/2] powerpc/smp: Use IS_ENABLED() to avoid #ifdef Michael Ellerman
2020-03-13 14:54 ` Srikar Dronamraju
2020-03-13 14:46 ` [PATCH 1/2] powerpc/smp: Drop superfluous NULL check Srikar Dronamraju
2020-04-01 12:53 ` Michael Ellerman
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.