From patchwork Wed Oct 3 10:11:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yasuaki Ishimatsu X-Patchwork-Id: 1540821 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1E7D3DF238 for ; Wed, 3 Oct 2012 10:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754706Ab2JCKL4 (ORCPT ); Wed, 3 Oct 2012 06:11:56 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:50628 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754577Ab2JCKLz (ORCPT ); Wed, 3 Oct 2012 06:11:55 -0400 Received: from m3.gw.fujitsu.co.jp (unknown [10.0.50.73]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id ACC323EE0C1; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 9132945DEC0; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.fujitsu.co.jp [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 773AE45DEB6; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 64A051DB803E; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from g01jpexchkw04.g01.fujitsu.local (g01jpexchkw04.g01.fujitsu.local [10.0.194.43]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 0D23FE18006; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from [127.0.0.1] (10.124.101.33) by g01jpexchkw04.g01.fujitsu.local (10.0.194.43) with Microsoft SMTP Server id 14.2.309.2; Wed, 3 Oct 2012 19:11:51 +0900 X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Message-ID: <506C0F53.5030500@jp.fujitsu.com> Date: Wed, 3 Oct 2012 19:11:31 +0900 From: Yasuaki Ishimatsu User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: , , , CC: , , , , , , , Subject: [PATCH 4/4] acpi, memory-hotplug : store the node id in acpi_memory_device References: <506C0AE8.40702@jp.fujitsu.com> In-Reply-To: <506C0AE8.40702@jp.fujitsu.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Wen Congyang The memory device has only one node id. Store the node id when enable the memory device, and we can reuse it when removing the memory device. CC: David Rientjes CC: Jiang Liu CC: Len Brown CC: Benjamin Herrenschmidt CC: Paul Mackerras CC: Christoph Lameter Cc: Minchan Kim CC: Andrew Morton CC: KOSAKI Motohiro CC: Yasuaki Ishimatsu Signed-off-by: Wen Congyang Signed-off-by: Yasuaki Ishimatsu --- drivers/acpi/acpi_memhotplug.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-3.6/drivers/acpi/acpi_memhotplug.c =================================================================== --- linux-3.6.orig/drivers/acpi/acpi_memhotplug.c 2012-10-03 19:03:26.818401966 +0900 +++ linux-3.6/drivers/acpi/acpi_memhotplug.c 2012-10-03 19:08:38.804604700 +0900 @@ -83,6 +83,7 @@ struct acpi_memory_info { struct acpi_memory_device { struct acpi_device * device; unsigned int state; /* State of the memory device */ + int nid; struct list_head res_list; }; @@ -256,6 +257,9 @@ static int acpi_memory_enable_device(str info->enabled = 1; num_enabled++; } + + mem_device->nid = node; + if (!num_enabled) { printk(KERN_ERR PREFIX "add_memory failed\n"); mem_device->state = MEMORY_INVALID_STATE; @@ -310,9 +314,7 @@ static int acpi_memory_remove_memory(str { int result; struct acpi_memory_info *info, *n; - int node; - - node = acpi_get_node(mem_device->device->handle); + int node = mem_device->nid; list_for_each_entry_safe(info, n, &mem_device->res_list, list) { if (!info->enabled) @@ -322,9 +324,6 @@ static int acpi_memory_remove_memory(str if (result) return result; - if (node < 0) - node = memory_add_physaddr_to_nid(info->start_addr); - result = remove_memory(node, info->start_addr, info->length); if (result) return result;