Bug 5241

Summary: include/linux/joystick.h line 142 #error Unexpected BITS_PER_LONG
Product: Drivers Reporter: kyler (kyler)
Component: Input DevicesAssignee: Dominik Brodowski (linux)
Status: CLOSED CODE_FIX    
Severity: blocking    
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: >= 2.6.13 Subsystem:
Regression: --- Bisected commit-id:

Description kyler 2005-09-13 09:10:35 UTC
Most recent kernel where this bug did not occur: 2.6.12.6
Distribution:
Hardware Environment: intel p4 x86
Software Environment: LFS
Problem Description: xorg compiled cleanly against include/linux/joystick.h
prior to 2.6.13

Steps to reproduce: compile latest xorg release (xorg.freedesktop.org) against
linux 2.6.13.1 sources in /usr/include/linux and the compile will fail.  Worked
fine in 2.6.12.6 -

In file included from xf86Ur-98.c:8:
/usr/include/linux/joystick.h:131: error: parse error before "__s64"
/usr/include/linux/joystick.h:132: error: ISO C forbids data definition with no
type or storage class
/usr/include/linux/joystick.h:135: error: parse error before '}' token
In file included from xf86Ur-98.c:8:
/usr/include/linux/joystick.h:142:2: #error Unexpected BITS_PER_LONG
Comment 1 Andrew Morton 2005-09-13 17:50:24 UTC
bugme-daemon@kernel-bugs.osdl.org wrote:
>
> In file included from xf86Ur-98.c:8:
>  /usr/include/linux/joystick.h:131: error: parse error before "__s64"
>  /usr/include/linux/joystick.h:132: error: ISO C forbids data definition with no
>  type or storage class
>  /usr/include/linux/joystick.h:135: error: parse error before '}' token
>  In file included from xf86Ur-98.c:8:
>  /usr/include/linux/joystick.h:142:2: #error Unexpected BITS_PER_LONG

Like this, perhaps?


From: Andrew Morton <akpm@osdl.org>

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/linux/joystick.h |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff -puN include/linux/joystick.h~joystick-vs-xorg-fix include/linux/joystick.h
--- devel/include/linux/joystick.h~joystick-vs-xorg-fix	2005-09-13 17:48:20.000000000 -0700
+++ devel-akpm/include/linux/joystick.h	2005-09-13 17:48:52.000000000 -0700
@@ -111,29 +111,30 @@ struct js_corr {
 #define JS_SET_ALL		8
 
 struct JS_DATA_TYPE {
-	__s32 buttons;
-	__s32 x;
-	__s32 y;
+	int32_t buttons;
+	int32_t x;
+	int32_t y;
 };
 
 struct JS_DATA_SAVE_TYPE_32 {
-	__s32 JS_TIMEOUT;
-	__s32 BUSY;
-	__s32 JS_EXPIRETIME;
-	__s32 JS_TIMELIMIT;
+	int32_t JS_TIMEOUT;
+	int32_t BUSY;
+	int32_t JS_EXPIRETIME;
+	int32_t JS_TIMELIMIT;
 	struct JS_DATA_TYPE JS_SAVE;
 	struct JS_DATA_TYPE JS_CORR;
 };
 
 struct JS_DATA_SAVE_TYPE_64 {
-	__s32 JS_TIMEOUT;
-	__s32 BUSY;
-	__s64 JS_EXPIRETIME;
-	__s64 JS_TIMELIMIT;
+	int32_t JS_TIMEOUT;
+	int32_t BUSY;
+	int64_t JS_EXPIRETIME;
+	int64_t JS_TIMELIMIT;
 	struct JS_DATA_TYPE JS_SAVE;
 	struct JS_DATA_TYPE JS_CORR;
 };
 
+#ifdef __KERNEL__
 #if BITS_PER_LONG == 64
 #define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64
 #elif BITS_PER_LONG == 32
@@ -141,5 +142,6 @@ struct JS_DATA_SAVE_TYPE_64 {
 #else
 #error Unexpected BITS_PER_LONG
 #endif
+#endif
 
 #endif /* _LINUX_JOYSTICK_H */
_

Comment 2 kyler 2005-09-14 14:15:54 UTC
The supplied patch appears to have fixed this.  Thank you!  Keep up the great
work...
Comment 3 Dominik Brodowski 2005-11-17 14:01:47 UTC
akpm fixed it