From patchwork Wed May 16 12:43:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 8680 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 52DC623E49 for ; Wed, 16 May 2012 12:44:50 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 22E80A18A62 for ; Wed, 16 May 2012 12:44:50 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so724514yen.11 for ; Wed, 16 May 2012 05:44:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=W5C3XgtoaxbgEFSwDgR+41nhqF4c3duyDFwB3ZRulz8=; b=DDyDMoxx6B0sL/NP/b/VrWdbjZCNrvs+xozAQOY5KBFe5GwAXtGMsY4pTQ5G/XQmZY lF0nSE4l4zaT7OhL6EftKMh85XcSb9hdrOf5CFpe44ItdHQC+WuvUwHx5L6obkQoJC/Q LJ/UjMB9FdJZt6VxiWTgwTh10SJtUF16fExLI3QRgrzGd/EnCHPtlrzOfet6c4E4JgxJ h99O51pJVmVwNEWWS+E9Pl1Cjt93wzbhSk5xjbIow1XctR+2Wor3Se4iBBRbpJ20+1OA kbOTH3nKbhzuihYYkg5pJJt+2gkcJg0SPNV8/aFmeKnHnUQOc+BsrQePnxnMZf/5kawo NKSQ== Received: by 10.50.154.169 with SMTP id vp9mr9785413igb.53.1337172289768; Wed, 16 May 2012 05:44:49 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.35.72 with SMTP id o8csp490736ibd; Wed, 16 May 2012 05:44:49 -0700 (PDT) Received: by 10.68.236.129 with SMTP id uu1mr16147093pbc.77.1337172289016; Wed, 16 May 2012 05:44:49 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id vv5si5846232pbc.337.2012.05.16.05.44.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 May 2012 05:44:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pz0-f50.google.com with SMTP id h15so1168470dan.37 for ; Wed, 16 May 2012 05:44:48 -0700 (PDT) Received: by 10.68.229.65 with SMTP id so1mr16402549pbc.2.1337172288674; Wed, 16 May 2012 05:44:48 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id ru4sm5352090pbc.66.2012.05.16.05.44.46 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 May 2012 05:44:47 -0700 (PDT) Date: Wed, 16 May 2012 05:43:19 -0700 From: Anton Vorontsov To: Greg Kroah-Hartman , Kees Cook , Colin Cross Cc: Arnd Bergmann , John Stultz , Shuah Khan , 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 3/6] persistent_ram: Prepare for modular builds Message-ID: <20120516124318.GC18345@lizard> References: <20120516124109.GA14658@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120516124109.GA14658@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQm5Kk70xBnh8zswwBZdSIGPAerg6rDueVODwBaFwhD2eS5WLPY1NkDaTe2mpoV+g7D7e2Zs This is a transition patch to keep things bisectable, just moves some routines under '#ifndef MODULE'. The code inside the #ifndef will go away soon, but so far we must support pstore and ram_console. So, we are about to use persistent_ram with pstore, with the ability to compile persistent_ram routines as modules. Some parts of persistent_ram uses memblock_reserve() routine, which is should be only used built-in code, and thus it is not exported. These persistent_ram bits are only used by Android's ram_console, which is always built-in. Without this patch, we won't able to compile persistent_ram as a module: ERROR: "memblock_reserve" [fs/pstore/ramoops.ko] undefined! make[1]: *** [__modpost] Error 1 make: *** [modules] Error 2 (As alternative, we could export memblock_reserve, but the thing is: we won't need it later.) Signed-off-by: Anton Vorontsov --- drivers/staging/android/persistent_ram.c | 46 ++++++++++++++++-------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c index 63481da..4b46eaa 100644 --- a/drivers/staging/android/persistent_ram.c +++ b/drivers/staging/android/persistent_ram.c @@ -384,28 +384,6 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, return 0; } -static int __init persistent_ram_buffer_init(const char *name, - struct persistent_ram_zone *prz) -{ - int i; - struct persistent_ram *ram; - struct persistent_ram_descriptor *desc; - phys_addr_t start; - - list_for_each_entry(ram, &persistent_ram_list, node) { - start = ram->start; - for (i = 0; i < ram->num_descs; i++) { - desc = &ram->descs[i]; - if (!strcmp(desc->name, name)) - return persistent_ram_buffer_map(start, - desc->size, prz); - start += desc->size; - } - } - - return -EINVAL; -} - static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool ecc) { int ret; @@ -478,6 +456,29 @@ err: return ERR_PTR(ret); } +#ifndef MODULE +static int __init persistent_ram_buffer_init(const char *name, + struct persistent_ram_zone *prz) +{ + int i; + struct persistent_ram *ram; + struct persistent_ram_descriptor *desc; + phys_addr_t start; + + list_for_each_entry(ram, &persistent_ram_list, node) { + start = ram->start; + for (i = 0; i < ram->num_descs; i++) { + desc = &ram->descs[i]; + if (!strcmp(desc->name, name)) + return persistent_ram_buffer_map(start, + desc->size, prz); + start += desc->size; + } + } + + return -EINVAL; +} + static __init struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) { @@ -528,3 +529,4 @@ int __init persistent_ram_early_init(struct persistent_ram *ram) return 0; } +#endif