Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932496Ab2ELATk (ORCPT ); Fri, 11 May 2012 20:19:40 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:42602 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932362Ab2ELATe (ORCPT ); Fri, 11 May 2012 20:19:34 -0400 Date: Fri, 11 May 2012 17:18:05 -0700 From: Anton Vorontsov To: Greg Kroah-Hartman , Kees Cook , Colin Cross Cc: Arnd Bergmann , John Stultz , arve@android.com, Rebecca Schultz Zavin , Jesper Juhl , Randy Dunlap , Stephen Boyd , Thomas Meyer , Andrew Morton , Marco Stornelli , WANG Cong , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Subject: [PATCH 07/11] persistent_ram: Introduce persistent_ram_free() Message-ID: <20120512001804.GG14782@lizard> References: <20120512001506.GA8653@lizard> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120512001506.GA8653@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2370 Lines: 70 A corresponding function to persistent_ram_new(). Signed-off-by: Anton Vorontsov --- drivers/staging/android/persistent_ram.c | 15 +++++++++++++++ drivers/staging/android/persistent_ram.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c index c16d7c2..63481da 100644 --- a/drivers/staging/android/persistent_ram.c +++ b/drivers/staging/android/persistent_ram.c @@ -364,6 +364,9 @@ static void *persistent_ram_iomap(phys_addr_t start, size_t size) static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, struct persistent_ram_zone *prz) { + prz->paddr = start; + prz->size = size; + if (pfn_valid(start >> PAGE_SHIFT)) prz->vaddr = persistent_ram_vmap(start, size); else @@ -437,6 +440,18 @@ static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool return 0; } +void persistent_ram_free(struct persistent_ram_zone *prz) +{ + if (pfn_valid(prz->paddr >> PAGE_SHIFT)) { + vunmap(prz->vaddr); + } else { + iounmap(prz->vaddr); + release_mem_region(prz->paddr, prz->size); + } + persistent_ram_free_old(prz); + kfree(prz); +} + struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, size_t size, bool ecc) diff --git a/drivers/staging/android/persistent_ram.h b/drivers/staging/android/persistent_ram.h index 8154d15..d3b2b45 100644 --- a/drivers/staging/android/persistent_ram.h +++ b/drivers/staging/android/persistent_ram.h @@ -39,6 +39,8 @@ struct persistent_ram { }; struct persistent_ram_zone { + phys_addr_t paddr; + size_t size; void *vaddr; struct persistent_ram_buffer *buffer; size_t buffer_size; @@ -66,6 +68,7 @@ int persistent_ram_early_init(struct persistent_ram *ram); struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, size_t size, bool ecc); +void persistent_ram_free(struct persistent_ram_zone *prz); struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev, bool ecc); -- 1.7.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/