aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 21:44:12 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 21:44:12 -0500
commitdb9edfd7e339ca4113153d887e782dd05be5a9eb (patch)
tree0a4ba12447a0cabc800adc7e9667d284777b0181 /drivers/input
parent631b034724364b413e8a52e7c2e03a9d77e4c2b4 (diff)
parentfd586bacf439f36dea9b9bf6e6133ac87df2730c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
Trivial manual merge fixup for usb_find_interface clashes.
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/input.c54
-rw-r--r--drivers/input/serio/serio.c22
2 files changed, 57 insertions, 19 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index bdd2a7fc268d..ef5824c8846b 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -18,7 +18,6 @@
18#include <linux/random.h> 18#include <linux/random.h>
19#include <linux/major.h> 19#include <linux/major.h>
20#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
21#include <linux/kobject_uevent.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
23#include <linux/poll.h> 22#include <linux/poll.h>
24#include <linux/device.h> 23#include <linux/device.h>
@@ -529,10 +528,49 @@ INPUT_DEV_STRING_ATTR_SHOW(name);
529INPUT_DEV_STRING_ATTR_SHOW(phys); 528INPUT_DEV_STRING_ATTR_SHOW(phys);
530INPUT_DEV_STRING_ATTR_SHOW(uniq); 529INPUT_DEV_STRING_ATTR_SHOW(uniq);
531 530
531static int print_modalias_bits(char *buf, char prefix, unsigned long *arr,
532 unsigned int min, unsigned int max)
533{
534 int len, i;
535
536 len = sprintf(buf, "%c", prefix);
537 for (i = min; i < max; i++)
538 if (arr[LONG(i)] & BIT(i))
539 len += sprintf(buf+len, "%X,", i);
540 return len;
541}
542
543static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf)
544{
545 struct input_dev *id = to_input_dev(dev);
546 ssize_t len = 0;
547
548 len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-",
549 id->id.bustype,
550 id->id.vendor,
551 id->id.product,
552 id->id.version);
553
554 len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX);
555 len += print_modalias_bits(buf+len, 'k', id->keybit,
556 KEY_MIN_INTERESTING, KEY_MAX);
557 len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX);
558 len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX);
559 len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX);
560 len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX);
561 len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX);
562 len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX);
563 len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX);
564 len += sprintf(buf+len, "\n");
565 return len;
566}
567static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL);
568
532static struct attribute *input_dev_attrs[] = { 569static struct attribute *input_dev_attrs[] = {
533 &class_device_attr_name.attr, 570 &class_device_attr_name.attr,
534 &class_device_attr_phys.attr, 571 &class_device_attr_phys.attr,
535 &class_device_attr_uniq.attr, 572 &class_device_attr_uniq.attr,
573 &class_device_attr_modalias.attr,
536 NULL 574 NULL
537}; 575};
538 576
@@ -611,10 +649,10 @@ static void input_dev_release(struct class_device *class_dev)
611} 649}
612 650
613/* 651/*
614 * Input hotplugging interface - loading event handlers based on 652 * Input uevent interface - loading event handlers based on
615 * device bitfields. 653 * device bitfields.
616 */ 654 */
617static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index, 655static int input_add_uevent_bm_var(char **envp, int num_envp, int *cur_index,
618 char *buffer, int buffer_size, int *cur_len, 656 char *buffer, int buffer_size, int *cur_len,
619 const char *name, unsigned long *bitmap, int max) 657 const char *name, unsigned long *bitmap, int max)
620{ 658{
@@ -639,7 +677,7 @@ static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index,
639 677
640#define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ 678#define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \
641 do { \ 679 do { \
642 int err = add_hotplug_env_var(envp, num_envp, &i, \ 680 int err = add_uevent_var(envp, num_envp, &i, \
643 buffer, buffer_size, &len, \ 681 buffer, buffer_size, &len, \
644 fmt, val); \ 682 fmt, val); \
645 if (err) \ 683 if (err) \
@@ -648,15 +686,15 @@ static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index,
648 686
649#define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \ 687#define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \
650 do { \ 688 do { \
651 int err = input_add_hotplug_bm_var(envp, num_envp, &i, \ 689 int err = input_add_uevent_bm_var(envp, num_envp, &i, \
652 buffer, buffer_size, &len, \ 690 buffer, buffer_size, &len, \
653 name, bm, max); \ 691 name, bm, max); \
654 if (err) \ 692 if (err) \
655 return err; \ 693 return err; \
656 } while (0) 694 } while (0)
657 695
658static int input_dev_hotplug(struct class_device *cdev, char **envp, 696static int input_dev_uevent(struct class_device *cdev, char **envp,
659 int num_envp, char *buffer, int buffer_size) 697 int num_envp, char *buffer, int buffer_size)
660{ 698{
661 struct input_dev *dev = to_input_dev(cdev); 699 struct input_dev *dev = to_input_dev(cdev);
662 int i = 0; 700 int i = 0;
@@ -698,7 +736,7 @@ static int input_dev_hotplug(struct class_device *cdev, char **envp,
698struct class input_class = { 736struct class input_class = {
699 .name = "input", 737 .name = "input",
700 .release = input_dev_release, 738 .release = input_dev_release,
701 .hotplug = input_dev_hotplug, 739 .uevent = input_dev_uevent,
702}; 740};
703 741
704struct input_dev *input_allocate_device(void) 742struct input_dev *input_allocate_device(void)
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index fbb69ef6a77b..8e530cc970e1 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -800,16 +800,16 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)
800 800
801#ifdef CONFIG_HOTPLUG 801#ifdef CONFIG_HOTPLUG
802 802
803#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \ 803#define SERIO_ADD_UEVENT_VAR(fmt, val...) \
804 do { \ 804 do { \
805 int err = add_hotplug_env_var(envp, num_envp, &i, \ 805 int err = add_uevent_var(envp, num_envp, &i, \
806 buffer, buffer_size, &len, \ 806 buffer, buffer_size, &len, \
807 fmt, val); \ 807 fmt, val); \
808 if (err) \ 808 if (err) \
809 return err; \ 809 return err; \
810 } while (0) 810 } while (0)
811 811
812static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 812static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
813{ 813{
814 struct serio *serio; 814 struct serio *serio;
815 int i = 0; 815 int i = 0;
@@ -820,21 +820,21 @@ static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *bu
820 820
821 serio = to_serio_port(dev); 821 serio = to_serio_port(dev);
822 822
823 SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type); 823 SERIO_ADD_UEVENT_VAR("SERIO_TYPE=%02x", serio->id.type);
824 SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto); 824 SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto);
825 SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id); 825 SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id);
826 SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra); 826 SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
827 SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", 827 SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
828 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); 828 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
829 envp[i] = NULL; 829 envp[i] = NULL;
830 830
831 return 0; 831 return 0;
832} 832}
833#undef SERIO_ADD_HOTPLUG_VAR 833#undef SERIO_ADD_UEVENT_VAR
834 834
835#else 835#else
836 836
837static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 837static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
838{ 838{
839 return -ENODEV; 839 return -ENODEV;
840} 840}
@@ -908,7 +908,7 @@ static int __init serio_init(void)
908 serio_bus.dev_attrs = serio_device_attrs; 908 serio_bus.dev_attrs = serio_device_attrs;
909 serio_bus.drv_attrs = serio_driver_attrs; 909 serio_bus.drv_attrs = serio_driver_attrs;
910 serio_bus.match = serio_bus_match; 910 serio_bus.match = serio_bus_match;
911 serio_bus.hotplug = serio_hotplug; 911 serio_bus.uevent = serio_uevent;
912 serio_bus.resume = serio_resume; 912 serio_bus.resume = serio_resume;
913 bus_register(&serio_bus); 913 bus_register(&serio_bus);
914 914