Commit 66be667c authored by Patrick Mochel's avatar Patrick Mochel

input layer update:

- Remove struct input_dev * input_dev; replace with static LIST_HEAD(input_dev_list).
- Change all list manipulation from manual to using generic list helpers.
parent f7116f8f
...@@ -58,8 +58,11 @@ EXPORT_SYMBOL(input_event); ...@@ -58,8 +58,11 @@ EXPORT_SYMBOL(input_event);
#define INPUT_MAJOR 13 #define INPUT_MAJOR 13
#define INPUT_DEVICES 256 #define INPUT_DEVICES 256
static struct input_dev *input_dev; static LIST_HEAD(input_dev_list);
static LIST_HEAD(input_handler_list);
static struct input_handler *input_handler; static struct input_handler *input_handler;
static struct input_handler *input_table[8]; static struct input_handler *input_table[8];
static devfs_handle_t input_devfs_handle; static devfs_handle_t input_devfs_handle;
...@@ -465,9 +468,7 @@ void input_register_device(struct input_dev *dev) ...@@ -465,9 +468,7 @@ void input_register_device(struct input_dev *dev)
/* /*
* Add the device. * Add the device.
*/ */
list_add_tail(&dev->node,&input_dev_list);
dev->next = input_dev;
input_dev = dev;
/* /*
* Notify handlers. * Notify handlers.
...@@ -539,7 +540,7 @@ void input_unregister_device(struct input_dev *dev) ...@@ -539,7 +540,7 @@ void input_unregister_device(struct input_dev *dev)
/* /*
* Remove the device. * Remove the device.
*/ */
input_find_and_remove(struct input_dev, input_dev, dev, next); list_del_init(&dev->node);
/* /*
* Notify /proc. * Notify /proc.
...@@ -553,7 +554,7 @@ void input_unregister_device(struct input_dev *dev) ...@@ -553,7 +554,7 @@ void input_unregister_device(struct input_dev *dev)
void input_register_handler(struct input_handler *handler) void input_register_handler(struct input_handler *handler)
{ {
struct input_dev *dev = input_dev; struct list_head * node;
struct input_handle *handle; struct input_handle *handle;
struct input_device_id *id; struct input_device_id *id;
...@@ -577,11 +578,11 @@ void input_register_handler(struct input_handler *handler) ...@@ -577,11 +578,11 @@ void input_register_handler(struct input_handler *handler)
* Notify it about all existing devices. * Notify it about all existing devices.
*/ */
while (dev) { list_for_each(node,&input_dev_list) {
struct input_dev *dev = container_of(node,struct input_dev,node);
if ((id = input_match_device(handler->id_table, dev))) if ((id = input_match_device(handler->id_table, dev)))
if ((handle = handler->connect(handler, dev, id))) if ((handle = handler->connect(handler, dev, id)))
input_link_handle(handle); input_link_handle(handle);
dev = dev->next;
} }
/* /*
...@@ -715,13 +716,14 @@ static unsigned int input_devices_poll(struct file *file, poll_table *wait) ...@@ -715,13 +716,14 @@ static unsigned int input_devices_poll(struct file *file, poll_table *wait)
static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
{ {
struct input_dev *dev = input_dev; struct list_head * node;
struct input_handle *handle; struct input_handle *handle;
off_t at = 0; off_t at = 0;
int i, len, cnt = 0; int i, len, cnt = 0;
while (dev) { list_for_each(node,&input_dev_list) {
struct input_dev *dev = container_of(node,struct input_dev,node);
len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
...@@ -761,11 +763,10 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int ...@@ -761,11 +763,10 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
if (cnt >= count) if (cnt >= count)
break; break;
} }
dev = dev->next;
} }
if (!dev) *eof = 1; if (node == &input_dev_list)
*eof = 1;
return (count > cnt) ? cnt : count; return (count > cnt) ? cnt : count;
} }
......
...@@ -812,7 +812,7 @@ struct input_dev { ...@@ -812,7 +812,7 @@ struct input_dev {
int (*erase_effect)(struct input_dev *dev, int effect_id); int (*erase_effect)(struct input_dev *dev, int effect_id);
struct input_handle *handle; struct input_handle *handle;
struct input_dev *next; struct list_head node;
}; };
/* /*
......
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