Even though the comment says POWER4 usage, I guess it applies to all
platforms since there is no PVR check there. This patch moves the check
to the helper.

Signed-off-by: Aneesh Kumar K.V <aneesh.ku...@linux.ibm.com>
---
 arch/powerpc/mm/numa.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index d29f60e15777..7319084345e1 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -250,7 +250,8 @@ int affinity_domain_to_nid(struct affinity_domain *domain)
        if (!firmware_has_feature(FW_FEATURE_LPAR))
                return domain_id;
 
-       if (domain_id ==  -1)
+       /* POWER4 LPAR uses 0xffff as invalid node */
+       if (domain_id ==  -1 || domain_id == 0xffff)
                return NUMA_NO_NODE;
 
        nid = __affinity_domain_to_nid(domain_id, last_nid);
@@ -283,10 +284,6 @@ static int associativity_to_nid(const __be32 
*associativity)
        if (of_read_number(associativity, 1) >= min_common_depth)
                domain.id = of_read_number(&associativity[min_common_depth], 1);
 
-       /* POWER4 LPAR uses 0xffff as invalid node */
-       if (domain.id == 0xffff)
-               domain.id = -1;
-
        nid = affinity_domain_to_nid(&domain);
 
        if (nid > 0 &&
@@ -499,9 +496,6 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
                index = lmb->aa_index * aa.array_sz + min_common_depth - 1;
                domain.id = of_read_number(&aa.arrays[index], 1);
 
-               if (domain.id == 0xffff)
-                       domain.id = -1;
-
                nid = affinity_domain_to_nid(&domain);
 
                if (nid > 0) {
-- 
2.26.2

Reply via email to