aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-09-04 15:19:07 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-10-23 19:32:31 -0400
commita11bc476b987925654369411dd8281a60cb5a175 (patch)
treed6abc9e7175a6fae77778dff1b5d29a4f19cdd72
parent04ce40a61a9164f82065eade491099b185c17a65 (diff)
Input: uinput - fold header into the driver proper
There is nothing in the uinput kernel header that is of use to anyone in the kernel besides the uinput driver itself, so let's fold it into the driver code (leaving uapi part intact). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/misc/uinput.c40
-rw-r--r--include/linux/uinput.h81
2 files changed, 39 insertions, 82 deletions
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 06f3ac67dde1..7b41aad7ec27 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -31,6 +31,7 @@
31 * 0.1 20/06/2002 31 * 0.1 20/06/2002
32 * - first public version 32 * - first public version
33 */ 33 */
34#include <uapi/linux/uinput.h>
34#include <linux/poll.h> 35#include <linux/poll.h>
35#include <linux/sched.h> 36#include <linux/sched.h>
36#include <linux/slab.h> 37#include <linux/slab.h>
@@ -38,10 +39,47 @@
38#include <linux/init.h> 39#include <linux/init.h>
39#include <linux/fs.h> 40#include <linux/fs.h>
40#include <linux/miscdevice.h> 41#include <linux/miscdevice.h>
41#include <linux/uinput.h>
42#include <linux/input/mt.h> 42#include <linux/input/mt.h>
43#include "../input-compat.h" 43#include "../input-compat.h"
44 44
45#define UINPUT_NAME "uinput"
46#define UINPUT_BUFFER_SIZE 16
47#define UINPUT_NUM_REQUESTS 16
48
49enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
50
51struct uinput_request {
52 unsigned int id;
53 unsigned int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
54
55 int retval;
56 struct completion done;
57
58 union {
59 unsigned int effect_id;
60 struct {
61 struct ff_effect *effect;
62 struct ff_effect *old;
63 } upload;
64 } u;
65};
66
67struct uinput_device {
68 struct input_dev *dev;
69 struct mutex mutex;
70 enum uinput_state state;
71 wait_queue_head_t waitq;
72 unsigned char ready;
73 unsigned char head;
74 unsigned char tail;
75 struct input_event buff[UINPUT_BUFFER_SIZE];
76 unsigned int ff_effects_max;
77
78 struct uinput_request *requests[UINPUT_NUM_REQUESTS];
79 wait_queue_head_t requests_waitq;
80 spinlock_t requests_lock;
81};
82
45static int uinput_dev_event(struct input_dev *dev, 83static int uinput_dev_event(struct input_dev *dev,
46 unsigned int type, unsigned int code, int value) 84 unsigned int type, unsigned int code, int value)
47{ 85{
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
deleted file mode 100644
index 75de43da2301..000000000000
--- a/include/linux/uinput.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * User level driver support for input subsystem
3 *
4 * Heavily based on evdev.c by Vojtech Pavlik
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
21 *
22 * Changes/Revisions:
23 * 0.5 08/13/2015 (David Herrmann <dh.herrmann@gmail.com> &
24 * Benjamin Tissoires <benjamin.tissoires@redhat.com>)
25 * - add UI_DEV_SETUP ioctl
26 * - add UI_ABS_SETUP ioctl
27 * - add UI_GET_VERSION ioctl
28 * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
29 * - add UI_GET_SYSNAME ioctl
30 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
31 * - update ff support for the changes in kernel interface
32 * - add UINPUT_VERSION
33 * 0.2 16/10/2004 (Micah Dowty <micah@navi.cx>)
34 * - added force feedback support
35 * - added UI_SET_PHYS
36 * 0.1 20/06/2002
37 * - first public version
38 */
39#ifndef __UINPUT_H_
40#define __UINPUT_H_
41
42#include <uapi/linux/uinput.h>
43
44#define UINPUT_NAME "uinput"
45#define UINPUT_BUFFER_SIZE 16
46#define UINPUT_NUM_REQUESTS 16
47
48enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
49
50struct uinput_request {
51 unsigned int id;
52 unsigned int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
53
54 int retval;
55 struct completion done;
56
57 union {
58 unsigned int effect_id;
59 struct {
60 struct ff_effect *effect;
61 struct ff_effect *old;
62 } upload;
63 } u;
64};
65
66struct uinput_device {
67 struct input_dev *dev;
68 struct mutex mutex;
69 enum uinput_state state;
70 wait_queue_head_t waitq;
71 unsigned char ready;
72 unsigned char head;
73 unsigned char tail;
74 struct input_event buff[UINPUT_BUFFER_SIZE];
75 unsigned int ff_effects_max;
76
77 struct uinput_request *requests[UINPUT_NUM_REQUESTS];
78 wait_queue_head_t requests_waitq;
79 spinlock_t requests_lock;
80};
81#endif /* __UINPUT_H_ */