In order to avoid needless #ifdef CONFIG_COMPAT checks, move the compat_ptr() definition to linux/compat.h where it can be seen by any file regardless of the architecture. Only s390 needs a special definition, this can use the self-#define trick we have elsewhere.
Showing the changes to include/linux (1 of 9 files). Show all
Unified · Split
| @@ -958,4 +958,22 @@ static inline bool in_compat_syscall(void) { return false; } · 957 unmodified lines | |||
| 958 | 958 | ||
| 959 | #endif /* CONFIG_COMPAT */ | 959 | #endif /* CONFIG_COMPAT */ |
| 960 | 960 | ||
| 961 | /* | ||
| 962 | * A pointer passed in from user mode. This should not | ||
| 963 | * be used for syscall parameters, just declare them | ||
| 964 | * as pointers because the syscall entry code will have | ||
| 965 | * appropriately converted them already. | ||
| 966 | */ | ||
| 967 | #ifndef compat_ptr | ||
| 968 | static inline void __user *compat_ptr(compat_uptr_t uptr) | ||
| 969 | { | ||
| 970 | return (void __user *)(unsigned long)uptr; | ||
| 971 | } | ||
| 972 | #endif | ||
| 973 | |||
| 974 | static inline compat_uptr_t ptr_to_compat(void __user *uptr) | ||
| 975 | { | ||
| 976 | return (u32)(unsigned long)uptr; | ||
| 977 | } | ||
| 978 | |||
| 961 | #endif /* _LINUX_COMPAT_H */ | 979 | #endif /* _LINUX_COMPAT_H */ |