From patchwork Wed Jan 13 07:25:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 72519 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0D7PRrd010280 for ; Wed, 13 Jan 2010 07:25:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753215Ab0AMHZ0 (ORCPT ); Wed, 13 Jan 2010 02:25:26 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753086Ab0AMHZZ (ORCPT ); Wed, 13 Jan 2010 02:25:25 -0500 Received: from ozlabs.org ([203.10.76.45]:53794 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751312Ab0AMHZZ (ORCPT ); Wed, 13 Jan 2010 02:25:25 -0500 Received: by ozlabs.org (Postfix, from userid 1034) id 3D7C6B7CA2; Wed, 13 Jan 2010 18:25:24 +1100 (EST) To: Cc: , , Message-Id: <7fc2de452d4c0a034681dcaca89630882386b4b2.1263367518.git.michael@ellerman.id.au> From: Michael Ellerman Subject: [PATCH] lmb: Add lmb_free() Date: Wed, 13 Jan 2010 18:25:24 +1100 (EST) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org diff --git a/include/linux/lmb.h b/include/linux/lmb.h index ef82b8f..f3d1433 100644 --- a/include/linux/lmb.h +++ b/include/linux/lmb.h @@ -42,6 +42,7 @@ extern void __init lmb_init(void); extern void __init lmb_analyze(void); extern long lmb_add(u64 base, u64 size); extern long lmb_remove(u64 base, u64 size); +extern long __init lmb_free(u64 base, u64 size); extern long __init lmb_reserve(u64 base, u64 size); extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid, u64 (*nid_range)(u64, u64, int *)); diff --git a/lib/lmb.c b/lib/lmb.c index 9cee171..cdeb284 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -205,9 +205,8 @@ long lmb_add(u64 base, u64 size) } -long lmb_remove(u64 base, u64 size) +static long __lmb_remove(struct lmb_region *rgn, u64 base, u64 size) { - struct lmb_region *rgn = &(lmb.memory); u64 rgnbegin, rgnend; u64 end = base + size; int i; @@ -254,6 +253,16 @@ long lmb_remove(u64 base, u64 size) return lmb_add_region(rgn, end, rgnend - end); } +long lmb_remove(u64 base, u64 size) +{ + return __lmb_remove(&(lmb.memory), base, size); +} + +long __init lmb_free(u64 base, u64 size) +{ + return __lmb_remove(&(lmb.reserved), base, size); +} + long __init lmb_reserve(u64 base, u64 size) { struct lmb_region *_rgn = &lmb.reserved;