Commit e2dc4957 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'asm-generic-cleanup-5.11' of...

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

Pull asm-generic cleanups from Arnd Bergmann:
 "These are a couple of compiler warning fixes to make 'make W=2' less
  noisy, as well as some fixes to code comments in asm-generic"

* tag 'asm-generic-cleanup-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
  syscalls: Fix file comments for syscalls implemented in kernel/sys.c
  ctype.h: remove duplicate isdigit() helper
  qspinlock: use signed temporaries for cmpxchg
  asm-generic: fix ffs -Wshadow warning
  asm-generic: percpu: avoid Wshadow warning
  asm-generic/sembuf: Update architecture related information in comment
parents f986e350 8d0dd23c
...@@ -10,9 +10,6 @@ ...@@ -10,9 +10,6 @@
* the libc and compiler builtin ffs routines, therefore * the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above ffz (man ffs). * differs in spirit from the above ffz (man ffs).
*/ */
static __always_inline int ffs(int x) #define ffs(x) __builtin_ffs(x)
{
return __builtin_ffs(x);
}
#endif #endif
...@@ -37,7 +37,7 @@ extern void queued_write_lock_slowpath(struct qrwlock *lock); ...@@ -37,7 +37,7 @@ extern void queued_write_lock_slowpath(struct qrwlock *lock);
*/ */
static inline int queued_read_trylock(struct qrwlock *lock) static inline int queued_read_trylock(struct qrwlock *lock)
{ {
u32 cnts; int cnts;
cnts = atomic_read(&lock->cnts); cnts = atomic_read(&lock->cnts);
if (likely(!(cnts & _QW_WMASK))) { if (likely(!(cnts & _QW_WMASK))) {
...@@ -56,7 +56,7 @@ static inline int queued_read_trylock(struct qrwlock *lock) ...@@ -56,7 +56,7 @@ static inline int queued_read_trylock(struct qrwlock *lock)
*/ */
static inline int queued_write_trylock(struct qrwlock *lock) static inline int queued_write_trylock(struct qrwlock *lock)
{ {
u32 cnts; int cnts;
cnts = atomic_read(&lock->cnts); cnts = atomic_read(&lock->cnts);
if (unlikely(cnts)) if (unlikely(cnts))
...@@ -71,7 +71,7 @@ static inline int queued_write_trylock(struct qrwlock *lock) ...@@ -71,7 +71,7 @@ static inline int queued_write_trylock(struct qrwlock *lock)
*/ */
static inline void queued_read_lock(struct qrwlock *lock) static inline void queued_read_lock(struct qrwlock *lock)
{ {
u32 cnts; int cnts;
cnts = atomic_add_return_acquire(_QR_BIAS, &lock->cnts); cnts = atomic_add_return_acquire(_QR_BIAS, &lock->cnts);
if (likely(!(cnts & _QW_WMASK))) if (likely(!(cnts & _QW_WMASK)))
...@@ -87,7 +87,7 @@ static inline void queued_read_lock(struct qrwlock *lock) ...@@ -87,7 +87,7 @@ static inline void queued_read_lock(struct qrwlock *lock)
*/ */
static inline void queued_write_lock(struct qrwlock *lock) static inline void queued_write_lock(struct qrwlock *lock)
{ {
u32 cnts = 0; int cnts = 0;
/* Optimize for the unfair lock case where the fair flag is 0. */ /* Optimize for the unfair lock case where the fair flag is 0. */
if (likely(atomic_try_cmpxchg_acquire(&lock->cnts, &cnts, _QW_LOCKED))) if (likely(atomic_try_cmpxchg_acquire(&lock->cnts, &cnts, _QW_LOCKED)))
return; return;
......
...@@ -60,7 +60,7 @@ static __always_inline int queued_spin_is_contended(struct qspinlock *lock) ...@@ -60,7 +60,7 @@ static __always_inline int queued_spin_is_contended(struct qspinlock *lock)
*/ */
static __always_inline int queued_spin_trylock(struct qspinlock *lock) static __always_inline int queued_spin_trylock(struct qspinlock *lock)
{ {
u32 val = atomic_read(&lock->val); int val = atomic_read(&lock->val);
if (unlikely(val)) if (unlikely(val))
return 0; return 0;
...@@ -77,7 +77,7 @@ extern void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val); ...@@ -77,7 +77,7 @@ extern void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val);
*/ */
static __always_inline void queued_spin_lock(struct qspinlock *lock) static __always_inline void queued_spin_lock(struct qspinlock *lock)
{ {
u32 val = 0; int val = 0;
if (likely(atomic_try_cmpxchg_acquire(&lock->val, &val, _Q_LOCKED_VAL))) if (likely(atomic_try_cmpxchg_acquire(&lock->val, &val, _Q_LOCKED_VAL)))
return; return;
......
...@@ -64,6 +64,17 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { } ...@@ -64,6 +64,17 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
/* Attributes */ /* Attributes */
#include <linux/compiler_attributes.h> #include <linux/compiler_attributes.h>
/* Builtins */
/*
* __has_builtin is supported on gcc >= 10, clang >= 3 and icc >= 21.
* In the meantime, to support gcc < 10, we implement __has_builtin
* by hand.
*/
#ifndef __has_builtin
#define __has_builtin(x) (0)
#endif
/* Compiler specific macros. */ /* Compiler specific macros. */
#ifdef __clang__ #ifdef __clang__
#include <linux/compiler-clang.h> #include <linux/compiler-clang.h>
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#ifndef _LINUX_CTYPE_H #ifndef _LINUX_CTYPE_H
#define _LINUX_CTYPE_H #define _LINUX_CTYPE_H
#include <linux/compiler.h>
/* /*
* NOTE! This ctype does not handle EOF like the standard C * NOTE! This ctype does not handle EOF like the standard C
* library is required to. * library is required to.
...@@ -23,10 +25,6 @@ extern const unsigned char _ctype[]; ...@@ -23,10 +25,6 @@ extern const unsigned char _ctype[];
#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
#define iscntrl(c) ((__ismask(c)&(_C)) != 0) #define iscntrl(c) ((__ismask(c)&(_C)) != 0)
static inline int isdigit(int c)
{
return '0' <= c && c <= '9';
}
#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
#define islower(c) ((__ismask(c)&(_L)) != 0) #define islower(c) ((__ismask(c)&(_L)) != 0)
#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
...@@ -39,6 +37,15 @@ static inline int isdigit(int c) ...@@ -39,6 +37,15 @@ static inline int isdigit(int c)
#define isascii(c) (((unsigned char)(c))<=0x7f) #define isascii(c) (((unsigned char)(c))<=0x7f)
#define toascii(c) (((unsigned char)(c))&0x7f) #define toascii(c) (((unsigned char)(c))&0x7f)
#if __has_builtin(__builtin_isdigit)
#define isdigit(c) __builtin_isdigit(c)
#else
static inline int isdigit(int c)
{
return '0' <= c && c <= '9';
}
#endif
static inline unsigned char __tolower(unsigned char c) static inline unsigned char __tolower(unsigned char c)
{ {
if (isupper(c)) if (isupper(c))
......
...@@ -744,7 +744,7 @@ asmlinkage long sys_settimeofday(struct __kernel_old_timeval __user *tv, ...@@ -744,7 +744,7 @@ asmlinkage long sys_settimeofday(struct __kernel_old_timeval __user *tv,
asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p); asmlinkage long sys_adjtimex(struct __kernel_timex __user *txc_p);
asmlinkage long sys_adjtimex_time32(struct old_timex32 __user *txc_p); asmlinkage long sys_adjtimex_time32(struct old_timex32 __user *txc_p);
/* kernel/timer.c */ /* kernel/sys.c */
asmlinkage long sys_getpid(void); asmlinkage long sys_getpid(void);
asmlinkage long sys_getppid(void); asmlinkage long sys_getppid(void);
asmlinkage long sys_getuid(void); asmlinkage long sys_getuid(void);
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
#include <asm/ipcbuf.h> #include <asm/ipcbuf.h>
/* /*
* The semid64_ds structure for x86 architecture. * The semid64_ds structure for most architectures (though it came from x86_32
* Note extra padding because this structure is passed back and forth * originally). Note extra padding because this structure is passed back and
* between kernel and user space. * forth between kernel and user space.
* *
* semid64_ds was originally meant to be architecture specific, but * semid64_ds was originally meant to be architecture specific, but
* everyone just ended up making identical copies without specific * everyone just ended up making identical copies without specific
......
...@@ -517,7 +517,7 @@ __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday) ...@@ -517,7 +517,7 @@ __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
__SC_3264(__NR_adjtimex, sys_adjtimex_time32, sys_adjtimex) __SC_3264(__NR_adjtimex, sys_adjtimex_time32, sys_adjtimex)
#endif #endif
/* kernel/timer.c */ /* kernel/sys.c */
#define __NR_getpid 172 #define __NR_getpid 172
__SYSCALL(__NR_getpid, sys_getpid) __SYSCALL(__NR_getpid, sys_getpid)
#define __NR_getppid 173 #define __NR_getppid 173
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment