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 @@
* the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above ffz (man ffs).
*/
static __always_inline int ffs(int x)
{
return __builtin_ffs(x);
}
#define ffs(x) __builtin_ffs(x)
#endif
......@@ -37,7 +37,7 @@ extern void queued_write_lock_slowpath(struct qrwlock *lock);
*/
static inline int queued_read_trylock(struct qrwlock *lock)
{
u32 cnts;
int cnts;
cnts = atomic_read(&lock->cnts);
if (likely(!(cnts & _QW_WMASK))) {
......@@ -56,7 +56,7 @@ static inline int queued_read_trylock(struct qrwlock *lock)
*/
static inline int queued_write_trylock(struct qrwlock *lock)
{
u32 cnts;
int cnts;
cnts = atomic_read(&lock->cnts);
if (unlikely(cnts))
......@@ -71,7 +71,7 @@ static inline int queued_write_trylock(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);
if (likely(!(cnts & _QW_WMASK)))
......@@ -87,7 +87,7 @@ static inline void queued_read_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. */
if (likely(atomic_try_cmpxchg_acquire(&lock->cnts, &cnts, _QW_LOCKED)))
return;
......
......@@ -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)
{
u32 val = atomic_read(&lock->val);
int val = atomic_read(&lock->val);
if (unlikely(val))
return 0;
......@@ -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)
{
u32 val = 0;
int val = 0;
if (likely(atomic_try_cmpxchg_acquire(&lock->val, &val, _Q_LOCKED_VAL)))
return;
......
......@@ -64,6 +64,17 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
/* Attributes */
#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. */
#ifdef __clang__
#include <linux/compiler-clang.h>
......
......@@ -2,6 +2,8 @@
#ifndef _LINUX_CTYPE_H
#define _LINUX_CTYPE_H
#include <linux/compiler.h>
/*
* NOTE! This ctype does not handle EOF like the standard C
* library is required to.
......@@ -23,10 +25,6 @@ extern const unsigned char _ctype[];
#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
#define isalpha(c) ((__ismask(c)&(_U|_L)) != 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 islower(c) ((__ismask(c)&(_L)) != 0)
#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
......@@ -39,6 +37,15 @@ static inline int isdigit(int c)
#define isascii(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)
{
if (isupper(c))
......
......@@ -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_time32(struct old_timex32 __user *txc_p);
/* kernel/timer.c */
/* kernel/sys.c */
asmlinkage long sys_getpid(void);
asmlinkage long sys_getppid(void);
asmlinkage long sys_getuid(void);
......
......@@ -6,9 +6,9 @@
#include <asm/ipcbuf.h>
/*
* The semid64_ds structure for x86 architecture.
* Note extra padding because this structure is passed back and forth
* between kernel and user space.
* The semid64_ds structure for most architectures (though it came from x86_32
* originally). Note extra padding because this structure is passed back and
* forth between kernel and user space.
*
* semid64_ds was originally meant to be architecture specific, but
* everyone just ended up making identical copies without specific
......
......@@ -517,7 +517,7 @@ __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
__SC_3264(__NR_adjtimex, sys_adjtimex_time32, sys_adjtimex)
#endif
/* kernel/timer.c */
/* kernel/sys.c */
#define __NR_getpid 172
__SYSCALL(__NR_getpid, sys_getpid)
#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