Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659AbbFVQKI (ORCPT ); Mon, 22 Jun 2015 12:10:08 -0400 Received: from verein.lst.de ([213.95.11.211]:42837 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484AbbFVQKF (ORCPT ); Mon, 22 Jun 2015 12:10:05 -0400 Date: Mon, 22 Jun 2015 18:10:02 +0200 From: Christoph Hellwig To: Dan Williams Cc: arnd@arndb.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, tglx@linutronix.de, ross.zwisler@linux.intel.com, akpm@linux-foundation.org, jgross@suse.com, x86@kernel.org, toshi.kani@hp.com, linux-nvdimm@ml01.01.org, benh@kernel.crashing.org, mcgrof@suse.com, konrad.wilk@oracle.com, linux-kernel@vger.kernel.org, stefan.bader@canonical.com, luto@amacapital.net, linux-mm@kvack.org, geert@linux-m68k.org, ralf@linux-mips.org, hmh@hmh.eng.br, mpe@ellerman.id.au, tj@kernel.org, paulus@samba.org, hch@lst.de Subject: Re: [PATCH v5 2/6] arch: unify ioremap prototypes and macro aliases Message-ID: <20150622161002.GB8240@lst.de> References: <20150622081028.35954.89885.stgit@dwillia2-desk3.jf.intel.com> <20150622082427.35954.73529.stgit@dwillia2-desk3.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150622082427.35954.73529.stgit@dwillia2-desk3.jf.intel.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2983 Lines: 82 On Mon, Jun 22, 2015 at 04:24:27AM -0400, Dan Williams wrote: > Some archs define the first parameter to ioremap() as unsigned long, > while the balance define it as resource_size_t. Unify on > resource_size_t to enable passing ioremap function pointers. Also, some > archs use function-like macros for defining ioremap aliases, but > asm-generic/io.h expects object-like macros, unify on the latter. > > Move all handling of ioremap aliasing (i.e. ioremap_wt => ioremap) to > include/linux/io.h. Add a check to include/linux/io.h to warn at > compile time if an arch violates expectations. > > Kill ARCH_HAS_IOREMAP_WC and ARCH_HAS_IOREMAP_WT in favor of just > testing for ioremap_wc, and ioremap_wt being defined. This arrangement > allows drivers to know when ioremap_ are being re-directed to plain > ioremap. > > Reported-by: kbuild test robot > Signed-off-by: Dan Williams Hmm, this is quite a bit of churn, and doesn't make the interface lot more obvious. I guess it's enough to get the pmem related bits going, but I'd really prefer defining the ioremap* prototype in linux/io.h and requiring and out of line implementation in the architectures, it's not like it's a fast path. And to avoid the ifdef mess make it something like: void __iomem *ioremap_flags(resource_size_t offset, unsigned long size, unsigned long prot_val, unsigned flags); static inline void __iomem *ioremap(resource_size_t offset, unsigned long size) { return ioremap_flags(offset, size, 0, 0); } static inline void __iomem *ioremap_prot(resource_size_t offset, unsigned long size, unsigned long prot_val) { return ioremap_flags(offset, size, prot_val, 0); } static inline void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size) { return ioremap_flags(offset, size, 0, IOREMAP_NOCACHE); } static inline void __iomem *ioremap_cache(resource_size_t offset, unsigned long size) { return ioremap_flags(offset, size, 0, IOREMAP_CACHE); } static inline void __iomem *ioremap_uc(resource_size_t offset, unsigned long size) { return ioremap_flags(offset, size, 0, IOREMAP_UC); } static inline void __iomem *ioremap_wc(resource_size_t offset, unsigned long size) { return ioremap_flags(offset, size, 0, IOREMAP_WC); } static inline void __iomem *ioremap_wt(resource_size_t offset, unsigned long size) { return ioremap_flags(offset, size, 0, IOREMAP_WT); } With all wrappers but ioremap() itself deprecated in the long run. Besides following the one API one prototype guideline this gives us one proper entry point for all the variants. Additionally it can reject non-supported caching modes at run time, e.g. because different hardware may or may not support it. Additionally it avoids the need for all these HAVE_IOREMAP_FOO defines, which need constant updating. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/