diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-12 18:49:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-12 18:49:37 -0400 |
commit | efefc6eb38d43b8e5daef482f575d767b002004e (patch) | |
tree | 8a3933db1f8721f9bcc9912c800dc8406f4bdf94 /drivers/input/input.c | |
parent | 117494a1b65183f0e3fcc817b07944bc5c465050 (diff) | |
parent | cd59abfcc441b2abb4cf2cd62c1eb0f02a60e8dd (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (75 commits)
PM: merge device power-management source files
sysfs: add copyrights
kobject: update the copyrights
kset: add some kerneldoc to help describe what these strange things are
Driver core: rename ktype_edd and ktype_efivar
Driver core: rename ktype_driver
Driver core: rename ktype_device
Driver core: rename ktype_class
driver core: remove subsystem_init()
sysfs: move sysfs file poll implementation to sysfs_open_dirent
sysfs: implement sysfs_open_dirent
sysfs: move sysfs_dirent->s_children into sysfs_dirent->s_dir
sysfs: make sysfs_root a regular directory dirent
sysfs: open code sysfs_attach_dentry()
sysfs: make s_elem an anonymous union
sysfs: make bin attr open get active reference of parent too
sysfs: kill unnecessary NULL pointer check in sysfs_release()
sysfs: kill unnecessary sysfs_get() in open paths
sysfs: reposition sysfs_dirent->s_mode.
sysfs: kill sysfs_update_file()
...
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 5fe755586623..5dc361c954e2 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -859,87 +859,66 @@ static void input_dev_release(struct device *device) | |||
859 | * Input uevent interface - loading event handlers based on | 859 | * Input uevent interface - loading event handlers based on |
860 | * device bitfields. | 860 | * device bitfields. |
861 | */ | 861 | */ |
862 | static int input_add_uevent_bm_var(char **envp, int num_envp, int *cur_index, | 862 | static int input_add_uevent_bm_var(struct kobj_uevent_env *env, |
863 | char *buffer, int buffer_size, int *cur_len, | ||
864 | const char *name, unsigned long *bitmap, int max) | 863 | const char *name, unsigned long *bitmap, int max) |
865 | { | 864 | { |
866 | if (*cur_index >= num_envp - 1) | 865 | int len; |
867 | return -ENOMEM; | ||
868 | |||
869 | envp[*cur_index] = buffer + *cur_len; | ||
870 | 866 | ||
871 | *cur_len += snprintf(buffer + *cur_len, max(buffer_size - *cur_len, 0), name); | 867 | if (add_uevent_var(env, "%s=", name)) |
872 | if (*cur_len >= buffer_size) | ||
873 | return -ENOMEM; | 868 | return -ENOMEM; |
874 | 869 | ||
875 | *cur_len += input_print_bitmap(buffer + *cur_len, | 870 | len = input_print_bitmap(&env->buf[env->buflen - 1], |
876 | max(buffer_size - *cur_len, 0), | 871 | sizeof(env->buf) - env->buflen, |
877 | bitmap, max, 0) + 1; | 872 | bitmap, max, 0); |
878 | if (*cur_len > buffer_size) | 873 | if (len >= (sizeof(env->buf) - env->buflen)) |
879 | return -ENOMEM; | 874 | return -ENOMEM; |
880 | 875 | ||
881 | (*cur_index)++; | 876 | env->buflen += len; |
882 | return 0; | 877 | return 0; |
883 | } | 878 | } |
884 | 879 | ||
885 | static int input_add_uevent_modalias_var(char **envp, int num_envp, int *cur_index, | 880 | static int input_add_uevent_modalias_var(struct kobj_uevent_env *env, |
886 | char *buffer, int buffer_size, int *cur_len, | ||
887 | struct input_dev *dev) | 881 | struct input_dev *dev) |
888 | { | 882 | { |
889 | if (*cur_index >= num_envp - 1) | 883 | int len; |
890 | return -ENOMEM; | ||
891 | |||
892 | envp[*cur_index] = buffer + *cur_len; | ||
893 | 884 | ||
894 | *cur_len += snprintf(buffer + *cur_len, max(buffer_size - *cur_len, 0), | 885 | if (add_uevent_var(env, "MODALIAS=")) |
895 | "MODALIAS="); | ||
896 | if (*cur_len >= buffer_size) | ||
897 | return -ENOMEM; | 886 | return -ENOMEM; |
898 | 887 | ||
899 | *cur_len += input_print_modalias(buffer + *cur_len, | 888 | len = input_print_modalias(&env->buf[env->buflen - 1], |
900 | max(buffer_size - *cur_len, 0), | 889 | sizeof(env->buf) - env->buflen, |
901 | dev, 0) + 1; | 890 | dev, 0); |
902 | if (*cur_len > buffer_size) | 891 | if (len >= (sizeof(env->buf) - env->buflen)) |
903 | return -ENOMEM; | 892 | return -ENOMEM; |
904 | 893 | ||
905 | (*cur_index)++; | 894 | env->buflen += len; |
906 | return 0; | 895 | return 0; |
907 | } | 896 | } |
908 | 897 | ||
909 | #define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ | 898 | #define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ |
910 | do { \ | 899 | do { \ |
911 | int err = add_uevent_var(envp, num_envp, &i, \ | 900 | int err = add_uevent_var(env, fmt, val); \ |
912 | buffer, buffer_size, &len, \ | ||
913 | fmt, val); \ | ||
914 | if (err) \ | 901 | if (err) \ |
915 | return err; \ | 902 | return err; \ |
916 | } while (0) | 903 | } while (0) |
917 | 904 | ||
918 | #define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \ | 905 | #define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \ |
919 | do { \ | 906 | do { \ |
920 | int err = input_add_uevent_bm_var(envp, num_envp, &i, \ | 907 | int err = input_add_uevent_bm_var(env, name, bm, max); \ |
921 | buffer, buffer_size, &len, \ | ||
922 | name, bm, max); \ | ||
923 | if (err) \ | 908 | if (err) \ |
924 | return err; \ | 909 | return err; \ |
925 | } while (0) | 910 | } while (0) |
926 | 911 | ||
927 | #define INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev) \ | 912 | #define INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev) \ |
928 | do { \ | 913 | do { \ |
929 | int err = input_add_uevent_modalias_var(envp, \ | 914 | int err = input_add_uevent_modalias_var(env, dev); \ |
930 | num_envp, &i, \ | ||
931 | buffer, buffer_size, &len, \ | ||
932 | dev); \ | ||
933 | if (err) \ | 915 | if (err) \ |
934 | return err; \ | 916 | return err; \ |
935 | } while (0) | 917 | } while (0) |
936 | 918 | ||
937 | static int input_dev_uevent(struct device *device, char **envp, | 919 | static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env) |
938 | int num_envp, char *buffer, int buffer_size) | ||
939 | { | 920 | { |
940 | struct input_dev *dev = to_input_dev(device); | 921 | struct input_dev *dev = to_input_dev(device); |
941 | int i = 0; | ||
942 | int len = 0; | ||
943 | 922 | ||
944 | INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", | 923 | INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", |
945 | dev->id.bustype, dev->id.vendor, | 924 | dev->id.bustype, dev->id.vendor, |
@@ -971,7 +950,6 @@ static int input_dev_uevent(struct device *device, char **envp, | |||
971 | 950 | ||
972 | INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev); | 951 | INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev); |
973 | 952 | ||
974 | envp[i] = NULL; | ||
975 | return 0; | 953 | return 0; |
976 | } | 954 | } |
977 | 955 | ||