diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 10:42:40 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 10:42:40 -0800 |
commit | 3e2b32b69308e974cd1167beaf266d3c716e4734 (patch) | |
tree | 0f1b24dcb7b066a6322d33235b95655d885695ac /drivers/input | |
parent | 3824ba7df91745da6ebac703c87c3b801c34fdd0 (diff) | |
parent | 9c08a938ce5a3e1c9d5f764dc6ae844cb1af76ff (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/gameport/gameport.c | 12 | ||||
-rw-r--r-- | drivers/input/input.c | 55 | ||||
-rw-r--r-- | drivers/input/serio/serio.c | 12 |
3 files changed, 51 insertions, 28 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index caac6d63d46f..b765a155c008 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c @@ -50,9 +50,7 @@ static DECLARE_MUTEX(gameport_sem); static LIST_HEAD(gameport_list); -static struct bus_type gameport_bus = { - .name = "gameport", -}; +static struct bus_type gameport_bus; static void gameport_add_port(struct gameport *gameport); static void gameport_destroy_port(struct gameport *gameport); @@ -703,11 +701,15 @@ static int gameport_driver_remove(struct device *dev) return 0; } +static struct bus_type gameport_bus = { + .name = "gameport", + .probe = gameport_driver_probe, + .remove = gameport_driver_remove, +}; + void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) { drv->driver.bus = &gameport_bus; - drv->driver.probe = gameport_driver_probe; - drv->driver.remove = gameport_driver_remove; gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER); } diff --git a/drivers/input/input.c b/drivers/input/input.c index fe33ff334e27..4fe3da3c667a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -528,40 +528,56 @@ INPUT_DEV_STRING_ATTR_SHOW(name); INPUT_DEV_STRING_ATTR_SHOW(phys); INPUT_DEV_STRING_ATTR_SHOW(uniq); -static int print_modalias_bits(char *buf, char prefix, unsigned long *arr, +static int print_modalias_bits(char *buf, int size, char prefix, unsigned long *arr, unsigned int min, unsigned int max) { int len, i; - len = sprintf(buf, "%c", prefix); + len = snprintf(buf, size, "%c", prefix); for (i = min; i < max; i++) if (arr[LONG(i)] & BIT(i)) - len += sprintf(buf+len, "%X,", i); + len += snprintf(buf + len, size - len, "%X,", i); return len; } -static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) +static int print_modalias(char *buf, int size, struct input_dev *id) { - struct input_dev *id = to_input_dev(dev); - ssize_t len = 0; + int len; - len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-", + len = snprintf(buf, size, "input:b%04Xv%04Xp%04Xe%04X-", id->id.bustype, id->id.vendor, id->id.product, id->id.version); - len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX); - len += print_modalias_bits(buf+len, 'k', id->keybit, + len += print_modalias_bits(buf + len, size - len, 'e', id->evbit, + 0, EV_MAX); + len += print_modalias_bits(buf + len, size - len, 'k', id->keybit, KEY_MIN_INTERESTING, KEY_MAX); - len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX); - len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX); - len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX); - len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX); - len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX); - len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX); - len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX); - len += sprintf(buf+len, "\n"); + len += print_modalias_bits(buf + len, size - len, 'r', id->relbit, + 0, REL_MAX); + len += print_modalias_bits(buf + len, size - len, 'a', id->absbit, + 0, ABS_MAX); + len += print_modalias_bits(buf + len, size - len, 'm', id->mscbit, + 0, MSC_MAX); + len += print_modalias_bits(buf + len, size - len, 'l', id->ledbit, + 0, LED_MAX); + len += print_modalias_bits(buf + len, size - len, 's', id->sndbit, + 0, SND_MAX); + len += print_modalias_bits(buf + len, size - len, 'f', id->ffbit, + 0, FF_MAX); + len += print_modalias_bits(buf + len, size - len, 'w', id->swbit, + 0, SW_MAX); + return len; +} + +static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) +{ + struct input_dev *id = to_input_dev(dev); + ssize_t len; + + len = print_modalias(buf, PAGE_SIZE, id); + len += snprintf(buf + len, PAGE_SIZE-len, "\n"); return len; } static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); @@ -728,8 +744,11 @@ static int input_dev_uevent(struct class_device *cdev, char **envp, if (test_bit(EV_SW, dev->evbit)) INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); - envp[i] = NULL; + envp[i++] = buffer + len; + len += snprintf(buffer + len, buffer_size - len, "MODALIAS="); + len += print_modalias(buffer + len, buffer_size - len, dev) + 1; + envp[i] = NULL; return 0; } diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 8e530cc970e1..2f76813c3a64 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -59,9 +59,7 @@ static DECLARE_MUTEX(serio_sem); static LIST_HEAD(serio_list); -static struct bus_type serio_bus = { - .name = "serio", -}; +static struct bus_type serio_bus; static void serio_add_port(struct serio *serio); static void serio_destroy_port(struct serio *serio); @@ -750,11 +748,15 @@ static int serio_driver_remove(struct device *dev) return 0; } +static struct bus_type serio_bus = { + .name = "serio", + .probe = serio_driver_probe, + .remove = serio_driver_remove, +}; + void __serio_register_driver(struct serio_driver *drv, struct module *owner) { drv->driver.bus = &serio_bus; - drv->driver.probe = serio_driver_probe; - drv->driver.remove = serio_driver_remove; serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER); } |