aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/range.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2010-02-10 04:20:13 -0500
committerH. Peter Anvin <hpa@zytor.com>2010-02-10 20:47:17 -0500
commite9a0064ad03b899938059bb576615ad9ed0f27f9 (patch)
treeb1c7dd0c7844fb4b8f56bb991684ece56bcd6e1c /kernel/range.c
parent284f933d45a1e60404328440910bc2651c0fb51d (diff)
x86: Change range end to start+size
So make interface more consistent with early_res. Later we can share some code with early_res. Signed-off-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <1265793639-15071-10-git-send-email-yinghai@kernel.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'kernel/range.c')
-rw-r--r--kernel/range.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/range.c b/kernel/range.c
index 71e0021281fe..74e2e6114927 100644
--- a/kernel/range.c
+++ b/kernel/range.c
@@ -13,7 +13,7 @@
13 13
14int add_range(struct range *range, int az, int nr_range, u64 start, u64 end) 14int add_range(struct range *range, int az, int nr_range, u64 start, u64 end)
15{ 15{
16 if (start > end) 16 if (start >= end)
17 return nr_range; 17 return nr_range;
18 18
19 /* Out of slots: */ 19 /* Out of slots: */
@@ -33,7 +33,7 @@ int add_range_with_merge(struct range *range, int az, int nr_range,
33{ 33{
34 int i; 34 int i;
35 35
36 if (start > end) 36 if (start >= end)
37 return nr_range; 37 return nr_range;
38 38
39 /* Try to merge it with old one: */ 39 /* Try to merge it with old one: */
@@ -46,7 +46,7 @@ int add_range_with_merge(struct range *range, int az, int nr_range,
46 46
47 common_start = max(range[i].start, start); 47 common_start = max(range[i].start, start);
48 common_end = min(range[i].end, end); 48 common_end = min(range[i].end, end);
49 if (common_start > common_end + 1) 49 if (common_start > common_end)
50 continue; 50 continue;
51 51
52 final_start = min(range[i].start, start); 52 final_start = min(range[i].start, start);
@@ -65,7 +65,7 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
65{ 65{
66 int i, j; 66 int i, j;
67 67
68 if (start > end) 68 if (start >= end)
69 return; 69 return;
70 70
71 for (j = 0; j < az; j++) { 71 for (j = 0; j < az; j++) {
@@ -79,15 +79,15 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
79 } 79 }
80 80
81 if (start <= range[j].start && end < range[j].end && 81 if (start <= range[j].start && end < range[j].end &&
82 range[j].start < end + 1) { 82 range[j].start < end) {
83 range[j].start = end + 1; 83 range[j].start = end;
84 continue; 84 continue;
85 } 85 }
86 86
87 87
88 if (start > range[j].start && end >= range[j].end && 88 if (start > range[j].start && end >= range[j].end &&
89 range[j].end > start - 1) { 89 range[j].end > start) {
90 range[j].end = start - 1; 90 range[j].end = start;
91 continue; 91 continue;
92 } 92 }
93 93
@@ -99,11 +99,11 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
99 } 99 }
100 if (i < az) { 100 if (i < az) {
101 range[i].end = range[j].end; 101 range[i].end = range[j].end;
102 range[i].start = end + 1; 102 range[i].start = end;
103 } else { 103 } else {
104 printk(KERN_ERR "run of slot in ranges\n"); 104 printk(KERN_ERR "run of slot in ranges\n");
105 } 105 }
106 range[j].end = start - 1; 106 range[j].end = start;
107 continue; 107 continue;
108 } 108 }
109 } 109 }