From fc5c33454955357d95a9b491865102147a812800 Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Mon, 26 Aug 2002 03:07:55 -0700 Subject: [PATCH] - Remove input_handler list; replace with LIST_HEAD(input_handler_list). - Update all accesses to list to use generic list functions. --- drivers/input/input.c | 27 ++++++++++----------------- include/linux/input.h | 2 +- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index 266189bce760..7660c3ff43fb 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -61,8 +61,6 @@ EXPORT_SYMBOL(input_event); static LIST_HEAD(input_dev_list); static LIST_HEAD(input_handler_list); -static struct input_handler *input_handler; - static struct input_handler *input_table[8]; static devfs_handle_t input_devfs_handle; @@ -445,7 +443,7 @@ static void input_call_hotplug(char *verb, struct input_dev *dev) void input_register_device(struct input_dev *dev) { - struct input_handler *handler = input_handler; + struct list_head * node; struct input_handle *handle; struct input_device_id *id; @@ -473,12 +471,11 @@ void input_register_device(struct input_dev *dev) /* * Notify handlers. */ - - while (handler) { + list_for_each(node,&input_handler_list) { + struct input_handler *handler = container_of(node,struct input_handler,node); if ((id = input_match_device(handler->id_table, dev))) if ((handle = handler->connect(handler, dev, id))) input_link_handle(handle); - handler = handler->next; } /* @@ -570,9 +567,7 @@ void input_register_handler(struct input_handler *handler) /* * Add the handler. */ - - handler->next = input_handler; - input_handler = handler; + list_add_tail(&handler->node,&input_handler_list); /* * Notify it about all existing devices. @@ -614,8 +609,7 @@ void input_unregister_handler(struct input_handler *handler) /* * Remove it. */ - input_find_and_remove(struct input_handler, input_handler, handler, - next); + list_del_init(&handler->node); /* * Remove minors. @@ -773,13 +767,14 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) { - struct input_handler *handler = input_handler; + struct list_head * node; off_t at = 0; int len = 0, cnt = 0; int i = 0; - while (handler) { + list_for_each(node,&input_handler_list) { + struct input_handler *handler = container_of(node,struct input_handler,node); if (handler->fops) len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n", @@ -799,11 +794,9 @@ static int input_handlers_read(char *buf, char **start, off_t pos, int count, in if (cnt >= count) break; } - - handler = handler->next; } - - if (!handler) *eof = 1; + if (node == &input_handler_list) + *eof = 1; return (count > cnt) ? cnt : count; } diff --git a/include/linux/input.h b/include/linux/input.h index fa2c3b3b09db..c99710c658ec 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -871,7 +871,7 @@ struct input_handler { struct input_device_id *id_table; struct input_handle *handle; - struct input_handler *next; + struct list_head node; }; struct input_handle { -- 2.39.5