From 3940ba8eea8c6c89f547a1bd153977cece5fecd2 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 17 Aug 2019 09:32:41 +0200 Subject: asm-generic: don't provide __ioremap __ioremap is not a kernel API, but used for helpers with differing semantics in arch code. We should not provide it in as-generic. Signed-off-by: Christoph Hellwig Reviewed-by: Paul Walmsley Tested-by: Paul Walmsley # rv32, rv64 boot Acked-by: Paul Walmsley # arch/riscv Signed-off-by: Arnd Bergmann --- include/asm-generic/io.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include/asm-generic') diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index b83e2802c969..d02806513670 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -963,15 +963,6 @@ static inline void __iomem *ioremap(phys_addr_t offset, size_t size) } #endif -#ifndef __ioremap -#define __ioremap __ioremap -static inline void __iomem *__ioremap(phys_addr_t offset, size_t size, - unsigned long flags) -{ - return ioremap(offset, size); -} -#endif - #ifndef iounmap #define iounmap iounmap -- cgit v1.2.3 From 602828c1aade576ac5f3fbd59b4eb014c5fc2414 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 20 Aug 2019 23:05:42 -0400 Subject: __div64_const32(): improve the generic C version Let's rework that code to avoid large immediate values and convert some 64-bit variables to 32-bit ones when possible. This allows gcc to produce smaller and better code. This even produces optimal code on RISC-V. Signed-off-by: Nicolas Pitre Signed-off-by: Arnd Bergmann --- include/asm-generic/div64.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'include/asm-generic') diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h index dc9726fdac8f..33358245b4fa 100644 --- a/include/asm-generic/div64.h +++ b/include/asm-generic/div64.h @@ -178,7 +178,8 @@ static inline uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias) uint32_t m_hi = m >> 32; uint32_t n_lo = n; uint32_t n_hi = n >> 32; - uint64_t res, tmp; + uint64_t res; + uint32_t res_lo, res_hi, tmp; if (!bias) { res = ((uint64_t)m_lo * n_lo) >> 32; @@ -187,8 +188,9 @@ static inline uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias) res = (m + (uint64_t)m_lo * n_lo) >> 32; } else { res = m + (uint64_t)m_lo * n_lo; - tmp = (res < m) ? (1ULL << 32) : 0; - res = (res >> 32) + tmp; + res_lo = res >> 32; + res_hi = (res_lo < m_hi); + res = res_lo | ((uint64_t)res_hi << 32); } if (!(m & ((1ULL << 63) | (1ULL << 31)))) { @@ -197,10 +199,12 @@ static inline uint64_t __arch_xprod_64(const uint64_t m, uint64_t n, bool bias) res += (uint64_t)m_hi * n_lo; res >>= 32; } else { - tmp = res += (uint64_t)m_lo * n_hi; + res += (uint64_t)m_lo * n_hi; + tmp = res >> 32; res += (uint64_t)m_hi * n_lo; - tmp = (res < tmp) ? (1ULL << 32) : 0; - res = (res >> 32) + tmp; + res_lo = res >> 32; + res_hi = (res_lo < tmp); + res = res_lo | ((uint64_t)res_hi << 32); } res += (uint64_t)m_hi * n_hi; -- cgit v1.2.3 From 9b87647c665dbf93173ca2f43986902b59dfbbba Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Thu, 29 Aug 2019 00:09:34 +0300 Subject: asm-generic: add unlikely to default BUG_ON(x) Add unlikely to default BUG_ON(x) in !CONFIG_BUG. It makes the define consistent with BUG_ON(x) in CONFIG_BUG. Signed-off-by: Denis Efremov Cc: Arnd Bergmann Cc: Signed-off-by: Arnd Bergmann --- include/asm-generic/bug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/asm-generic') diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index aa6c093d9ce9..7357a3c942a0 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -185,7 +185,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint, #endif #ifndef HAVE_ARCH_BUG_ON -#define BUG_ON(condition) do { if (condition) BUG(); } while (0) +#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) #endif #ifndef HAVE_ARCH_WARN_ON -- cgit v1.2.3