linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/e820: make e820_search_gap() static and remove unused variables
       [not found] <20161225013739.GA5878@linux-siqj.site>
@ 2016-12-25 14:35 ` Wei Yang
  2016-12-26  2:18   ` Yinghai Lu
  2016-12-29  8:40   ` [tip:x86/boot] x86/e820: Make " tip-bot for Wei Yang
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yang @ 2016-12-25 14:35 UTC (permalink / raw)
  To: yinghai, akataria; +Cc: tglx, mingo, x86, hpa, linux-kernel, Wei Yang

e820_search_gap() is just used locally now and the start_addr and end_addr
is fixed. Also gapstart is not checked in this function.

The patch makes e820_search_gap() static and remove those unused variables.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 arch/x86/include/asm/e820.h |  2 --
 arch/x86/kernel/e820.c      | 16 +++++-----------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 476b574..b95e6de 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -26,8 +26,6 @@ extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
 			     int checktype);
 extern void update_e820(void);
 extern void e820_setup_gap(void);
-extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
-			unsigned long start_addr, unsigned long long end_addr);
 struct setup_data;
 extern void parse_e820_ext(u64 phys_addr, u32 data_len);
 
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index f4fb197..1deb18a 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -586,24 +586,19 @@ static void __init update_e820_saved(void)
 }
 #define MAX_GAP_END 0x100000000ull
 /*
- * Search for a gap in the e820 memory space from start_addr to end_addr.
+ * Search for a gap in the e820 memory space from 0 to MAX_GAP_END.
  */
-__init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
-		unsigned long start_addr, unsigned long long end_addr)
+static int __init e820_search_gap(unsigned long *gapstart,
+		unsigned long *gapsize)
 {
-	unsigned long long last;
+	unsigned long long last = MAX_GAP_END;
 	int i = e820->nr_map;
 	int found = 0;
 
-	last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END;
-
 	while (--i >= 0) {
 		unsigned long long start = e820->map[i].addr;
 		unsigned long long end = start + e820->map[i].size;
 
-		if (end < start_addr)
-			continue;
-
 		/*
 		 * Since "last" is at most 4GB, we know we'll
 		 * fit in 32 bits if this condition is true
@@ -634,9 +629,8 @@ __init void e820_setup_gap(void)
 	unsigned long gapstart, gapsize;
 	int found;
 
-	gapstart = 0x10000000;
 	gapsize = 0x400000;
-	found  = e820_search_gap(&gapstart, &gapsize, 0, MAX_GAP_END);
+	found  = e820_search_gap(&gapstart, &gapsize);
 
 #ifdef CONFIG_X86_64
 	if (!found) {
-- 
2.5.0

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

* Re: [PATCH] x86/e820: make e820_search_gap() static and remove unused variables
  2016-12-25 14:35 ` [PATCH] x86/e820: make e820_search_gap() static and remove unused variables Wei Yang
@ 2016-12-26  2:18   ` Yinghai Lu
  2016-12-29  8:40   ` [tip:x86/boot] x86/e820: Make " tip-bot for Wei Yang
  1 sibling, 0 replies; 3+ messages in thread
From: Yinghai Lu @ 2016-12-26  2:18 UTC (permalink / raw)
  To: Wei Yang; +Cc: akataria, tglx, mingo, x86, hpa, linux-kernel

On Sun, Dec 25, 2016 at 02:35:51PM +0000, Wei Yang wrote:
> e820_search_gap() is just used locally now and the start_addr and end_addr
> is fixed. Also gapstart is not checked in this function.
> 
> The patch makes e820_search_gap() static and remove those unused variables.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

Acked-by: Yinghai Lu <yinghai@kernel.org>

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

* [tip:x86/boot] x86/e820: Make e820_search_gap() static and remove unused variables
  2016-12-25 14:35 ` [PATCH] x86/e820: make e820_search_gap() static and remove unused variables Wei Yang
  2016-12-26  2:18   ` Yinghai Lu
@ 2016-12-29  8:40   ` tip-bot for Wei Yang
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Wei Yang @ 2016-12-29  8:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: richard.weiyang, mingo, hpa, peterz, tglx, yinghai, torvalds,
	linux-kernel

Commit-ID:  b4ed1d15b453c86b4b9362128bd7a0ecd95a105c
Gitweb:     http://git.kernel.org/tip/b4ed1d15b453c86b4b9362128bd7a0ecd95a105c
Author:     Wei Yang <richard.weiyang@gmail.com>
AuthorDate: Sun, 25 Dec 2016 14:35:51 +0000
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 28 Dec 2016 09:20:29 +0100

x86/e820: Make e820_search_gap() static and remove unused variables

e820_search_gap() is just used locally now and the 'start_addr' and 'end_addr'
parameters are fixed values. Also, 'gapstart' is not checked in this function
anymore.

So make the function static and remove those unused variables.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akataria@vmware.com
Link: http://lkml.kernel.org/r/1482676551-11411-1-git-send-email-richard.weiyang@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/e820.h |  2 --
 arch/x86/kernel/e820.c      | 16 +++++-----------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index ec23d8e..67313f3 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -30,8 +30,6 @@ extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
 			     int checktype);
 extern void update_e820(void);
 extern void e820_setup_gap(void);
-extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
-			unsigned long start_addr, unsigned long long end_addr);
 struct setup_data;
 extern void parse_e820_ext(u64 phys_addr, u32 data_len);
 
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 90e8dde..46f2afd 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -580,24 +580,19 @@ static void __init update_e820_saved(void)
 }
 #define MAX_GAP_END 0x100000000ull
 /*
- * Search for a gap in the e820 memory space from start_addr to end_addr.
+ * Search for a gap in the e820 memory space from 0 to MAX_GAP_END.
  */
-__init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
-		unsigned long start_addr, unsigned long long end_addr)
+static int __init e820_search_gap(unsigned long *gapstart,
+		unsigned long *gapsize)
 {
-	unsigned long long last;
+	unsigned long long last = MAX_GAP_END;
 	int i = e820->nr_map;
 	int found = 0;
 
-	last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END;
-
 	while (--i >= 0) {
 		unsigned long long start = e820->map[i].addr;
 		unsigned long long end = start + e820->map[i].size;
 
-		if (end < start_addr)
-			continue;
-
 		/*
 		 * Since "last" is at most 4GB, we know we'll
 		 * fit in 32 bits if this condition is true
@@ -628,9 +623,8 @@ __init void e820_setup_gap(void)
 	unsigned long gapstart, gapsize;
 	int found;
 
-	gapstart = 0x10000000;
 	gapsize = 0x400000;
-	found  = e820_search_gap(&gapstart, &gapsize, 0, MAX_GAP_END);
+	found  = e820_search_gap(&gapstart, &gapsize);
 
 #ifdef CONFIG_X86_64
 	if (!found) {

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

end of thread, other threads:[~2016-12-29  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20161225013739.GA5878@linux-siqj.site>
2016-12-25 14:35 ` [PATCH] x86/e820: make e820_search_gap() static and remove unused variables Wei Yang
2016-12-26  2:18   ` Yinghai Lu
2016-12-29  8:40   ` [tip:x86/boot] x86/e820: Make " tip-bot for Wei Yang

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