aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@gmail.com>2016-12-25 09:35:51 -0500
committerIngo Molnar <mingo@kernel.org>2016-12-28 03:20:29 -0500
commitb4ed1d15b453c86b4b9362128bd7a0ecd95a105c (patch)
tree03f0d77ddec7c04c869477e93d4ea50aff4ecf3f
parent2d706e790f0508dff4fb72eca9b4892b79757feb (diff)
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>
-rw-r--r--arch/x86/include/asm/e820.h2
-rw-r--r--arch/x86/kernel/e820.c16
2 files changed, 5 insertions, 13 deletions
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index ec23d8e1297c..67313f3a9874 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,
30 int checktype); 30 int checktype);
31extern void update_e820(void); 31extern void update_e820(void);
32extern void e820_setup_gap(void); 32extern void e820_setup_gap(void);
33extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
34 unsigned long start_addr, unsigned long long end_addr);
35struct setup_data; 33struct setup_data;
36extern void parse_e820_ext(u64 phys_addr, u32 data_len); 34extern void parse_e820_ext(u64 phys_addr, u32 data_len);
37 35
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 90e8dde3ec26..46f2afd3577a 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -580,24 +580,19 @@ static void __init update_e820_saved(void)
580} 580}
581#define MAX_GAP_END 0x100000000ull 581#define MAX_GAP_END 0x100000000ull
582/* 582/*
583 * Search for a gap in the e820 memory space from start_addr to end_addr. 583 * Search for a gap in the e820 memory space from 0 to MAX_GAP_END.
584 */ 584 */
585__init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, 585static int __init e820_search_gap(unsigned long *gapstart,
586 unsigned long start_addr, unsigned long long end_addr) 586 unsigned long *gapsize)
587{ 587{
588 unsigned long long last; 588 unsigned long long last = MAX_GAP_END;
589 int i = e820->nr_map; 589 int i = e820->nr_map;
590 int found = 0; 590 int found = 0;
591 591
592 last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END;
593
594 while (--i >= 0) { 592 while (--i >= 0) {
595 unsigned long long start = e820->map[i].addr; 593 unsigned long long start = e820->map[i].addr;
596 unsigned long long end = start + e820->map[i].size; 594 unsigned long long end = start + e820->map[i].size;
597 595
598 if (end < start_addr)
599 continue;
600
601 /* 596 /*
602 * Since "last" is at most 4GB, we know we'll 597 * Since "last" is at most 4GB, we know we'll
603 * fit in 32 bits if this condition is true 598 * fit in 32 bits if this condition is true
@@ -628,9 +623,8 @@ __init void e820_setup_gap(void)
628 unsigned long gapstart, gapsize; 623 unsigned long gapstart, gapsize;
629 int found; 624 int found;
630 625
631 gapstart = 0x10000000;
632 gapsize = 0x400000; 626 gapsize = 0x400000;
633 found = e820_search_gap(&gapstart, &gapsize, 0, MAX_GAP_END); 627 found = e820_search_gap(&gapstart, &gapsize);
634 628
635#ifdef CONFIG_X86_64 629#ifdef CONFIG_X86_64
636 if (!found) { 630 if (!found) {