Subject: [PATCH] include stddef.h in asm-powerpc/current.h to get definition of offsetof

From: Olaf Hering <[email-masked]>
Date: Sun, 25 Feb 2007 20:04:18 +0100

On Tue, Oct 31, Hugh Dickins wrote:

> +++ linux/include/asm-powerpc/current.h	2006-10-30 19:27:05.000000000 +0000

> +static inline struct task_struct *get_current(void)
> +{
> +	struct task_struct *task;
> +
> +	__asm__ __volatile__("ld %0,%1(13)"
> +	: "=r" (task)
> +	: "i" (offsetof(struct paca_struct, __current)));

This breaks compile of 2.6.18.8:

  CC [M]  drivers/media/video/pwc/pwc-uncompress.o
In file included from /home/olaf/kernel/linux-2.6.18.8/drivers/media/video/pwc/pwc-uncompress.c:29:
include2/asm/current.h: In function 'get_current':
include2/asm/current.h:23: warning: implicit declaration of function 'offsetof'
include2/asm/current.h:23: error: expected expression before 'struct'
make[5]: *** [drivers/media/video/pwc/pwc-uncompress.o] Error 1

Signed-off-by: Olaf Hering <[email-masked]>

---
 include/asm-powerpc/current.h |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6.18.8/include/asm-powerpc/current.h
===================================================================
--- linux-2.6.18.8.orig/include/asm-powerpc/current.h
+++ linux-2.6.18.8/include/asm-powerpc/current.h
@@ -12,6 +12,7 @@
 struct task_struct;
 
 #ifdef __powerpc64__
+#include <linux/stddef.h>
 #include <asm/paca.h>
 
 static inline struct task_struct *get_current(void)