From 4858ce6b65a61b46fee3f056e59c149f1756cb96 Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Thu, 13 Sep 2012 06:59:36 +0200 Subject: [PATCH 1/3] Revert "Input: evdev - Add the events() callback" This reverts commit cd8eeb31c8a8e2991fc4f2c4e9dd6b97d27ff8f6. --- drivers/input/evdev.c | 68 +++++++++++++++---------------------------------- 1 file changed, 21 insertions(+), 47 deletions(-) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 118d030..a0692c5 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -54,9 +54,16 @@ struct evdev_client { static struct evdev *evdev_table[EVDEV_MINORS]; static DEFINE_MUTEX(evdev_table_mutex); -static void __pass_event(struct evdev_client *client, - const struct input_event *event) +static void evdev_pass_event(struct evdev_client *client, + struct input_event *event, + ktime_t mono, ktime_t real) { + event->time = ktime_to_timeval(client->clkid == CLOCK_MONOTONIC ? + mono : real); + + /* Interrupts are disabled, just acquire the lock. */ + spin_lock(&client->buffer_lock); + client->buffer[client->head++] = *event; client->head &= client->bufsize - 1; @@ -79,74 +86,42 @@ static void __pass_event(struct evdev_client *client, client->packet_head = client->head; kill_fasync(&client->fasync, SIGIO, POLL_IN); } -} - -static void evdev_pass_values(struct evdev_client *client, - const struct input_value *vals, unsigned int count, - ktime_t mono, ktime_t real) -{ - struct evdev *evdev = client->evdev; - const struct input_value *v; - struct input_event event; - bool wakeup = false; - - event.time = ktime_to_timeval(client->clkid == CLOCK_MONOTONIC ? - mono : real); - - /* Interrupts are disabled, just acquire the lock. */ - spin_lock(&client->buffer_lock); - - for (v = vals; v != vals + count; v++) { - event.type = v->type; - event.code = v->code; - event.value = v->value; - __pass_event(client, &event); - if (v->type == EV_SYN && v->code == SYN_REPORT) - wakeup = true; - } spin_unlock(&client->buffer_lock); - - if (wakeup) - wake_up_interruptible(&evdev->wait); } /* - * Pass incoming events to all connected clients. + * Pass incoming event to all connected clients. */ -static void evdev_events(struct input_handle *handle, - const struct input_value *vals, unsigned int count) +static void evdev_event(struct input_handle *handle, + unsigned int type, unsigned int code, int value) { struct evdev *evdev = handle->private; struct evdev_client *client; + struct input_event event; ktime_t time_mono, time_real; time_mono = ktime_get(); time_real = ktime_sub(time_mono, ktime_get_monotonic_offset()); + event.type = type; + event.code = code; + event.value = value; + rcu_read_lock(); client = rcu_dereference(evdev->grab); if (client) - evdev_pass_values(client, vals, count, time_mono, time_real); + evdev_pass_event(client, &event, time_mono, time_real); else list_for_each_entry_rcu(client, &evdev->client_list, node) - evdev_pass_values(client, vals, count, - time_mono, time_real); + evdev_pass_event(client, &event, time_mono, time_real); rcu_read_unlock(); -} -/* - * Pass incoming event to all connected clients. - */ -static void evdev_event(struct input_handle *handle, - unsigned int type, unsigned int code, int value) -{ - struct input_value vals[] = { { type, code, value } }; - - evdev_events(handle, vals, 1); + if (type == EV_SYN && code == SYN_REPORT) + wake_up_interruptible(&evdev->wait); } static int evdev_fasync(int fd, struct file *file, int on) @@ -1075,7 +1050,6 @@ MODULE_DEVICE_TABLE(input, evdev_ids); static struct input_handler evdev_handler = { .event = evdev_event, - .events = evdev_events, .connect = evdev_connect, .disconnect = evdev_disconnect, .fops = &evdev_fops, -- 1.7.9.5