linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parisc: using swap() instead of tmp
@ 2021-11-01  2:10 Yihao Han
  2021-11-01  2:21 ` Matthew Wilcox
  0 siblings, 1 reply; 3+ messages in thread
From: Yihao Han @ 2021-11-01  2:10 UTC (permalink / raw)
  To: James E.J. Bottomley, Helge Deller, Kefeng Wang,
	David Hildenbrand, Yihao Han, Christophe Leroy,
	Matthew Wilcox (Oracle),
	Sven Schnelle, linux-parisc, linux-kernel
  Cc: kernel

swap() was used instead of the tmp variable to swap values

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 arch/parisc/mm/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 65f50f072a87..b705a423be85 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -127,16 +127,13 @@ static void __init setup_bootmem(void)
 		int j;
 
 		for (j = i; j > 0; j--) {
-			physmem_range_t tmp;
 
 			if (pmem_ranges[j-1].start_pfn <
 			    pmem_ranges[j].start_pfn) {
 
 				break;
 			}
-			tmp = pmem_ranges[j-1];
-			pmem_ranges[j-1] = pmem_ranges[j];
-			pmem_ranges[j] = tmp;
+			swap(pmem_ranges[j-1], pmem_ranges[j]);
 		}
 	}
 
-- 
2.17.1


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

* Re: [PATCH] parisc: using swap() instead of tmp
  2021-11-01  2:10 [PATCH] parisc: using swap() instead of tmp Yihao Han
@ 2021-11-01  2:21 ` Matthew Wilcox
  0 siblings, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2021-11-01  2:21 UTC (permalink / raw)
  To: Yihao Han
  Cc: James E.J. Bottomley, Helge Deller, Kefeng Wang,
	David Hildenbrand, Christophe Leroy, Sven Schnelle, linux-parisc,
	linux-kernel, kernel

On Sun, Oct 31, 2021 at 07:10:45PM -0700, Yihao Han wrote:
> @@ -127,16 +127,13 @@ static void __init setup_bootmem(void)
>  		int j;
>  
>  		for (j = i; j > 0; j--) {
> -			physmem_range_t tmp;
>  

If you're going to delete that line, you should also delete the
blank line after it.

>  			if (pmem_ranges[j-1].start_pfn <
>  			    pmem_ranges[j].start_pfn) {
>  
>  				break;
>  			}
> -			tmp = pmem_ranges[j-1];
> -			pmem_ranges[j-1] = pmem_ranges[j];
> -			pmem_ranges[j] = tmp;
> +			swap(pmem_ranges[j-1], pmem_ranges[j]);
>  		}
>  	}
>  
> -- 
> 2.17.1
> 

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

* [PATCH] parisc: using swap() instead of tmp
@ 2021-11-01  3:03 Yihao Han
  0 siblings, 0 replies; 3+ messages in thread
From: Yihao Han @ 2021-11-01  3:03 UTC (permalink / raw)
  To: James E.J. Bottomley, Helge Deller, Yihao Han, Christophe Leroy,
	Kefeng Wang, Dave Hansen, Matthew Wilcox (Oracle),
	Sven Schnelle, linux-parisc, linux-kernel
  Cc: kernel

swap() was used instead of the tmp variable to swap values

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 arch/parisc/mm/init.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 65f50f072a87..1ae31db9988f 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -127,16 +127,12 @@ static void __init setup_bootmem(void)
 		int j;
 
 		for (j = i; j > 0; j--) {
-			physmem_range_t tmp;
-
 			if (pmem_ranges[j-1].start_pfn <
 			    pmem_ranges[j].start_pfn) {
 
 				break;
 			}
-			tmp = pmem_ranges[j-1];
-			pmem_ranges[j-1] = pmem_ranges[j];
-			pmem_ranges[j] = tmp;
+			swap(pmem_ranges[j-1], pmem_ranges[j]);
 		}
 	}
 
-- 
2.17.1


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

end of thread, other threads:[~2021-11-01  3:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01  2:10 [PATCH] parisc: using swap() instead of tmp Yihao Han
2021-11-01  2:21 ` Matthew Wilcox
2021-11-01  3:03 Yihao Han

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