treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / input / input-compat.h
blob3b7bb12b023bc60fc11520d9c98fcc567724afaa
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _INPUT_COMPAT_H
3 #define _INPUT_COMPAT_H
5 /*
6 * 32bit compatibility wrappers for the input subsystem.
8 * Very heavily based on evdev.c - Copyright (c) 1999-2002 Vojtech Pavlik
9 */
11 #include <linux/compiler.h>
12 #include <linux/compat.h>
13 #include <linux/input.h>
15 #ifdef CONFIG_COMPAT
17 struct input_event_compat {
18 compat_ulong_t sec;
19 compat_ulong_t usec;
20 __u16 type;
21 __u16 code;
22 __s32 value;
25 struct ff_periodic_effect_compat {
26 __u16 waveform;
27 __u16 period;
28 __s16 magnitude;
29 __s16 offset;
30 __u16 phase;
32 struct ff_envelope envelope;
34 __u32 custom_len;
35 compat_uptr_t custom_data;
38 struct ff_effect_compat {
39 __u16 type;
40 __s16 id;
41 __u16 direction;
42 struct ff_trigger trigger;
43 struct ff_replay replay;
45 union {
46 struct ff_constant_effect constant;
47 struct ff_ramp_effect ramp;
48 struct ff_periodic_effect_compat periodic;
49 struct ff_condition_effect condition[2]; /* One for each axis */
50 struct ff_rumble_effect rumble;
51 } u;
54 static inline size_t input_event_size(void)
56 return (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) ?
57 sizeof(struct input_event_compat) : sizeof(struct input_event);
60 #else
62 static inline size_t input_event_size(void)
64 return sizeof(struct input_event);
67 #endif /* CONFIG_COMPAT */
69 int input_event_from_user(const char __user *buffer,
70 struct input_event *event);
72 int input_event_to_user(char __user *buffer,
73 const struct input_event *event);
75 int input_ff_effect_from_user(const char __user *buffer, size_t size,
76 struct ff_effect *effect);
78 #endif /* _INPUT_COMPAT_H */