Message ID | 20220429135108.2781579-68-schnelle@linux.ibm.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | Kconfig: Introduce HAS_IOPORT config option | expand |
On Fri, 2022-04-29 at 15:51 +0200, Niklas Schnelle wrote: > With all subsystems and drivers either declaring their dependence on > HAS_IOPORT or ifdeffing I/O port specific code sections we can finally > make inb()/outb() and friends compile-time dependent on HAS_IOPORT as > suggested by Linus in the linked mail. The main benefit of this is that > on platforms such as s390 which have no meaningful way of implementing > inb()/outb() their use without the proper HAS_IOPORT dependency will > result in easy to catch and fix compile-time errors instead of compiling > code that can never work. > > Link: https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/ > Co-developed-by: Arnd Bergmann <arnd@kernel.org> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> > --- Sorry everyone. I sent this as PATCH in error while preparing to sent the same series as RFC. Since e-mail has no remote delete and I lack a time machine let's just all pretend you only got the RFC.
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 7ce93aaf69f8..b2572b2eab07 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -448,6 +448,7 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer, #define IO_SPACE_LIMIT 0xffff #endif +#ifdef CONFIG_HAS_IOPORT /* * {in,out}{b,w,l}() access little endian I/O. {in,out}{b,w,l}_p() can be * implemented on hardware that needs an additional delay for I/O accesses to @@ -522,9 +523,12 @@ static inline void _outl(u32 value, unsigned long addr) __io_paw(); } #endif +#endif /* CONFIG_HAS_IOPORT */ #include <linux/logic_pio.h> +#ifdef CONFIG_HAS_IOPORT + #ifndef inb #define inb _inb #endif @@ -703,6 +707,7 @@ static inline void outsl_p(unsigned long addr, const void *buffer, outsl(addr, buffer, count); } #endif +#endif /* CONFIG_HAS_IOPORT */ #ifndef CONFIG_GENERIC_IOMAP #ifndef ioread8
With all subsystems and drivers either declaring their dependence on HAS_IOPORT or ifdeffing I/O port specific code sections we can finally make inb()/outb() and friends compile-time dependent on HAS_IOPORT as suggested by Linus in the linked mail. The main benefit of this is that on platforms such as s390 which have no meaningful way of implementing inb()/outb() their use without the proper HAS_IOPORT dependency will result in easy to catch and fix compile-time errors instead of compiling code that can never work. Link: https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/ Co-developed-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> --- include/asm-generic/io.h | 5 +++++ 1 file changed, 5 insertions(+)