Merge branch 'fix/hda' into for-linus
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / input / input-compat.h
blob47cd9eaee66a6b7ef4cd2b706ec05611681fff68
1 #ifndef _INPUT_COMPAT_H
2 #define _INPUT_COMPAT_H
4 /*
5 * 32bit compatibility wrappers for the input subsystem.
7 * Very heavily based on evdev.c - Copyright (c) 1999-2002 Vojtech Pavlik
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
14 #include <linux/compiler.h>
15 #include <linux/compat.h>
16 #include <linux/input.h>
18 #ifdef CONFIG_COMPAT
20 /* Note to the author of this code: did it ever occur to
21 you why the ifdefs are needed? Think about it again. -AK */
22 #ifdef CONFIG_X86_64
23 # define INPUT_COMPAT_TEST is_compat_task()
24 #elif defined(CONFIG_IA64)
25 # define INPUT_COMPAT_TEST IS_IA32_PROCESS(task_pt_regs(current))
26 #elif defined(CONFIG_S390)
27 # define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT)
28 #elif defined(CONFIG_MIPS)
29 # define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR)
30 #else
31 # define INPUT_COMPAT_TEST test_thread_flag(TIF_32BIT)
32 #endif
34 struct input_event_compat {
35 struct compat_timeval time;
36 __u16 type;
37 __u16 code;
38 __s32 value;
41 struct ff_periodic_effect_compat {
42 __u16 waveform;
43 __u16 period;
44 __s16 magnitude;
45 __s16 offset;
46 __u16 phase;
48 struct ff_envelope envelope;
50 __u32 custom_len;
51 compat_uptr_t custom_data;
54 struct ff_effect_compat {
55 __u16 type;
56 __s16 id;
57 __u16 direction;
58 struct ff_trigger trigger;
59 struct ff_replay replay;
61 union {
62 struct ff_constant_effect constant;
63 struct ff_ramp_effect ramp;
64 struct ff_periodic_effect_compat periodic;
65 struct ff_condition_effect condition[2]; /* One for each axis */
66 struct ff_rumble_effect rumble;
67 } u;
70 static inline size_t input_event_size(void)
72 return INPUT_COMPAT_TEST ?
73 sizeof(struct input_event_compat) : sizeof(struct input_event);
76 #else
78 static inline size_t input_event_size(void)
80 return sizeof(struct input_event);
83 #endif /* CONFIG_COMPAT */
85 int input_event_from_user(const char __user *buffer,
86 struct input_event *event);
88 int input_event_to_user(char __user *buffer,
89 const struct input_event *event);
91 int input_ff_effect_from_user(const char __user *buffer, size_t size,
92 struct ff_effect *effect);
94 #endif /* _INPUT_COMPAT_H */