memory hotplug: use macro to switch between section and pfn
authorSheng Yong <shengyong1@huawei.com>
Tue, 14 Apr 2015 22:44:54 +0000 (15:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Apr 2015 23:49:00 +0000 (16:49 -0700)
Use macro section_nr_to_pfn() to switch between section and pfn, instead
of open-coding it.  No semantic changes.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/base/memory.c
mm/memory_hotplug.c

index af9c911cd6b5433fac09b013ad7927e9a7ede18d..ab5c9a7dfecab916deb635f1b32b81ee9f0a7480 100644 (file)
@@ -228,7 +228,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
        struct page *first_page;
        int ret;
 
-       start_pfn = phys_index << PFN_SECTION_SHIFT;
+       start_pfn = section_nr_to_pfn(phys_index);
        first_page = pfn_to_page(start_pfn);
 
        switch (action) {
index 65842d688b7c9bb5dbfd2440fc07339fa94650f4..aaec7758eec352465c87739b7723ffffd1b60de7 100644 (file)
@@ -502,7 +502,7 @@ int __ref __add_pages(int nid, struct zone *zone, unsigned long phys_start_pfn,
        end_sec = pfn_to_section_nr(phys_start_pfn + nr_pages - 1);
 
        for (i = start_sec; i <= end_sec; i++) {
-               err = __add_section(nid, zone, i << PFN_SECTION_SHIFT);
+               err = __add_section(nid, zone, section_nr_to_pfn(i));
 
                /*
                 * EEXIST is finally dealt with by ioresource collision