From patchwork Fri Dec 13 08:51:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 3339061 X-Patchwork-Delegate: lethal@linux-sh.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7FBCCC0D4A for ; Fri, 13 Dec 2013 08:51:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 38B4D20766 for ; Fri, 13 Dec 2013 08:51:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1E4D20762 for ; Fri, 13 Dec 2013 08:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751503Ab3LMIvB (ORCPT ); Fri, 13 Dec 2013 03:51:01 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:36285 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750834Ab3LMIvA (ORCPT ); Fri, 13 Dec 2013 03:51:00 -0500 Received: by mail-pd0-f174.google.com with SMTP id y13so2095322pdi.5 for ; Fri, 13 Dec 2013 00:51:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=2PWECsVbVkzCgTZIZ0zEMTUPKRZ/sDIBatltw1+s/Sg=; b=l2UGF21oK7iq4YjI6Zqj88n113F1qPHl/n882hY6AGui3HYVzAxkZ5RxPgt/LRiUsM vf6N0eMBMGi/7UpQSonbmWwbvf26ETTaMomYcs4SCHnM3X9Slx64wi2O7+xwWUR4Sp3q rTHdQ3gAIFUE8sohAgC/Gb+ziGBR8AkVrFuFnzXNb+W4T0Kh7IoynVgyKT/bA42w+Hrz 82zCqng4BFM4XpCtI/o4DMA6MfuA5xCKuGO0+eMVLfyluA0h2ipaJ7fPplASZKqoR2YB 5yU7KzaJA97+z/iF7dgwW6wk405zFa6NHwTa9EZqVFKG+rPogiGuumywWy2hd20CHt1P A+UQ== MIME-Version: 1.0 X-Received: by 10.66.218.226 with SMTP id pj2mr1885467pac.62.1386924660174; Fri, 13 Dec 2013 00:51:00 -0800 (PST) Received: by 10.70.43.78 with HTTP; Fri, 13 Dec 2013 00:51:00 -0800 (PST) In-Reply-To: <20131212235642.8dbc2be8.akpm@linux-foundation.org> References: <1386893438-23573-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com> <20131212235642.8dbc2be8.akpm@linux-foundation.org> Date: Fri, 13 Dec 2013 09:51:00 +0100 X-Google-Sender-Auth: Cn8gxL8IzrRaK87wQb21UyE_uAs Message-ID: Subject: Re: [PATCH] sh: Add EXPORT_SYMBOL(min_low_pfn) and EXPORT_SYMBOL(max_low_pfn) to sh_ksyms_32.c From: Geert Uytterhoeven To: Andrew Morton Cc: Nobuhiro Iwamatsu , Paul Mundt , Linux-sh list Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Dec 13, 2013 at 8:56 AM, Andrew Morton wrote: > On Fri, 13 Dec 2013 09:10:38 +0900 Nobuhiro Iwamatsu wrote: > >> Min_low_pfn and max_low_pfn were used in pfn_valid macro if defined >> CONFIG_FLATMEM. When the functions that use the pfn_valid is used in driver >> module, max_low_pfn and min_low_pfn is to undefined, and fail to build. >> >> ---- >> ERROR: "min_low_pfn" [drivers/block/aoe/aoe.ko] undefined! >> ERROR: "max_low_pfn" [drivers/block/aoe/aoe.ko] undefined! > > This could be a sign that the aoe driver is doing something which it > shouldn't be doing. > > z:/usr/src/25> grep pfn drivers/block/aoe/*.[ch] > z:/usr/src/25> > > Confused. Can you please work out precisely where in AOE this > reference is occurring? From my patch for mips, it's due to virt_addr_valid(), which calls pfn_valid() on most architectures, cfr. http://marc.info/?l=linux-kernel&m=135672726823050&w=1. Note that Ralf decided to fix it differently, by uninlining virt_addr_valid: commit d3ce88431892b703b04769566338a89eda6b0477 Author: Ralf Baechle Date: Fri Dec 28 15:34:40 2012 +0100 MIPS: Fix modpost error in modules attepting to use virt_addr_valid(). ERROR: "min_low_pfn" [drivers/block/aoe/aoe.ko] undefined! Fixed by moving the implementation of virt_addr_valid() into the kernel proper and exporting it which removes the pains of an inline or macro implementation. Signed-off-by: Ralf Baechle BTW, ia64 exports both min_low_pfn and max_low_pfn, metag exports min_low_pfn. Gr{oetje,eeting}s, Geert Acked-by: Geert Uytterhoeven --- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index bf84e48ad669..dbaec94046da 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h @@ -198,7 +198,10 @@ typedef struct { unsigned long pgprot; } pgprot_t; #endif #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) -#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr))) + +extern int __virt_addr_valid(const volatile void *kaddr); +#define virt_addr_valid(kaddr) \ + __virt_addr_valid((const volatile void *) (kaddr)) #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c index cacfd31e8ec9..7657fd21cd3f 100644 --- a/arch/mips/mm/ioremap.c +++ b/arch/mips/mm/ioremap.c @@ -190,3 +190,9 @@ void __iounmap(const volatile void __iomem *addr) EXPORT_SYMBOL(__ioremap); EXPORT_SYMBOL(__iounmap); + +int __virt_addr_valid(const volatile void *kaddr) +{ + return pfn_valid(PFN_DOWN(virt_to_phys(kaddr))); +} +EXPORT_SYMBOL_GPL(__virt_addr_valid);