Skip to content

Commit 14498e9

Browse files
committed
Input: make events() method return number of events processed
In preparation to consolidating filtering and event processing in the input core change events() method to return number of events processed by it. Reviewed-by: Jeff LaBundy <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent a184cf9 commit 14498e9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

drivers/input/evdev.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ static void evdev_pass_values(struct evdev_client *client,
288288
/*
289289
* Pass incoming events to all connected clients.
290290
*/
291-
static void evdev_events(struct input_handle *handle,
292-
const struct input_value *vals, unsigned int count)
291+
static unsigned int evdev_events(struct input_handle *handle,
292+
struct input_value *vals, unsigned int count)
293293
{
294294
struct evdev *evdev = handle->private;
295295
struct evdev_client *client;
@@ -306,6 +306,8 @@ static void evdev_events(struct input_handle *handle,
306306
evdev_pass_values(client, vals, count, ev_time);
307307

308308
rcu_read_unlock();
309+
310+
return count;
309311
}
310312

311313
static int evdev_fasync(int fd, struct file *file, int on)

include/linux/input.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ struct input_handle;
275275
* it may not sleep
276276
* @events: event sequence handler. This method is being called by
277277
* input core with interrupts disabled and dev->event_lock
278-
* spinlock held and so it may not sleep
278+
* spinlock held and so it may not sleep. The method must return
279+
* number of events passed to it.
279280
* @filter: similar to @event; separates normal event handlers from
280281
* "filters".
281282
* @match: called after comparing device's id with handler's id_table
@@ -312,8 +313,8 @@ struct input_handler {
312313
void *private;
313314

314315
void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
315-
void (*events)(struct input_handle *handle,
316-
const struct input_value *vals, unsigned int count);
316+
unsigned int (*events)(struct input_handle *handle,
317+
struct input_value *vals, unsigned int count);
317318
bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
318319
bool (*match)(struct input_handler *handler, struct input_dev *dev);
319320
int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);

0 commit comments

Comments
 (0)