diff mbox series

mm: sparse: Consistently use _nr

Message ID 20240531124144.240399-1-dev.jain@arm.com (mailing list archive)
State New
Headers show
Series mm: sparse: Consistently use _nr | expand

Commit Message

Dev Jain May 31, 2024, 12:41 p.m. UTC
Consistenly name the return variable with an _nr suffix, whenever calling
pfn_to_section_nr(), to avoid confusion with a (struct mem_section *).

Signed-off-by: Dev Jain <dev.jain@arm.com>
---
 mm/sparse.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Oscar Salvador June 3, 2024, 3:44 a.m. UTC | #1
On Fri, May 31, 2024 at 06:11:44PM +0530, Dev Jain wrote:
> Consistenly name the return variable with an _nr suffix, whenever calling
> pfn_to_section_nr(), to avoid confusion with a (struct mem_section *).
> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>

Acked-by: Oscar Salvador <osalvador@suse.de>
Anshuman Khandual June 4, 2024, 2:09 a.m. UTC | #2
On 5/31/24 18:11, Dev Jain wrote:
> Consistenly name the return variable with an _nr suffix, whenever calling
> pfn_to_section_nr(), to avoid confusion with a (struct mem_section *).
> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
>  mm/sparse.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index de40b2c73406..731f781e91b6 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -192,13 +192,13 @@ static void subsection_mask_set(unsigned long *map, unsigned long pfn,
>  
>  void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages)
>  {
> -	int end_sec = pfn_to_section_nr(pfn + nr_pages - 1);
> -	unsigned long nr, start_sec = pfn_to_section_nr(pfn);
> +	int end_sec_nr = pfn_to_section_nr(pfn + nr_pages - 1);
> +	unsigned long nr, start_sec_nr = pfn_to_section_nr(pfn);
>  
>  	if (!nr_pages)
>  		return;
>  
> -	for (nr = start_sec; nr <= end_sec; nr++) {
> +	for (nr = start_sec_nr; nr <= end_sec_nr; nr++) {
>  		struct mem_section *ms;
>  		unsigned long pfns;
>  
> @@ -229,17 +229,17 @@ static void __init memory_present(int nid, unsigned long start, unsigned long en
>  	start &= PAGE_SECTION_MASK;
>  	mminit_validate_memmodel_limits(&start, &end);
>  	for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
> -		unsigned long section = pfn_to_section_nr(pfn);
> +		unsigned long section_nr = pfn_to_section_nr(pfn);
>  		struct mem_section *ms;
>  
> -		sparse_index_init(section, nid);
> -		set_section_nid(section, nid);
> +		sparse_index_init(section_nr, nid);
> +		set_section_nid(section_nr, nid);
>  
> -		ms = __nr_to_section(section);
> +		ms = __nr_to_section(section_nr);
>  		if (!ms->section_mem_map) {
>  			ms->section_mem_map = sparse_encode_early_nid(nid) |
>  							SECTION_IS_ONLINE;
> -			__section_mark_present(ms, section);
> +			__section_mark_present(ms, section_nr);
>  		}
>  	}
>  }
diff mbox series

Patch

diff --git a/mm/sparse.c b/mm/sparse.c
index de40b2c73406..731f781e91b6 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -192,13 +192,13 @@  static void subsection_mask_set(unsigned long *map, unsigned long pfn,
 
 void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages)
 {
-	int end_sec = pfn_to_section_nr(pfn + nr_pages - 1);
-	unsigned long nr, start_sec = pfn_to_section_nr(pfn);
+	int end_sec_nr = pfn_to_section_nr(pfn + nr_pages - 1);
+	unsigned long nr, start_sec_nr = pfn_to_section_nr(pfn);
 
 	if (!nr_pages)
 		return;
 
-	for (nr = start_sec; nr <= end_sec; nr++) {
+	for (nr = start_sec_nr; nr <= end_sec_nr; nr++) {
 		struct mem_section *ms;
 		unsigned long pfns;
 
@@ -229,17 +229,17 @@  static void __init memory_present(int nid, unsigned long start, unsigned long en
 	start &= PAGE_SECTION_MASK;
 	mminit_validate_memmodel_limits(&start, &end);
 	for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
-		unsigned long section = pfn_to_section_nr(pfn);
+		unsigned long section_nr = pfn_to_section_nr(pfn);
 		struct mem_section *ms;
 
-		sparse_index_init(section, nid);
-		set_section_nid(section, nid);
+		sparse_index_init(section_nr, nid);
+		set_section_nid(section_nr, nid);
 
-		ms = __nr_to_section(section);
+		ms = __nr_to_section(section_nr);
 		if (!ms->section_mem_map) {
 			ms->section_mem_map = sparse_encode_early_nid(nid) |
 							SECTION_IS_ONLINE;
-			__section_mark_present(ms, section);
+			__section_mark_present(ms, section_nr);
 		}
 	}
 }