From patchwork Tue Feb 9 17:21:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 61574 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp2171384lbl; Tue, 9 Feb 2016 09:22:08 -0800 (PST) X-Received: by 10.66.147.136 with SMTP id tk8mr52177484pab.157.1455038527869; Tue, 09 Feb 2016 09:22:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tg6si55224361pab.0.2016.02.09.09.22.07; Tue, 09 Feb 2016 09:22:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932872AbcBIRWF (ORCPT + 30 others); Tue, 9 Feb 2016 12:22:05 -0500 Received: from foss.arm.com ([217.140.101.70]:41949 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754995AbcBIRWB (ORCPT ); Tue, 9 Feb 2016 12:22:01 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39D0349; Tue, 9 Feb 2016 09:21:14 -0800 (PST) Received: from leverpostej (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 988763F21A; Tue, 9 Feb 2016 09:21:58 -0800 (PST) Date: Tue, 9 Feb 2016 17:21:26 +0000 From: Mark Rutland To: Catalin Marinas Cc: kbuild test robot , kbuild-all@01.org, Geert Uytterhoeven , Arnd Bergmann , Sudip Mukherjee , Stephen Rothwell , Linux-Next , "linux-kernel@vger.kernel.org" , Ard Biesheuvel , Jeremy Linton , Linux-Arch , Laura Abbott , Jeff Dike , Richard Weinberger Subject: Re: [PATCH] asm-generic: Fix build when __set_fixmap is absent Message-ID: <20160209172125.GA4348@leverpostej> References: <20160209143554.GA9332@leverpostej> <201602100053.LjML6D6b%fengguang.wu@intel.com> <20160209163333.GA22110@leverpostej> <20160209165234.GI16122@e104818-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160209165234.GI16122@e104818-lin.cambridge.arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 09, 2016 at 04:52:34PM +0000, Catalin Marinas wrote: > On Tue, Feb 09, 2016 at 04:33:34PM +0000, Mark Rutland wrote: > > > >> include/asm-generic/fixmap.h:72:6: error: conflicting types for '__set_fixmap' > > > void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot); > > > ^ > > > In file included from arch/um/include/asm/pgtable.h:11:0, > > > from include/linux/mm.h:67, > > > from include/linux/ring_buffer.h:5, > > > from include/linux/trace_events.h:5, > > > from include/trace/syscall.h:6, > > > from include/linux/syscalls.h:81, > > > from init/main.c:18: > > > arch/um/include/asm/fixmap.h:39:13: note: previous declaration of '__set_fixmap' was here > > > extern void __set_fixmap (enum fixed_addresses idx, > > > ^ > > > > The conflict is the type of 'phys'. In arch/um that's an unsigned long > > rather than a phys_addr_t as it is elsewhere. > > At a quick grep, we also have: > > arch/sh/include/asm/fixmap.h > arch/sh/mm/init.c > arch/sh/mm/nommu.c > > > If I convert that to a phys_addr_t the build goes along happily. > > > > Should we change set_fixmap_offset back to a macro function for now, or > > is it simple/correct to change arch/um to use phys_addr_t in > > __set_fixmap? > > And sh. I prefer the static inline, though there is more effort needed > to test and get acks ;) (I really don't mind either way). I would also prefer to make this a static inline, but it looks like we need to sort out some cross-architecture cleanup first. I'm happy to have a go at that. In the meantime, so as to allow linux-next to build, and to save us from merge hell, let's follow the usual idiom and hope that underscores will protect us. Hopefully this is the last time I ask this today: Arnd, Catalin, are you happy with the below patch? Mark. ---->8---- >From 6d283603d18071690dc138e4a0591a445a1d1e30 Mon Sep 17 00:00:00 2001 From: Mark Rutland Date: Tue, 9 Feb 2016 17:08:26 +0000 Subject: [PATCH] asm-generic: make __set_fixmap_offset a macro again Turning __set_fixmap_offset into a static inline breaks the build for several architectures. Fixing this properly requires updates to a number of architectures to make them agree on the prototype of __set_fixmap. For the timebeing, restore __set_fixmap_offset to its prior state as a macro function, reverting commit ac4c0ac73485867c ("asm-generic: make __set_fixmap_offset a static inline"). To avoid the original issue with namespace clashes, 'addr' is prefixed with a liberal sprinking of underscores. Signed-off-by: Mark Rutland Cc: Arnd Bergmann Cc: Catalin Marinas --- include/asm-generic/fixmap.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 1.9.1 diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h index f9c27b6..827e4d3 100644 --- a/include/asm-generic/fixmap.h +++ b/include/asm-generic/fixmap.h @@ -70,13 +70,13 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) #endif /* Return a pointer with offset calculated */ -static inline unsigned long __set_fixmap_offset(enum fixed_addresses idx, - phys_addr_t phys, - pgprot_t flags) -{ - __set_fixmap(idx, phys, flags); - return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1)); -} +#define __set_fixmap_offset(idx, phys, flags) \ +({ \ + unsigned long ________addr; \ + __set_fixmap(idx, phys, flags); \ + ________addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ + ________addr; \ +}) #define set_fixmap_offset(idx, phys) \ __set_fixmap_offset(idx, phys, FIXMAP_PAGE_NORMAL)