From: Christoph Hellwig Date: Mon, 21 Sep 2020 06:28:19 +0000 Subject: Re: [patch RFC 02/15] highmem: Provide generic variant of kmap_atomic* Message-Id: <20200921062819.GB32081@infradead.org> List-Id: References: <20200919091751.011116649@linutronix.de> <20200919092615.990731525@linutronix.de> In-Reply-To: <20200919092615.990731525@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Thomas Gleixner Cc: Juri Lelli , Peter Zijlstra , Benjamin Herrenschmidt , Sebastian Andrzej Siewior , dri-devel , linux-mips@vger.kernel.org, Ben Segall , Max Filippov , Guo Ren , sparclinux@vger.kernel.org, Vincent Chen , Will Deacon , Ard Biesheuvel , linux-arch@vger.kernel.org, Herbert Xu , Michael Ellerman , x86@kernel.org, Russell King , linux-csky@vger.kernel.org, David Airlie , Mel Gorman , linux-snps-arc@lists.infradead.org, linux-xtensa@linux-xtensa.org, Paul McKenney , intel-gfx , linuxppc-dev@lists.ozlabs.org, Steven Rostedt , Linus Torvalds , Dietmar Eggemann , Linux ARM , Chris Zankel , Michal Simek , Thomas Bogendoerfer , Nick Hu , Linux-MM , Vineet Gupta , LKML , Arnd Bergmann , Paul Mackerras , Andrew Morton , Daniel Bristot de Oliveira , "David S. Miller" , Greentime Hu > +# ifndef ARCH_NEEDS_KMAP_HIGH_GET > +static inline void *arch_kmap_temporary_high_get(struct page *page) > +{ > + return NULL; > +} > +# endif Turn this into a macro and use #ifndef on the symbol name? > +static inline void __kunmap_atomic(void *addr) > +{ > + kumap_atomic_indexed(addr); > +} > + > + > +#endif /* CONFIG_KMAP_ATOMIC_GENERIC */ Stange double empty line above the endif. > -#define kunmap_atomic(addr) \ > -do { \ > - BUILD_BUG_ON(__same_type((addr), struct page *)); \ > - kunmap_atomic_high(addr); \ > - pagefault_enable(); \ > - preempt_enable(); \ > -} while (0) > - > +#define kunmap_atomic(addr) \ > + do { \ > + BUILD_BUG_ON(__same_type((addr), struct page *)); \ > + __kunmap_atomic(addr); \ > + preempt_enable(); \ > + } while (0) Why the strange re-indent to a form that is much less common and less readable? > +void *kmap_atomic_pfn_prot(unsigned long pfn, pgprot_t prot) > +{ > + pagefault_disable(); > + return __kmap_atomic_pfn_prot(pfn, prot); > +} > +EXPORT_SYMBOL(kmap_atomic_pfn_prot); The existing kmap_atomic_pfn & co implementation is EXPORT_SYMBOL_GPL, and this stuff should preferably stay that way.