#define INPUT_MAJOR 13
#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_table[8];
static devfs_handle_t input_devfs_handle;
/*
* Add the device.
*/
-
- dev->next = input_dev;
- input_dev = dev;
+ list_add_tail(&dev->node,&input_dev_list);
/*
* Notify handlers.
/*
* Remove the device.
*/
- input_find_and_remove(struct input_dev, input_dev, dev, next);
+ list_del_init(&dev->node);
/*
* Notify /proc.
void input_register_handler(struct input_handler *handler)
{
- struct input_dev *dev = input_dev;
+ struct list_head * node;
struct input_handle *handle;
struct input_device_id *id;
* 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 ((handle = handler->connect(handler, dev, id)))
input_link_handle(handle);
- dev = dev->next;
}
/*
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;
off_t at = 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",
dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
if (cnt >= count)
break;
}
-
- dev = dev->next;
}
- if (!dev) *eof = 1;
+ if (node == &input_dev_list)
+ *eof = 1;
return (count > cnt) ? cnt : count;
}