diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-12 21:27:47 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-12 21:27:47 -0400 |
commit | b981d8b3f5e008ff10d993be633ad00564fc22cd (patch) | |
tree | e292dc07b22308912cf6a58354a608b9e5e8e1fd /drivers/input/input.c | |
parent | b11d2127c4893a7315d1e16273bc8560049fa3ca (diff) | |
parent | 2b9e0aae1d50e880c58d46788e5e3ebd89d75d62 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/macintosh/adbhid.c
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 c59544f7e232..3070c7aa1237 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1067,87 +1067,66 @@ static void input_dev_release(struct device *device) | |||
1067 | * Input uevent interface - loading event handlers based on | 1067 | * Input uevent interface - loading event handlers based on |
1068 | * device bitfields. | 1068 | * device bitfields. |
1069 | */ | 1069 | */ |
1070 | static int input_add_uevent_bm_var(char **envp, int num_envp, int *cur_index, | 1070 | static int input_add_uevent_bm_var(struct kobj_uevent_env *env, |
1071 | char *buffer, int buffer_size, int *cur_len, | ||
1072 | const char *name, unsigned long *bitmap, int max) | 1071 | const char *name, unsigned long *bitmap, int max) |
1073 | { | 1072 | { |
1074 | if (*cur_index >= num_envp - 1) | 1073 | int len; |
1075 | return -ENOMEM; | ||
1076 | |||
1077 | envp[*cur_index] = buffer + *cur_len; | ||
1078 | 1074 | ||
1079 | *cur_len += snprintf(buffer + *cur_len, max(buffer_size - *cur_len, 0), name); | 1075 | if (add_uevent_var(env, "%s=", name)) |
1080 | if (*cur_len >= buffer_size) | ||
1081 | return -ENOMEM; | 1076 | return -ENOMEM; |
1082 | 1077 | ||
1083 | *cur_len += input_print_bitmap(buffer + *cur_len, | 1078 | len = input_print_bitmap(&env->buf[env->buflen - 1], |
1084 | max(buffer_size - *cur_len, 0), | 1079 | sizeof(env->buf) - env->buflen, |
1085 | bitmap, max, 0) + 1; | 1080 | bitmap, max, 0); |
1086 | if (*cur_len > buffer_size) | 1081 | if (len >= (sizeof(env->buf) - env->buflen)) |
1087 | return -ENOMEM; | 1082 | return -ENOMEM; |
1088 | 1083 | ||
1089 | (*cur_index)++; | 1084 | env->buflen += len; |
1090 | return 0; | 1085 | return 0; |
1091 | } | 1086 | } |
1092 | 1087 | ||
1093 | static int input_add_uevent_modalias_var(char **envp, int num_envp, int *cur_index, | 1088 | static int input_add_uevent_modalias_var(struct kobj_uevent_env *env, |
1094 | char *buffer, int buffer_size, int *cur_len, | ||
1095 | struct input_dev *dev) | 1089 | struct input_dev *dev) |
1096 | { | 1090 | { |
1097 | if (*cur_index >= num_envp - 1) | 1091 | int len; |
1098 | return -ENOMEM; | ||
1099 | |||
1100 | envp[*cur_index] = buffer + *cur_len; | ||
1101 | 1092 | ||
1102 | *cur_len += snprintf(buffer + *cur_len, max(buffer_size - *cur_len, 0), | 1093 | if (add_uevent_var(env, "MODALIAS=")) |
1103 | "MODALIAS="); | ||
1104 | if (*cur_len >= buffer_size) | ||
1105 | return -ENOMEM; | 1094 | return -ENOMEM; |
1106 | 1095 | ||
1107 | *cur_len += input_print_modalias(buffer + *cur_len, | 1096 | len = input_print_modalias(&env->buf[env->buflen - 1], |
1108 | max(buffer_size - *cur_len, 0), | 1097 | sizeof(env->buf) - env->buflen, |
1109 | dev, 0) + 1; | 1098 | dev, 0); |
1110 | if (*cur_len > buffer_size) | 1099 | if (len >= (sizeof(env->buf) - env->buflen)) |
1111 | return -ENOMEM; | 1100 | return -ENOMEM; |
1112 | 1101 | ||
1113 | (*cur_index)++; | 1102 | env->buflen += len; |
1114 | return 0; | 1103 | return 0; |
1115 | } | 1104 | } |
1116 | 1105 | ||
1117 | #define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ | 1106 | #define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ |
1118 | do { \ | 1107 | do { \ |
1119 | int err = add_uevent_var(envp, num_envp, &i, \ | 1108 | int err = add_uevent_var(env, fmt, val); \ |
1120 | buffer, buffer_size, &len, \ | ||
1121 | fmt, val); \ | ||
1122 | if (err) \ | 1109 | if (err) \ |
1123 | return err; \ | 1110 | return err; \ |
1124 | } while (0) | 1111 | } while (0) |
1125 | 1112 | ||
1126 | #define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \ | 1113 | #define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \ |
1127 | do { \ | 1114 | do { \ |
1128 | int err = input_add_uevent_bm_var(envp, num_envp, &i, \ | 1115 | int err = input_add_uevent_bm_var(env, name, bm, max); \ |
1129 | buffer, buffer_size, &len, \ | ||
1130 | name, bm, max); \ | ||
1131 | if (err) \ | 1116 | if (err) \ |
1132 | return err; \ | 1117 | return err; \ |
1133 | } while (0) | 1118 | } while (0) |
1134 | 1119 | ||
1135 | #define INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev) \ | 1120 | #define INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev) \ |
1136 | do { \ | 1121 | do { \ |
1137 | int err = input_add_uevent_modalias_var(envp, \ | 1122 | int err = input_add_uevent_modalias_var(env, dev); \ |
1138 | num_envp, &i, \ | ||
1139 | buffer, buffer_size, &len, \ | ||
1140 | dev); \ | ||
1141 | if (err) \ | 1123 | if (err) \ |
1142 | return err; \ | 1124 | return err; \ |
1143 | } while (0) | 1125 | } while (0) |
1144 | 1126 | ||
1145 | static int input_dev_uevent(struct device *device, char **envp, | 1127 | static int input_dev_uevent(struct device *device, struct kobj_uevent_env *env) |
1146 | int num_envp, char *buffer, int buffer_size) | ||
1147 | { | 1128 | { |
1148 | struct input_dev *dev = to_input_dev(device); | 1129 | struct input_dev *dev = to_input_dev(device); |
1149 | int i = 0; | ||
1150 | int len = 0; | ||
1151 | 1130 | ||
1152 | INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", | 1131 | INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", |
1153 | dev->id.bustype, dev->id.vendor, | 1132 | dev->id.bustype, dev->id.vendor, |
@@ -1179,7 +1158,6 @@ static int input_dev_uevent(struct device *device, char **envp, | |||
1179 | 1158 | ||
1180 | INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev); | 1159 | INPUT_ADD_HOTPLUG_MODALIAS_VAR(dev); |
1181 | 1160 | ||
1182 | envp[i] = NULL; | ||
1183 | return 0; | 1161 | return 0; |
1184 | } | 1162 | } |
1185 | 1163 | ||