aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 6ecb0d937fb5..252b77bdf65e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -715,16 +715,13 @@ int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
715} 715}
716 716
717/** 717/**
718 * memblock_mark_hotplug - Mark hotpluggable memory with flag MEMBLOCK_HOTPLUG.
719 * @base: the base phys addr of the region
720 * @size: the size of the region
721 * 718 *
722 * This function isolates region [@base, @base + @size), and mark it with flag 719 * This function isolates region [@base, @base + @size), and sets/clears flag
723 * MEMBLOCK_HOTPLUG.
724 * 720 *
725 * Return 0 on succees, -errno on failure. 721 * Return 0 on succees, -errno on failure.
726 */ 722 */
727int __init_memblock memblock_mark_hotplug(phys_addr_t base, phys_addr_t size) 723static int __init_memblock memblock_setclr_flag(phys_addr_t base,
724 phys_addr_t size, int set, int flag)
728{ 725{
729 struct memblock_type *type = &memblock.memory; 726 struct memblock_type *type = &memblock.memory;
730 int i, ret, start_rgn, end_rgn; 727 int i, ret, start_rgn, end_rgn;
@@ -734,37 +731,37 @@ int __init_memblock memblock_mark_hotplug(phys_addr_t base, phys_addr_t size)
734 return ret; 731 return ret;
735 732
736 for (i = start_rgn; i < end_rgn; i++) 733 for (i = start_rgn; i < end_rgn; i++)
737 memblock_set_region_flags(&type->regions[i], MEMBLOCK_HOTPLUG); 734 if (set)
735 memblock_set_region_flags(&type->regions[i], flag);
736 else
737 memblock_clear_region_flags(&type->regions[i], flag);
738 738
739 memblock_merge_regions(type); 739 memblock_merge_regions(type);
740 return 0; 740 return 0;
741} 741}
742 742
743/** 743/**
744 * memblock_clear_hotplug - Clear flag MEMBLOCK_HOTPLUG for a specified region. 744 * memblock_mark_hotplug - Mark hotpluggable memory with flag MEMBLOCK_HOTPLUG.
745 * @base: the base phys addr of the region 745 * @base: the base phys addr of the region
746 * @size: the size of the region 746 * @size: the size of the region
747 * 747 *
748 * This function isolates region [@base, @base + @size), and clear flag 748 * Return 0 on succees, -errno on failure.
749 * MEMBLOCK_HOTPLUG for the isolated regions. 749 */
750int __init_memblock memblock_mark_hotplug(phys_addr_t base, phys_addr_t size)
751{
752 return memblock_setclr_flag(base, size, 1, MEMBLOCK_HOTPLUG);
753}
754
755/**
756 * memblock_clear_hotplug - Clear flag MEMBLOCK_HOTPLUG for a specified region.
757 * @base: the base phys addr of the region
758 * @size: the size of the region
750 * 759 *
751 * Return 0 on succees, -errno on failure. 760 * Return 0 on succees, -errno on failure.
752 */ 761 */
753int __init_memblock memblock_clear_hotplug(phys_addr_t base, phys_addr_t size) 762int __init_memblock memblock_clear_hotplug(phys_addr_t base, phys_addr_t size)
754{ 763{
755 struct memblock_type *type = &memblock.memory; 764 return memblock_setclr_flag(base, size, 0, MEMBLOCK_HOTPLUG);
756 int i, ret, start_rgn, end_rgn;
757
758 ret = memblock_isolate_range(type, base, size, &start_rgn, &end_rgn);
759 if (ret)
760 return ret;
761
762 for (i = start_rgn; i < end_rgn; i++)
763 memblock_clear_region_flags(&type->regions[i],
764 MEMBLOCK_HOTPLUG);
765
766 memblock_merge_regions(type);
767 return 0;
768} 765}
769 766
770/** 767/**