aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/gameport/gameport.c12
-rw-r--r--drivers/input/input.c55
-rw-r--r--drivers/input/serio/serio.c12
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);
50 50
51static LIST_HEAD(gameport_list); 51static LIST_HEAD(gameport_list);
52 52
53static struct bus_type gameport_bus = { 53static struct bus_type gameport_bus;
54 .name = "gameport",
55};
56 54
57static void gameport_add_port(struct gameport *gameport); 55static void gameport_add_port(struct gameport *gameport);
58static void gameport_destroy_port(struct gameport *gameport); 56static void gameport_destroy_port(struct gameport *gameport);
@@ -703,11 +701,15 @@ static int gameport_driver_remove(struct device *dev)
703 return 0; 701 return 0;
704} 702}
705 703
704static struct bus_type gameport_bus = {
705 .name = "gameport",
706 .probe = gameport_driver_probe,
707 .remove = gameport_driver_remove,
708};
709
706void __gameport_register_driver(struct gameport_driver *drv, struct module *owner) 710void __gameport_register_driver(struct gameport_driver *drv, struct module *owner)
707{ 711{
708 drv->driver.bus = &gameport_bus; 712 drv->driver.bus = &gameport_bus;
709 drv->driver.probe = gameport_driver_probe;
710 drv->driver.remove = gameport_driver_remove;
711 gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER); 713 gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER);
712} 714}
713 715
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);
528INPUT_DEV_STRING_ATTR_SHOW(phys); 528INPUT_DEV_STRING_ATTR_SHOW(phys);
529INPUT_DEV_STRING_ATTR_SHOW(uniq); 529INPUT_DEV_STRING_ATTR_SHOW(uniq);
530 530
531static int print_modalias_bits(char *buf, char prefix, unsigned long *arr, 531static int print_modalias_bits(char *buf, int size, char prefix, unsigned long *arr,
532 unsigned int min, unsigned int max) 532 unsigned int min, unsigned int max)
533{ 533{
534 int len, i; 534 int len, i;
535 535
536 len = sprintf(buf, "%c", prefix); 536 len = snprintf(buf, size, "%c", prefix);
537 for (i = min; i < max; i++) 537 for (i = min; i < max; i++)
538 if (arr[LONG(i)] & BIT(i)) 538 if (arr[LONG(i)] & BIT(i))
539 len += sprintf(buf+len, "%X,", i); 539 len += snprintf(buf + len, size - len, "%X,", i);
540 return len; 540 return len;
541} 541}
542 542
543static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) 543static int print_modalias(char *buf, int size, struct input_dev *id)
544{ 544{
545 struct input_dev *id = to_input_dev(dev); 545 int len;
546 ssize_t len = 0;
547 546
548 len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-", 547 len = snprintf(buf, size, "input:b%04Xv%04Xp%04Xe%04X-",
549 id->id.bustype, 548 id->id.bustype,
550 id->id.vendor, 549 id->id.vendor,
551 id->id.product, 550 id->id.product,
552 id->id.version); 551 id->id.version);
553 552
554 len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX); 553 len += print_modalias_bits(buf + len, size - len, 'e', id->evbit,
555 len += print_modalias_bits(buf+len, 'k', id->keybit, 554 0, EV_MAX);
555 len += print_modalias_bits(buf + len, size - len, 'k', id->keybit,
556 KEY_MIN_INTERESTING, KEY_MAX); 556 KEY_MIN_INTERESTING, KEY_MAX);
557 len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX); 557 len += print_modalias_bits(buf + len, size - len, 'r', id->relbit,
558 len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX); 558 0, REL_MAX);
559 len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX); 559 len += print_modalias_bits(buf + len, size - len, 'a', id->absbit,
560 len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX); 560 0, ABS_MAX);
561 len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX); 561 len += print_modalias_bits(buf + len, size - len, 'm', id->mscbit,
562 len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX); 562 0, MSC_MAX);
563 len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX); 563 len += print_modalias_bits(buf + len, size - len, 'l', id->ledbit,
564 len += sprintf(buf+len, "\n"); 564 0, LED_MAX);
565 len += print_modalias_bits(buf + len, size - len, 's', id->sndbit,
566 0, SND_MAX);
567 len += print_modalias_bits(buf + len, size - len, 'f', id->ffbit,
568 0, FF_MAX);
569 len += print_modalias_bits(buf + len, size - len, 'w', id->swbit,
570 0, SW_MAX);
571 return len;
572}
573
574static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf)
575{
576 struct input_dev *id = to_input_dev(dev);
577 ssize_t len;
578
579 len = print_modalias(buf, PAGE_SIZE, id);
580 len += snprintf(buf + len, PAGE_SIZE-len, "\n");
565 return len; 581 return len;
566} 582}
567static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); 583static 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,
728 if (test_bit(EV_SW, dev->evbit)) 744 if (test_bit(EV_SW, dev->evbit))
729 INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); 745 INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX);
730 746
731 envp[i] = NULL; 747 envp[i++] = buffer + len;
748 len += snprintf(buffer + len, buffer_size - len, "MODALIAS=");
749 len += print_modalias(buffer + len, buffer_size - len, dev) + 1;
732 750
751 envp[i] = NULL;
733 return 0; 752 return 0;
734} 753}
735 754
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);
59 59
60static LIST_HEAD(serio_list); 60static LIST_HEAD(serio_list);
61 61
62static struct bus_type serio_bus = { 62static struct bus_type serio_bus;
63 .name = "serio",
64};
65 63
66static void serio_add_port(struct serio *serio); 64static void serio_add_port(struct serio *serio);
67static void serio_destroy_port(struct serio *serio); 65static void serio_destroy_port(struct serio *serio);
@@ -750,11 +748,15 @@ static int serio_driver_remove(struct device *dev)
750 return 0; 748 return 0;
751} 749}
752 750
751static struct bus_type serio_bus = {
752 .name = "serio",
753 .probe = serio_driver_probe,
754 .remove = serio_driver_remove,
755};
756
753void __serio_register_driver(struct serio_driver *drv, struct module *owner) 757void __serio_register_driver(struct serio_driver *drv, struct module *owner)
754{ 758{
755 drv->driver.bus = &serio_bus; 759 drv->driver.bus = &serio_bus;
756 drv->driver.probe = serio_driver_probe;
757 drv->driver.remove = serio_driver_remove;
758 760
759 serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER); 761 serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER);
760} 762}