Merge git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

* git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
  asm-generic: add sys_recvmmsg to unistd.h
  asm-generic: add sys_accept4 to unistd.h
  asm-generic/gpio.h: add some forward decls of the device struct
  asm-generic: Fix typo in asm-generic/unistd.h.
  lib/checksum: fix one more thinko
  lib/checksum.c: make do_csum optional
  lib/checksum.c: use 32-bit arithmetic consistently
This commit is contained in:
Linus Torvalds 2009-12-11 20:57:31 -08:00
commit a1c36e5206
3 changed files with 18 additions and 9 deletions

View file

@ -28,6 +28,7 @@ static inline int gpio_is_valid(int number)
return ((unsigned)number) < ARCH_NR_GPIOS; return ((unsigned)number) < ARCH_NR_GPIOS;
} }
struct device;
struct seq_file; struct seq_file;
struct module; struct module;
@ -181,6 +182,8 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
#ifndef CONFIG_GPIO_SYSFS #ifndef CONFIG_GPIO_SYSFS
struct device;
/* sysfs support is only available with gpiolib, where it's optional */ /* sysfs support is only available with gpiolib, where it's optional */
static inline int gpio_export(unsigned gpio, bool direction_may_change) static inline int gpio_export(unsigned gpio, bool direction_may_change)

View file

@ -622,9 +622,13 @@ __SYSCALL(__NR_move_pages, sys_move_pages)
__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) __SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
#define __NR_perf_event_open 241 #define __NR_perf_event_open 241
__SYSCALL(__NR_perf_event_open, sys_perf_event_open) __SYSCALL(__NR_perf_event_open, sys_perf_event_open)
#define __NR_accept4 242
__SYSCALL(__NR_accept4, sys_accept4)
#define __NR_recvmmsg 243
__SYSCALL(__NR_recvmmsg, sys_recvmmsg)
#undef __NR_syscalls #undef __NR_syscalls
#define __NR_syscalls 242 #define __NR_syscalls 244
/* /*
* All syscalls below here should go away really, * All syscalls below here should go away really,
@ -802,7 +806,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
#define __NR_statfs __NR3264_statfs #define __NR_statfs __NR3264_statfs
#define __NR_fstatfs __NR3264_fstatfs #define __NR_fstatfs __NR3264_fstatfs
#define __NR_truncate __NR3264_truncate #define __NR_truncate __NR3264_truncate
#define __NR_ftruncate __NR3264_truncate #define __NR_ftruncate __NR3264_ftruncate
#define __NR_lseek __NR3264_lseek #define __NR_lseek __NR3264_lseek
#define __NR_sendfile __NR3264_sendfile #define __NR_sendfile __NR3264_sendfile
#define __NR_newfstatat __NR3264_fstatat #define __NR_newfstatat __NR3264_fstatat
@ -818,7 +822,7 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
#define __NR_statfs64 __NR3264_statfs #define __NR_statfs64 __NR3264_statfs
#define __NR_fstatfs64 __NR3264_fstatfs #define __NR_fstatfs64 __NR3264_fstatfs
#define __NR_truncate64 __NR3264_truncate #define __NR_truncate64 __NR3264_truncate
#define __NR_ftruncate64 __NR3264_truncate #define __NR_ftruncate64 __NR3264_ftruncate
#define __NR_llseek __NR3264_lseek #define __NR_llseek __NR3264_lseek
#define __NR_sendfile64 __NR3264_sendfile #define __NR_sendfile64 __NR3264_sendfile
#define __NR_fstatat64 __NR3264_fstatat #define __NR_fstatat64 __NR3264_fstatat

View file

@ -37,7 +37,8 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
static inline unsigned short from32to16(unsigned long x) #ifndef do_csum
static inline unsigned short from32to16(unsigned int x)
{ {
/* add up 16-bit and 16-bit for 16+c bit */ /* add up 16-bit and 16-bit for 16+c bit */
x = (x & 0xffff) + (x >> 16); x = (x & 0xffff) + (x >> 16);
@ -49,16 +50,16 @@ static inline unsigned short from32to16(unsigned long x)
static unsigned int do_csum(const unsigned char *buff, int len) static unsigned int do_csum(const unsigned char *buff, int len)
{ {
int odd, count; int odd, count;
unsigned long result = 0; unsigned int result = 0;
if (len <= 0) if (len <= 0)
goto out; goto out;
odd = 1 & (unsigned long) buff; odd = 1 & (unsigned long) buff;
if (odd) { if (odd) {
#ifdef __LITTLE_ENDIAN #ifdef __LITTLE_ENDIAN
result = *buff;
#else
result += (*buff << 8); result += (*buff << 8);
#else
result = *buff;
#endif #endif
len--; len--;
buff++; buff++;
@ -73,9 +74,9 @@ static unsigned int do_csum(const unsigned char *buff, int len)
} }
count >>= 1; /* nr of 32-bit words.. */ count >>= 1; /* nr of 32-bit words.. */
if (count) { if (count) {
unsigned long carry = 0; unsigned int carry = 0;
do { do {
unsigned long w = *(unsigned int *) buff; unsigned int w = *(unsigned int *) buff;
count--; count--;
buff += 4; buff += 4;
result += carry; result += carry;
@ -102,6 +103,7 @@ static unsigned int do_csum(const unsigned char *buff, int len)
out: out:
return result; return result;
} }
#endif
/* /*
* This is a version of ip_compute_csum() optimized for IP headers, * This is a version of ip_compute_csum() optimized for IP headers,