[PATCH 4/6] uaccess: remove segment_eq
Greentime Hu
green.hu at gmail.com
Mon Jul 13 06:05:10 EDT 2020
Christoph Hellwig <hch at lst.de> 於 2020年7月10日 週五 下午9:57寫道:
>
> segment_eq is only used to implement uaccess_kernel. Just open code
> uaccess_kernel in the arch uaccess headers and remove one layer of
> indirection.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> arch/alpha/include/asm/uaccess.h | 2 +-
> arch/arc/include/asm/segment.h | 3 +--
> arch/arm/include/asm/uaccess.h | 4 ++--
> arch/arm64/include/asm/uaccess.h | 2 +-
> arch/csky/include/asm/segment.h | 2 +-
> arch/h8300/include/asm/segment.h | 2 +-
> arch/ia64/include/asm/uaccess.h | 2 +-
> arch/m68k/include/asm/segment.h | 2 +-
> arch/microblaze/include/asm/uaccess.h | 2 +-
> arch/mips/include/asm/uaccess.h | 2 +-
> arch/nds32/include/asm/uaccess.h | 2 +-
> arch/nios2/include/asm/uaccess.h | 2 +-
> arch/openrisc/include/asm/uaccess.h | 2 +-
> arch/parisc/include/asm/uaccess.h | 2 +-
> arch/powerpc/include/asm/uaccess.h | 3 +--
> arch/riscv/include/asm/uaccess.h | 4 +---
> arch/s390/include/asm/uaccess.h | 2 +-
> arch/sh/include/asm/segment.h | 3 +--
> arch/sparc/include/asm/uaccess_32.h | 2 +-
> arch/sparc/include/asm/uaccess_64.h | 2 +-
> arch/x86/include/asm/uaccess.h | 2 +-
> arch/xtensa/include/asm/uaccess.h | 2 +-
> include/asm-generic/uaccess.h | 4 ++--
> include/linux/uaccess.h | 2 --
> 24 files changed, 25 insertions(+), 32 deletions(-)
>
[...]
> diff --git a/arch/nds32/include/asm/uaccess.h b/arch/nds32/include/asm/uaccess.h
> index 3a9219f53ee0d8..010ba5f1d7dd6b 100644
> --- a/arch/nds32/include/asm/uaccess.h
> +++ b/arch/nds32/include/asm/uaccess.h
> @@ -44,7 +44,7 @@ static inline void set_fs(mm_segment_t fs)
> current_thread_info()->addr_limit = fs;
> }
>
> -#define segment_eq(a, b) ((a) == (b))
> +#define uaccess_kernel() (get_fs() == KERNEL_DS)
>
> #define __range_ok(addr, size) (size <= get_fs() && addr <= (get_fs() -size))
>
Hi Christoph, Thank you.
Acked-by: Greentime Hu <green.hu at gmail.com>
More information about the linux-riscv
mailing list