Commit 29506415 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: uinput - convert to dynalloc allocation

Also introduce proper locking when creating/deleting device.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent e753b650
This diff is collapsed.
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
#define UINPUT_BUFFER_SIZE 16 #define UINPUT_BUFFER_SIZE 16
#define UINPUT_NUM_REQUESTS 16 #define UINPUT_NUM_REQUESTS 16
/* state flags => bit index for {set|clear|test}_bit ops */ enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
#define UIST_CREATED 0
struct uinput_request { struct uinput_request {
int id; int id;
...@@ -52,11 +51,12 @@ struct uinput_request { ...@@ -52,11 +51,12 @@ struct uinput_request {
struct uinput_device { struct uinput_device {
struct input_dev *dev; struct input_dev *dev;
unsigned long state; struct semaphore sem;
enum uinput_state state;
wait_queue_head_t waitq; wait_queue_head_t waitq;
unsigned char ready, unsigned char ready;
head, unsigned char head;
tail; unsigned char tail;
struct input_event buff[UINPUT_BUFFER_SIZE]; struct input_event buff[UINPUT_BUFFER_SIZE];
struct uinput_request *requests[UINPUT_NUM_REQUESTS]; struct uinput_request *requests[UINPUT_NUM_REQUESTS];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment