diff --git a/include/linux/err.h b/include/linux/err.h index b5d9bb2a2349..6dd7f00d422d 100644 --- a/include/linux/err.h +++ b/include/linux/err.h @@ -41,6 +41,8 @@ static inline void * __must_check ERR_PTR(long error) return (void *) error; } +#define ERR_PTR_PCPU(ptr) ({ (void __percpu *)(unsigned long)ERR_PTR(ptr); }) + /** * PTR_ERR - Extract the error code from an error pointer. * @ptr: An error pointer. @@ -51,6 +53,8 @@ static inline long __must_check PTR_ERR(__force const void *ptr) return (long) ptr; } +#define PTR_ERR_PCPU(ptr) ({ PTR_ERR((void *)(__force unsigned long)ptr); }) + /** * IS_ERR - Detect an error pointer. * @ptr: The pointer to check. @@ -61,6 +65,8 @@ static inline bool __must_check IS_ERR(__force const void *ptr) return IS_ERR_VALUE((unsigned long)ptr); } +#define IS_ERR_PCPU(ptr) ({ IS_ERR((void *)(__force unsigned long)ptr); }) + /** * IS_ERR_OR_NULL - Detect an error pointer or a null pointer. * @ptr: The pointer to check.