asm-generic changes for v5.4

Here are three small cleanup patches for the include/asm-generic
 directory. Christoph removes the __ioremap as part of a cleanup,
 Nico improves the constant do_div() optimization, and Denis
 changes BUG_ON() to be consistent with other implementations.
 
 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJdf97EAAoJEJpsee/mABjZwTAP+wXle7qDBAkT+ddDwJ9IM+5x
 j3oJ/eo4YN3II20xTbjmPfXBByb4sBnyZ1EWMtkwcMTjTbyuEwRLOHy810NWn0Yc
 zKfrUGuPN2J54WGbEtzlCSf5hWOPdYij2JbkqZmwbCgnn4vHWOtOlL0m7RZ4sKWt
 PjjdjZ+7B7ZdVIqkwCmyv7kY+0IQtdekjQDeqXSmoNeT2zeLS/5Di3inD53mi3Q0
 1B6Eh1VEETqnnFke3GtHr5euo2EzglNnOpIP5V0VyN/t0HSz4mD9ZwGdANKPUij7
 NSNUpCkbyvU6TNY82TMDP81mGH/QBF9Dy/1SKHFc258VJvLcB3Dtdp47fS9rYZ/N
 XqxKZ+BVhZSdDV9JKJXX1Bl4vwP6IOF8LalQM50qOIw2kdxA8ZDJ17CPQ3a4kM6Y
 QBNepCTIPZdjXpT5OaJdQiX8prsRMEBiD7I+Z9kO54ImHt94IB2MeZqMuuFG0GmL
 /o3Ia1FYd2TF3SWHCxe2n2kFsLxQFvtwGP7zPvQpjl0Bh1UGEo0XhBERVe5sKkGm
 xYfzXAbi38R6mY25lsqie7ibUQTY6Z2ZFYK5km9oGiAyNO0r9ioy56ROPWxZG2Kv
 f74cQiEIORfc5ePz17NRsD8Mppe0g9lSwZ1RV29GtnaXNLET6gnxGQDLdzvitgF4
 ZWPIGg+qOM9fmrxdNdCr
 =9VXy
 -----END PGP SIGNATURE-----

Merge tag 'asm-generic-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull asm-generic updates from Arnd Bergmann:
 "Here are three small cleanup patches for the include/asm-generic
  directory.

  Christoph removes the __ioremap as part of a cleanup, Nico improves
  the constant do_div() optimization, and Denis changes BUG_ON() to be
  consistent with other implementations"

* tag 'asm-generic-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
  asm-generic: add unlikely to default BUG_ON(x)
  __div64_const32(): improve the generic C version
  asm-generic: don't provide __ioremap
This commit is contained in:
Linus Torvalds 2019-09-17 14:30:30 -07:00
commit b8456f9459
3 changed files with 11 additions and 16 deletions

View File

@ -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

View File

@ -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;

View File

@ -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