lkml.org 
[lkml]   [2021]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH V2 6/6] mm/sparse: remove one duplicated #ifdef CONFIG_SPARSEMEM_EXTREME
Date
Those two blocks of code contained by #ifdef CONFIG_SPARSEMEM_EXTREME
condition are right along with each other. Not need using another #ifdef
condition.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
ChangeLog:
*new patch
---
mm/sparse.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 6412010478f7..2905ee9fde10 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -114,16 +114,7 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)

return 0;
}
-#else /* !SPARSEMEM_EXTREME */
-static inline int sparse_index_init(unsigned long section_nr, int nid)
-{
- return 0;
-}

-static inline void sparse_alloc_section_roots(void) {}
-#endif
-
-#ifdef CONFIG_SPARSEMEM_EXTREME
unsigned long __section_nr(struct mem_section *ms)
{
unsigned long root_nr;
@@ -142,11 +133,18 @@ unsigned long __section_nr(struct mem_section *ms)

return (root_nr * SECTIONS_PER_ROOT) + (ms - root);
}
-#else
+#else /* !SPARSEMEM_EXTREME */
+static inline int sparse_index_init(unsigned long section_nr, int nid)
+{
+ return 0;
+}
+
unsigned long __section_nr(struct mem_section *ms)
{
return (unsigned long)(ms - mem_sections[0]);
}
+
+static inline void sparse_alloc_section_roots(void) {}
#endif

/*
--
2.25.1
\
 
 \ /
  Last update: 2021-05-31 11:21    [W:0.686 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site