Merge tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic cleanups from Arnd Bergmann: "The asm-generic changes for 4.4 are mostly a series from Christoph Hellwig to clean up various abuses of headers in there. The patch to rename the io-64-nonatomic-*.h headers caused some conflicts with new users, so I added a workaround that we can remove in the next merge window. The only other patch is a warning fix from Marek Vasut" * tag 'asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: asm-generic: temporarily add back asm-generic/io-64-nonatomic*.h asm-generic: cmpxchg: avoid warnings from macro-ized cmpxchg() implementations gpio-mxc: stop including <asm-generic/bug> n_tracesink: stop including <asm-generic/bug> n_tracerouter: stop including <asm-generic/bug> mlx5: stop including <asm-generic/kmap_types.h> hifn_795x: stop including <asm-generic/kmap_types.h> drbd: stop including <asm-generic/kmap_types.h> move count_zeroes.h out of asm-generic move io-64-nonatomic*.h out of asm-generic
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
/* Count leading and trailing zeros functions
|
||||
*
|
||||
* Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public Licence
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the Licence, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_
|
||||
#define _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_
|
||||
|
||||
#include <asm/bitops.h>
|
||||
|
||||
/**
|
||||
* count_leading_zeros - Count the number of zeros from the MSB back
|
||||
* @x: The value
|
||||
*
|
||||
* Count the number of leading zeros from the MSB going towards the LSB in @x.
|
||||
*
|
||||
* If the MSB of @x is set, the result is 0.
|
||||
* If only the LSB of @x is set, then the result is BITS_PER_LONG-1.
|
||||
* If @x is 0 then the result is COUNT_LEADING_ZEROS_0.
|
||||
*/
|
||||
static inline int count_leading_zeros(unsigned long x)
|
||||
{
|
||||
if (sizeof(x) == 4)
|
||||
return BITS_PER_LONG - fls(x);
|
||||
else
|
||||
return BITS_PER_LONG - fls64(x);
|
||||
}
|
||||
|
||||
#define COUNT_LEADING_ZEROS_0 BITS_PER_LONG
|
||||
|
||||
/**
|
||||
* count_trailing_zeros - Count the number of zeros from the LSB forwards
|
||||
* @x: The value
|
||||
*
|
||||
* Count the number of trailing zeros from the LSB going towards the MSB in @x.
|
||||
*
|
||||
* If the LSB of @x is set, the result is 0.
|
||||
* If only the MSB of @x is set, then the result is BITS_PER_LONG-1.
|
||||
* If @x is 0 then the result is COUNT_TRAILING_ZEROS_0.
|
||||
*/
|
||||
static inline int count_trailing_zeros(unsigned long x)
|
||||
{
|
||||
#define COUNT_TRAILING_ZEROS_0 (-1)
|
||||
|
||||
if (sizeof(x) == 4)
|
||||
return ffs(x);
|
||||
else
|
||||
return (x != 0) ? __ffs(x) : COUNT_TRAILING_ZEROS_0;
|
||||
}
|
||||
|
||||
#endif /* _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_ */
|
@@ -79,8 +79,10 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
|
||||
}
|
||||
}
|
||||
|
||||
#define xchg(ptr, x) \
|
||||
((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
|
||||
#define xchg(ptr, x) ({ \
|
||||
((__typeof__(*(ptr))) \
|
||||
__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))); \
|
||||
})
|
||||
|
||||
#endif /* xchg */
|
||||
|
||||
@@ -90,9 +92,10 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
|
||||
#include <asm-generic/cmpxchg-local.h>
|
||||
|
||||
#ifndef cmpxchg_local
|
||||
#define cmpxchg_local(ptr, o, n) \
|
||||
#define cmpxchg_local(ptr, o, n) ({ \
|
||||
((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
|
||||
(unsigned long)(n), sizeof(*(ptr))))
|
||||
(unsigned long)(n), sizeof(*(ptr)))); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifndef cmpxchg64_local
|
||||
|
@@ -1,32 +1,2 @@
|
||||
#ifndef _ASM_IO_64_NONATOMIC_HI_LO_H_
|
||||
#define _ASM_IO_64_NONATOMIC_HI_LO_H_
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <asm-generic/int-ll64.h>
|
||||
|
||||
static inline __u64 hi_lo_readq(const volatile void __iomem *addr)
|
||||
{
|
||||
const volatile u32 __iomem *p = addr;
|
||||
u32 low, high;
|
||||
|
||||
high = readl(p + 1);
|
||||
low = readl(p);
|
||||
|
||||
return low + ((u64)high << 32);
|
||||
}
|
||||
|
||||
static inline void hi_lo_writeq(__u64 val, volatile void __iomem *addr)
|
||||
{
|
||||
writel(val >> 32, addr + 4);
|
||||
writel(val, addr);
|
||||
}
|
||||
|
||||
#ifndef readq
|
||||
#define readq hi_lo_readq
|
||||
#endif
|
||||
|
||||
#ifndef writeq
|
||||
#define writeq hi_lo_writeq
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_IO_64_NONATOMIC_HI_LO_H_ */
|
||||
/* XXX: delete asm-generic/io-64-nonatomic-hi-lo.h after converting new users */
|
||||
#include <linux/io-64-nonatomic-hi-lo.h>
|
||||
|
@@ -1,32 +1,2 @@
|
||||
#ifndef _ASM_IO_64_NONATOMIC_LO_HI_H_
|
||||
#define _ASM_IO_64_NONATOMIC_LO_HI_H_
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <asm-generic/int-ll64.h>
|
||||
|
||||
static inline __u64 lo_hi_readq(const volatile void __iomem *addr)
|
||||
{
|
||||
const volatile u32 __iomem *p = addr;
|
||||
u32 low, high;
|
||||
|
||||
low = readl(p);
|
||||
high = readl(p + 1);
|
||||
|
||||
return low + ((u64)high << 32);
|
||||
}
|
||||
|
||||
static inline void lo_hi_writeq(__u64 val, volatile void __iomem *addr)
|
||||
{
|
||||
writel(val, addr);
|
||||
writel(val >> 32, addr + 4);
|
||||
}
|
||||
|
||||
#ifndef readq
|
||||
#define readq lo_hi_readq
|
||||
#endif
|
||||
|
||||
#ifndef writeq
|
||||
#define writeq lo_hi_writeq
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_IO_64_NONATOMIC_LO_HI_H_ */
|
||||
/* XXX: delete asm-generic/io-64-nonatomic-lo-hi.h after converting new users */
|
||||
#include <linux/io-64-nonatomic-lo-hi.h>
|
||||
|
Reference in New Issue
Block a user