From patchwork Tue Jul 3 05:59:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yasuaki Ishimatsu X-Patchwork-Id: 1149081 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 512F240AC9 for ; Tue, 3 Jul 2012 06:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933359Ab2GCF7x (ORCPT ); Tue, 3 Jul 2012 01:59:53 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:53704 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932654Ab2GCF7v (ORCPT ); Tue, 3 Jul 2012 01:59:51 -0400 Received: from m2.gw.fujitsu.co.jp (unknown [10.0.50.72]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id 20BEA3EE0B6; Tue, 3 Jul 2012 14:59:51 +0900 (JST) Received: from smail (m2 [127.0.0.1]) by outgoing.m2.gw.fujitsu.co.jp (Postfix) with ESMTP id EAE8D45DE54; Tue, 3 Jul 2012 14:59:50 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (s2.gw.fujitsu.co.jp [10.0.50.92]) by m2.gw.fujitsu.co.jp (Postfix) with ESMTP id CE11345DE4E; Tue, 3 Jul 2012 14:59:50 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 825FDE08004; Tue, 3 Jul 2012 14:59:50 +0900 (JST) Received: from g01jpexchyt04.g01.fujitsu.local (g01jpexchyt04.g01.fujitsu.local [10.128.194.43]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 2CE841DB803C; Tue, 3 Jul 2012 14:59:50 +0900 (JST) Received: from [127.0.0.1] (10.124.101.33) by g01jpexchyt04.g01.fujitsu.local (10.128.194.43) with Microsoft SMTP Server id 14.2.309.2; Tue, 3 Jul 2012 14:59:46 +0900 X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Message-ID: <4FF28A46.3040607@jp.fujitsu.com> Date: Tue, 3 Jul 2012 14:59:34 +0900 From: Yasuaki Ishimatsu User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: , , , CC: , , , , , , , , Subject: [RFC PATCH v2 6/13] memory-hotplug : add memory_block_release References: <4FF287C3.4030901@jp.fujitsu.com> In-Reply-To: <4FF287C3.4030901@jp.fujitsu.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org When calling remove_memory_block(), the function shows following message at device_release(). Device 'memory528' does not have a release() function, it is broken and must be fixed. remove_memory_block() calls kfree(mem). I think it shouled be called from device_release(). So the patch implements memory_block_release() 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 Signed-off-by: Yasuaki Ishimatsu --- drivers/base/memory.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 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.5-rc4/drivers/base/memory.c =================================================================== --- linux-3.5-rc4.orig/drivers/base/memory.c 2012-07-03 14:21:58.335263984 +0900 +++ linux-3.5-rc4/drivers/base/memory.c 2012-07-03 14:22:08.094141981 +0900 @@ -108,6 +108,15 @@ bool is_memblk_offline(unsigned long sta } EXPORT_SYMBOL(is_memblk_offline); +#define to_memory_block(device) container_of(device, struct memory_block, dev) + +static void release_memory_block(struct device *dev) +{ + struct memory_block *mem = to_memory_block(dev); + + kfree(mem); +} + /* * register_memory - Setup a sysfs device for a memory block */ @@ -118,6 +127,7 @@ int register_memory(struct memory_block memory->dev.bus = &memory_subsys; memory->dev.id = memory->start_section_nr / sections_per_block; + memory->dev.release = release_memory_block; error = device_register(&memory->dev); return error; @@ -668,7 +678,6 @@ int remove_memory_block(unsigned long no mem_remove_simple_file(mem, phys_device); mem_remove_simple_file(mem, removable); unregister_memory(mem); - kfree(mem); } else kobject_put(&mem->dev.kobj);