From c91b9f661e6d11e66b9b1247a4404f851ece938d Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 29 Nov 2012 14:17:32 +1100 Subject: [PATCH] mm-memory-hotplug-dynamic-configure-movable-memory-and-portion-memory-fix use min_t, cleanups Cc: Lai Jiangshan Cc: Wen Congyang Signed-off-by: Andrew Morton --- drivers/base/memory.c | 20 ++++++++++++-------- mm/memory_hotplug.c | 1 - 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 97774a904551..987604d56c83 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -341,14 +341,18 @@ store_mem_state(struct device *dev, mem = container_of(dev, struct memory_block, dev); - if (!strncmp(buf, "online_kernel", min((int)count, 13))) - ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE, ONLINE_KERNEL); - else if (!strncmp(buf, "online_movable", min((int)count, 14))) - ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE, ONLINE_MOVABLE); - else if (!strncmp(buf, "online", min((int)count, 6))) - ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE, ONLINE_KEEP); - else if(!strncmp(buf, "offline", min((int)count, 7))) - ret = memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE, -1); + if (!strncmp(buf, "online_kernel", min_t(int, count, 13))) + ret = memory_block_change_state(mem, MEM_ONLINE, + MEM_OFFLINE, ONLINE_KERNEL); + else if (!strncmp(buf, "online_movable", min_t(int, count, 14))) + ret = memory_block_change_state(mem, MEM_ONLINE, + MEM_OFFLINE, ONLINE_MOVABLE); + else if (!strncmp(buf, "online", min_t(int, count, 6))) + ret = memory_block_change_state(mem, MEM_ONLINE, + MEM_OFFLINE, ONLINE_KEEP); + else if(!strncmp(buf, "offline", min_t(int, count, 7))) + ret = memory_block_change_state(mem, MEM_OFFLINE, + MEM_ONLINE, -1); if (ret) return ret; diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 74b935508308..7928bb27e626 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -217,7 +217,6 @@ static void grow_zone_span(struct zone *zone, unsigned long start_pfn, static void resize_zone(struct zone *zone, unsigned long start_pfn, unsigned long end_pfn) { - zone_span_writelock(zone); zone->zone_start_pfn = start_pfn; -- 2.39.5