Commit 4ed940d4 authored by Yasuaki Ishimatsu's avatar Yasuaki Ishimatsu Committed by Linus Torvalds

firmware_map: make firmware_map_add_early() argument consistent with firmware_map_add_hotplug()

There are two ways to create /sys/firmware/memmap/X sysfs:

  - firmware_map_add_early
    When the system starts, it is calledd from e820_reserve_resources()
  - firmware_map_add_hotplug
    When the memory is hot plugged, it is called from add_memory()

But these functions are called without unifying value of end argument as
below:

  - end argument of firmware_map_add_early()   : start + size - 1
  - end argument of firmware_map_add_hogplug() : start + size

The patch unifies them to "start + size".  Even if applying the patch,
/sys/firmware/memmap/X/end file content does not change.

[akpm@linux-foundation.org: clarify comments]
Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Reviewed-by: default avatarDave Hansen <dave@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4b068148
...@@ -944,7 +944,7 @@ void __init e820_reserve_resources(void) ...@@ -944,7 +944,7 @@ void __init e820_reserve_resources(void)
for (i = 0; i < e820_saved.nr_map; i++) { for (i = 0; i < e820_saved.nr_map; i++) {
struct e820entry *entry = &e820_saved.map[i]; struct e820entry *entry = &e820_saved.map[i];
firmware_map_add_early(entry->addr, firmware_map_add_early(entry->addr,
entry->addr + entry->size - 1, entry->addr + entry->size,
e820_type_to_string(entry->type)); e820_type_to_string(entry->type));
} }
} }
......
...@@ -98,7 +98,7 @@ static LIST_HEAD(map_entries); ...@@ -98,7 +98,7 @@ static LIST_HEAD(map_entries);
/** /**
* firmware_map_add_entry() - Does the real work to add a firmware memmap entry. * firmware_map_add_entry() - Does the real work to add a firmware memmap entry.
* @start: Start of the memory range. * @start: Start of the memory range.
* @end: End of the memory range (inclusive). * @end: End of the memory range (exclusive).
* @type: Type of the memory range. * @type: Type of the memory range.
* @entry: Pre-allocated (either kmalloc() or bootmem allocator), uninitialised * @entry: Pre-allocated (either kmalloc() or bootmem allocator), uninitialised
* entry. * entry.
...@@ -113,7 +113,7 @@ static int firmware_map_add_entry(u64 start, u64 end, ...@@ -113,7 +113,7 @@ static int firmware_map_add_entry(u64 start, u64 end,
BUG_ON(start > end); BUG_ON(start > end);
entry->start = start; entry->start = start;
entry->end = end; entry->end = end - 1;
entry->type = type; entry->type = type;
INIT_LIST_HEAD(&entry->list); INIT_LIST_HEAD(&entry->list);
kobject_init(&entry->kobj, &memmap_ktype); kobject_init(&entry->kobj, &memmap_ktype);
...@@ -148,7 +148,7 @@ static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry) ...@@ -148,7 +148,7 @@ static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry)
* firmware_map_add_hotplug() - Adds a firmware mapping entry when we do * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
* memory hotplug. * memory hotplug.
* @start: Start of the memory range. * @start: Start of the memory range.
* @end: End of the memory range (inclusive). * @end: End of the memory range (exclusive)
* @type: Type of the memory range. * @type: Type of the memory range.
* *
* Adds a firmware mapping entry. This function is for memory hotplug, it is * Adds a firmware mapping entry. This function is for memory hotplug, it is
...@@ -175,7 +175,7 @@ int __meminit firmware_map_add_hotplug(u64 start, u64 end, const char *type) ...@@ -175,7 +175,7 @@ int __meminit firmware_map_add_hotplug(u64 start, u64 end, const char *type)
/** /**
* firmware_map_add_early() - Adds a firmware mapping entry. * firmware_map_add_early() - Adds a firmware mapping entry.
* @start: Start of the memory range. * @start: Start of the memory range.
* @end: End of the memory range (inclusive). * @end: End of the memory range.
* @type: Type of the memory range. * @type: Type of the memory range.
* *
* Adds a firmware mapping entry. This function uses the bootmem allocator * Adds a firmware mapping entry. This function uses the bootmem allocator
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment