-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sh: make copy_to/from_user() static inline
This patch changes copy_from_user() and copy_to_user() from macros into static inline functions. This way we can use them as function pointers. Also unify the 64 bit and 32 bit versions. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
- Loading branch information
Magnus Damm
authored and
Paul Mundt
committed
Feb 14, 2008
1 parent
960c65e
commit 1e6760c
Showing
3 changed files
with
32 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,34 @@ | ||
#ifndef __ASM_SH_UACCESS_H | ||
#define __ASM_SH_UACCESS_H | ||
|
||
#ifdef CONFIG_SUPERH32 | ||
# include "uaccess_32.h" | ||
#else | ||
# include "uaccess_64.h" | ||
#endif | ||
|
||
static inline unsigned long | ||
copy_from_user(void *to, const void __user *from, unsigned long n) | ||
{ | ||
unsigned long __copy_from = (unsigned long) from; | ||
__kernel_size_t __copy_size = (__kernel_size_t) n; | ||
|
||
if (__copy_size && __access_ok(__copy_from, __copy_size)) | ||
return __copy_user(to, from, __copy_size); | ||
|
||
return __copy_size; | ||
} | ||
|
||
static inline unsigned long | ||
copy_to_user(void __user *to, const void *from, unsigned long n) | ||
{ | ||
unsigned long __copy_to = (unsigned long) to; | ||
__kernel_size_t __copy_size = (__kernel_size_t) n; | ||
|
||
if (__copy_size && __access_ok(__copy_to, __copy_size)) | ||
return __copy_user(to, from, __copy_size); | ||
|
||
return __copy_size; | ||
} | ||
|
||
#endif /* __ASM_SH_UACCESS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters