diff options
Diffstat (limited to 'drivers/input/input.c')
| -rw-r--r-- | drivers/input/input.c | 254 |
1 files changed, 169 insertions, 85 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 8921c6180c51..5244f3d05b12 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -47,6 +47,8 @@ static DEFINE_MUTEX(input_mutex); | |||
| 47 | 47 | ||
| 48 | static struct input_handler *input_table[8]; | 48 | static struct input_handler *input_table[8]; |
| 49 | 49 | ||
| 50 | static const struct input_value input_value_sync = { EV_SYN, SYN_REPORT, 1 }; | ||
| 51 | |||
| 50 | static inline int is_event_supported(unsigned int code, | 52 | static inline int is_event_supported(unsigned int code, |
| 51 | unsigned long *bm, unsigned int max) | 53 | unsigned long *bm, unsigned int max) |
| 52 | { | 54 | { |
| @@ -69,42 +71,102 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz) | |||
| 69 | return value; | 71 | return value; |
| 70 | } | 72 | } |
| 71 | 73 | ||
| 74 | static void input_start_autorepeat(struct input_dev *dev, int code) | ||
| 75 | { | ||
| 76 | if (test_bit(EV_REP, dev->evbit) && | ||
| 77 | dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] && | ||
| 78 | dev->timer.data) { | ||
| 79 | dev->repeat_key = code; | ||
| 80 | mod_timer(&dev->timer, | ||
| 81 | jiffies + msecs_to_jiffies(dev->rep[REP_DELAY])); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | static void input_stop_autorepeat(struct input_dev *dev) | ||
| 86 | { | ||
| 87 | del_timer(&dev->timer); | ||
| 88 | } | ||
| 89 | |||
| 72 | /* | 90 | /* |
| 73 | * Pass event first through all filters and then, if event has not been | 91 | * Pass event first through all filters and then, if event has not been |
| 74 | * filtered out, through all open handles. This function is called with | 92 | * filtered out, through all open handles. This function is called with |
| 75 | * dev->event_lock held and interrupts disabled. | 93 | * dev->event_lock held and interrupts disabled. |
| 76 | */ | 94 | */ |
| 77 | static void input_pass_event(struct input_dev *dev, | 95 | static unsigned int input_to_handler(struct input_handle *handle, |
| 78 | unsigned int type, unsigned int code, int value) | 96 | struct input_value *vals, unsigned int count) |
| 97 | { | ||
| 98 | struct input_handler *handler = handle->handler; | ||
| 99 | struct input_value *end = vals; | ||
| 100 | struct input_value *v; | ||
| 101 | |||
| 102 | for (v = vals; v != vals + count; v++) { | ||
| 103 | if (handler->filter && | ||
| 104 | handler->filter(handle, v->type, v->code, v->value)) | ||
| 105 | continue; | ||
| 106 | if (end != v) | ||
| 107 | *end = *v; | ||
| 108 | end++; | ||
| 109 | } | ||
| 110 | |||
| 111 | count = end - vals; | ||
| 112 | if (!count) | ||
| 113 | return 0; | ||
| 114 | |||
| 115 | if (handler->events) | ||
| 116 | handler->events(handle, vals, count); | ||
| 117 | else if (handler->event) | ||
| 118 | for (v = vals; v != end; v++) | ||
| 119 | handler->event(handle, v->type, v->code, v->value); | ||
| 120 | |||
| 121 | return count; | ||
| 122 | } | ||
| 123 | |||
| 124 | /* | ||
| 125 | * Pass values first through all filters and then, if event has not been | ||
| 126 | * filtered out, through all open handles. This function is called with | ||
| 127 | * dev->event_lock held and interrupts disabled. | ||
| 128 | */ | ||
| 129 | static void input_pass_values(struct input_dev *dev, | ||
| 130 | struct input_value *vals, unsigned int count) | ||
| 79 | { | 131 | { |
| 80 | struct input_handler *handler; | ||
| 81 | struct input_handle *handle; | 132 | struct input_handle *handle; |
| 133 | struct input_value *v; | ||
| 134 | |||
| 135 | if (!count) | ||
| 136 | return; | ||
| 82 | 137 | ||
| 83 | rcu_read_lock(); | 138 | rcu_read_lock(); |
| 84 | 139 | ||
| 85 | handle = rcu_dereference(dev->grab); | 140 | handle = rcu_dereference(dev->grab); |
| 86 | if (handle) | 141 | if (handle) { |
| 87 | handle->handler->event(handle, type, code, value); | 142 | count = input_to_handler(handle, vals, count); |
| 88 | else { | 143 | } else { |
| 89 | bool filtered = false; | 144 | list_for_each_entry_rcu(handle, &dev->h_list, d_node) |
| 90 | 145 | if (handle->open) | |
| 91 | list_for_each_entry_rcu(handle, &dev->h_list, d_node) { | 146 | count = input_to_handler(handle, vals, count); |
| 92 | if (!handle->open) | 147 | } |
| 93 | continue; | ||
| 94 | 148 | ||
| 95 | handler = handle->handler; | 149 | rcu_read_unlock(); |
| 96 | if (!handler->filter) { | ||
| 97 | if (filtered) | ||
| 98 | break; | ||
| 99 | 150 | ||
| 100 | handler->event(handle, type, code, value); | 151 | add_input_randomness(vals->type, vals->code, vals->value); |
| 101 | 152 | ||
| 102 | } else if (handler->filter(handle, type, code, value)) | 153 | /* trigger auto repeat for key events */ |
| 103 | filtered = true; | 154 | for (v = vals; v != vals + count; v++) { |
| 155 | if (v->type == EV_KEY && v->value != 2) { | ||
| 156 | if (v->value) | ||
| 157 | input_start_autorepeat(dev, v->code); | ||
| 158 | else | ||
| 159 | input_stop_autorepeat(dev); | ||
| 104 | } | 160 | } |
| 105 | } | 161 | } |
| 162 | } | ||
| 106 | 163 | ||
| 107 | rcu_read_unlock(); | 164 | static void input_pass_event(struct input_dev *dev, |
| 165 | unsigned int type, unsigned int code, int value) | ||
| 166 | { | ||
| 167 | struct input_value vals[] = { { type, code, value } }; | ||
| 168 | |||
| 169 | input_pass_values(dev, vals, ARRAY_SIZE(vals)); | ||
| 108 | } | 170 | } |
| 109 | 171 | ||
| 110 | /* | 172 | /* |
| @@ -121,18 +183,12 @@ static void input_repeat_key(unsigned long data) | |||
| 121 | 183 | ||
| 122 | if (test_bit(dev->repeat_key, dev->key) && | 184 | if (test_bit(dev->repeat_key, dev->key) && |
| 123 | is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { | 185 | is_event_supported(dev->repeat_key, dev->keybit, KEY_MAX)) { |
| 186 | struct input_value vals[] = { | ||
| 187 | { EV_KEY, dev->repeat_key, 2 }, | ||
| 188 | input_value_sync | ||
| 189 | }; | ||
| 124 | 190 | ||
| 125 | input_pass_event(dev, EV_KEY, dev->repeat_key, 2); | 191 | input_pass_values(dev, vals, ARRAY_SIZE(vals)); |
| 126 | |||
| 127 | if (dev->sync) { | ||
| 128 | /* | ||
| 129 | * Only send SYN_REPORT if we are not in a middle | ||
| 130 | * of driver parsing a new hardware packet. | ||
| 131 | * Otherwise assume that the driver will send | ||
| 132 | * SYN_REPORT once it's done. | ||
| 133 | */ | ||
| 134 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); | ||
| 135 | } | ||
| 136 | 192 | ||
| 137 | if (dev->rep[REP_PERIOD]) | 193 | if (dev->rep[REP_PERIOD]) |
| 138 | mod_timer(&dev->timer, jiffies + | 194 | mod_timer(&dev->timer, jiffies + |
| @@ -142,30 +198,17 @@ static void input_repeat_key(unsigned long data) | |||
| 142 | spin_unlock_irqrestore(&dev->event_lock, flags); | 198 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 143 | } | 199 | } |
| 144 | 200 | ||
| 145 | static void input_start_autorepeat(struct input_dev *dev, int code) | ||
| 146 | { | ||
| 147 | if (test_bit(EV_REP, dev->evbit) && | ||
| 148 | dev->rep[REP_PERIOD] && dev->rep[REP_DELAY] && | ||
| 149 | dev->timer.data) { | ||
| 150 | dev->repeat_key = code; | ||
| 151 | mod_timer(&dev->timer, | ||
| 152 | jiffies + msecs_to_jiffies(dev->rep[REP_DELAY])); | ||
| 153 | } | ||
| 154 | } | ||
| 155 | |||
| 156 | static void input_stop_autorepeat(struct input_dev *dev) | ||
| 157 | { | ||
| 158 | del_timer(&dev->timer); | ||
| 159 | } | ||
| 160 | |||
| 161 | #define INPUT_IGNORE_EVENT 0 | 201 | #define INPUT_IGNORE_EVENT 0 |
| 162 | #define INPUT_PASS_TO_HANDLERS 1 | 202 | #define INPUT_PASS_TO_HANDLERS 1 |
| 163 | #define INPUT_PASS_TO_DEVICE 2 | 203 | #define INPUT_PASS_TO_DEVICE 2 |
| 204 | #define INPUT_SLOT 4 | ||
| 205 | #define INPUT_FLUSH 8 | ||
| 164 | #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) | 206 | #define INPUT_PASS_TO_ALL (INPUT_PASS_TO_HANDLERS | INPUT_PASS_TO_DEVICE) |
| 165 | 207 | ||
| 166 | static int input_handle_abs_event(struct input_dev *dev, | 208 | static int input_handle_abs_event(struct input_dev *dev, |
| 167 | unsigned int code, int *pval) | 209 | unsigned int code, int *pval) |
| 168 | { | 210 | { |
| 211 | struct input_mt *mt = dev->mt; | ||
| 169 | bool is_mt_event; | 212 | bool is_mt_event; |
| 170 | int *pold; | 213 | int *pold; |
| 171 | 214 | ||
| @@ -174,8 +217,8 @@ static int input_handle_abs_event(struct input_dev *dev, | |||
| 174 | * "Stage" the event; we'll flush it later, when we | 217 | * "Stage" the event; we'll flush it later, when we |
| 175 | * get actual touch data. | 218 | * get actual touch data. |
| 176 | */ | 219 | */ |
| 177 | if (*pval >= 0 && *pval < dev->mtsize) | 220 | if (mt && *pval >= 0 && *pval < mt->num_slots) |
| 178 | dev->slot = *pval; | 221 | mt->slot = *pval; |
| 179 | 222 | ||
| 180 | return INPUT_IGNORE_EVENT; | 223 | return INPUT_IGNORE_EVENT; |
| 181 | } | 224 | } |
| @@ -184,9 +227,8 @@ static int input_handle_abs_event(struct input_dev *dev, | |||
| 184 | 227 | ||
| 185 | if (!is_mt_event) { | 228 | if (!is_mt_event) { |
| 186 | pold = &dev->absinfo[code].value; | 229 | pold = &dev->absinfo[code].value; |
| 187 | } else if (dev->mt) { | 230 | } else if (mt) { |
| 188 | struct input_mt_slot *mtslot = &dev->mt[dev->slot]; | 231 | pold = &mt->slots[mt->slot].abs[code - ABS_MT_FIRST]; |
| 189 | pold = &mtslot->abs[code - ABS_MT_FIRST]; | ||
| 190 | } else { | 232 | } else { |
| 191 | /* | 233 | /* |
| 192 | * Bypass filtering for multi-touch events when | 234 | * Bypass filtering for multi-touch events when |
| @@ -205,16 +247,16 @@ static int input_handle_abs_event(struct input_dev *dev, | |||
| 205 | } | 247 | } |
| 206 | 248 | ||
| 207 | /* Flush pending "slot" event */ | 249 | /* Flush pending "slot" event */ |
| 208 | if (is_mt_event && dev->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { | 250 | if (is_mt_event && mt && mt->slot != input_abs_get_val(dev, ABS_MT_SLOT)) { |
| 209 | input_abs_set_val(dev, ABS_MT_SLOT, dev->slot); | 251 | input_abs_set_val(dev, ABS_MT_SLOT, mt->slot); |
| 210 | input_pass_event(dev, EV_ABS, ABS_MT_SLOT, dev->slot); | 252 | return INPUT_PASS_TO_HANDLERS | INPUT_SLOT; |
| 211 | } | 253 | } |
| 212 | 254 | ||
| 213 | return INPUT_PASS_TO_HANDLERS; | 255 | return INPUT_PASS_TO_HANDLERS; |
| 214 | } | 256 | } |
| 215 | 257 | ||
| 216 | static void input_handle_event(struct input_dev *dev, | 258 | static int input_get_disposition(struct input_dev *dev, |
| 217 | unsigned int type, unsigned int code, int value) | 259 | unsigned int type, unsigned int code, int value) |
| 218 | { | 260 | { |
| 219 | int disposition = INPUT_IGNORE_EVENT; | 261 | int disposition = INPUT_IGNORE_EVENT; |
| 220 | 262 | ||
| @@ -227,37 +269,34 @@ static void input_handle_event(struct input_dev *dev, | |||
| 227 | break; | 269 | break; |
| 228 | 270 | ||
| 229 | case SYN_REPORT: | 271 | case SYN_REPORT: |
| 230 | if (!dev->sync) { | 272 | disposition = INPUT_PASS_TO_HANDLERS | INPUT_FLUSH; |
| 231 | dev->sync = true; | ||
| 232 | disposition = INPUT_PASS_TO_HANDLERS; | ||
| 233 | } | ||
| 234 | break; | 273 | break; |
| 235 | case SYN_MT_REPORT: | 274 | case SYN_MT_REPORT: |
| 236 | dev->sync = false; | ||
| 237 | disposition = INPUT_PASS_TO_HANDLERS; | 275 | disposition = INPUT_PASS_TO_HANDLERS; |
| 238 | break; | 276 | break; |
| 239 | } | 277 | } |
| 240 | break; | 278 | break; |
| 241 | 279 | ||
| 242 | case EV_KEY: | 280 | case EV_KEY: |
| 243 | if (is_event_supported(code, dev->keybit, KEY_MAX) && | 281 | if (is_event_supported(code, dev->keybit, KEY_MAX)) { |
| 244 | !!test_bit(code, dev->key) != value) { | ||
| 245 | 282 | ||
| 246 | if (value != 2) { | 283 | /* auto-repeat bypasses state updates */ |
| 247 | __change_bit(code, dev->key); | 284 | if (value == 2) { |
| 248 | if (value) | 285 | disposition = INPUT_PASS_TO_HANDLERS; |
| 249 | input_start_autorepeat(dev, code); | 286 | break; |
| 250 | else | ||
| 251 | input_stop_autorepeat(dev); | ||
| 252 | } | 287 | } |
| 253 | 288 | ||
| 254 | disposition = INPUT_PASS_TO_HANDLERS; | 289 | if (!!test_bit(code, dev->key) != !!value) { |
| 290 | |||
| 291 | __change_bit(code, dev->key); | ||
| 292 | disposition = INPUT_PASS_TO_HANDLERS; | ||
| 293 | } | ||
| 255 | } | 294 | } |
| 256 | break; | 295 | break; |
| 257 | 296 | ||
| 258 | case EV_SW: | 297 | case EV_SW: |
| 259 | if (is_event_supported(code, dev->swbit, SW_MAX) && | 298 | if (is_event_supported(code, dev->swbit, SW_MAX) && |
| 260 | !!test_bit(code, dev->sw) != value) { | 299 | !!test_bit(code, dev->sw) != !!value) { |
| 261 | 300 | ||
| 262 | __change_bit(code, dev->sw); | 301 | __change_bit(code, dev->sw); |
| 263 | disposition = INPUT_PASS_TO_HANDLERS; | 302 | disposition = INPUT_PASS_TO_HANDLERS; |
| @@ -284,7 +323,7 @@ static void input_handle_event(struct input_dev *dev, | |||
| 284 | 323 | ||
| 285 | case EV_LED: | 324 | case EV_LED: |
| 286 | if (is_event_supported(code, dev->ledbit, LED_MAX) && | 325 | if (is_event_supported(code, dev->ledbit, LED_MAX) && |
| 287 | !!test_bit(code, dev->led) != value) { | 326 | !!test_bit(code, dev->led) != !!value) { |
| 288 | 327 | ||
| 289 | __change_bit(code, dev->led); | 328 | __change_bit(code, dev->led); |
| 290 | disposition = INPUT_PASS_TO_ALL; | 329 | disposition = INPUT_PASS_TO_ALL; |
| @@ -317,14 +356,48 @@ static void input_handle_event(struct input_dev *dev, | |||
| 317 | break; | 356 | break; |
| 318 | } | 357 | } |
| 319 | 358 | ||
| 320 | if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN) | 359 | return disposition; |
| 321 | dev->sync = false; | 360 | } |
| 361 | |||
| 362 | static void input_handle_event(struct input_dev *dev, | ||
| 363 | unsigned int type, unsigned int code, int value) | ||
| 364 | { | ||
| 365 | int disposition; | ||
| 366 | |||
| 367 | disposition = input_get_disposition(dev, type, code, value); | ||
| 322 | 368 | ||
| 323 | if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) | 369 | if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) |
| 324 | dev->event(dev, type, code, value); | 370 | dev->event(dev, type, code, value); |
| 325 | 371 | ||
| 326 | if (disposition & INPUT_PASS_TO_HANDLERS) | 372 | if (!dev->vals) |
| 327 | input_pass_event(dev, type, code, value); | 373 | return; |
| 374 | |||
| 375 | if (disposition & INPUT_PASS_TO_HANDLERS) { | ||
| 376 | struct input_value *v; | ||
| 377 | |||
| 378 | if (disposition & INPUT_SLOT) { | ||
| 379 | v = &dev->vals[dev->num_vals++]; | ||
| 380 | v->type = EV_ABS; | ||
| 381 | v->code = ABS_MT_SLOT; | ||
| 382 | v->value = dev->mt->slot; | ||
| 383 | } | ||
| 384 | |||
| 385 | v = &dev->vals[dev->num_vals++]; | ||
| 386 | v->type = type; | ||
| 387 | v->code = code; | ||
| 388 | v->value = value; | ||
| 389 | } | ||
| 390 | |||
| 391 | if (disposition & INPUT_FLUSH) { | ||
| 392 | if (dev->num_vals >= 2) | ||
| 393 | input_pass_values(dev, dev->vals, dev->num_vals); | ||
| 394 | dev->num_vals = 0; | ||
| 395 | } else if (dev->num_vals >= dev->max_vals - 2) { | ||
| 396 | dev->vals[dev->num_vals++] = input_value_sync; | ||
| 397 | input_pass_values(dev, dev->vals, dev->num_vals); | ||
| 398 | dev->num_vals = 0; | ||
| 399 | } | ||
| 400 | |||
| 328 | } | 401 | } |
| 329 | 402 | ||
| 330 | /** | 403 | /** |
| @@ -352,7 +425,6 @@ void input_event(struct input_dev *dev, | |||
| 352 | if (is_event_supported(type, dev->evbit, EV_MAX)) { | 425 | if (is_event_supported(type, dev->evbit, EV_MAX)) { |
| 353 | 426 | ||
| 354 | spin_lock_irqsave(&dev->event_lock, flags); | 427 | spin_lock_irqsave(&dev->event_lock, flags); |
| 355 | add_input_randomness(type, code, value); | ||
| 356 | input_handle_event(dev, type, code, value); | 428 | input_handle_event(dev, type, code, value); |
| 357 | spin_unlock_irqrestore(&dev->event_lock, flags); | 429 | spin_unlock_irqrestore(&dev->event_lock, flags); |
| 358 | } | 430 | } |
| @@ -831,10 +903,12 @@ int input_set_keycode(struct input_dev *dev, | |||
| 831 | if (test_bit(EV_KEY, dev->evbit) && | 903 | if (test_bit(EV_KEY, dev->evbit) && |
| 832 | !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && | 904 | !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && |
| 833 | __test_and_clear_bit(old_keycode, dev->key)) { | 905 | __test_and_clear_bit(old_keycode, dev->key)) { |
| 906 | struct input_value vals[] = { | ||
| 907 | { EV_KEY, old_keycode, 0 }, | ||
| 908 | input_value_sync | ||
| 909 | }; | ||
| 834 | 910 | ||
| 835 | input_pass_event(dev, EV_KEY, old_keycode, 0); | 911 | input_pass_values(dev, vals, ARRAY_SIZE(vals)); |
| 836 | if (dev->sync) | ||
| 837 | input_pass_event(dev, EV_SYN, SYN_REPORT, 1); | ||
| 838 | } | 912 | } |
| 839 | 913 | ||
| 840 | out: | 914 | out: |
| @@ -1416,6 +1490,7 @@ static void input_dev_release(struct device *device) | |||
| 1416 | input_ff_destroy(dev); | 1490 | input_ff_destroy(dev); |
| 1417 | input_mt_destroy_slots(dev); | 1491 | input_mt_destroy_slots(dev); |
| 1418 | kfree(dev->absinfo); | 1492 | kfree(dev->absinfo); |
| 1493 | kfree(dev->vals); | ||
| 1419 | kfree(dev); | 1494 | kfree(dev); |
| 1420 | 1495 | ||
| 1421 | module_put(THIS_MODULE); | 1496 | module_put(THIS_MODULE); |
| @@ -1751,8 +1826,8 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev) | |||
| 1751 | int i; | 1826 | int i; |
| 1752 | unsigned int events; | 1827 | unsigned int events; |
| 1753 | 1828 | ||
| 1754 | if (dev->mtsize) { | 1829 | if (dev->mt) { |
| 1755 | mt_slots = dev->mtsize; | 1830 | mt_slots = dev->mt->num_slots; |
| 1756 | } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) { | 1831 | } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) { |
| 1757 | mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum - | 1832 | mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum - |
| 1758 | dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1, | 1833 | dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1, |
| @@ -1778,6 +1853,9 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev) | |||
| 1778 | if (test_bit(i, dev->relbit)) | 1853 | if (test_bit(i, dev->relbit)) |
| 1779 | events++; | 1854 | events++; |
| 1780 | 1855 | ||
| 1856 | /* Make room for KEY and MSC events */ | ||
| 1857 | events += 7; | ||
| 1858 | |||
| 1781 | return events; | 1859 | return events; |
| 1782 | } | 1860 | } |
| 1783 | 1861 | ||
| @@ -1816,6 +1894,7 @@ int input_register_device(struct input_dev *dev) | |||
| 1816 | { | 1894 | { |
| 1817 | static atomic_t input_no = ATOMIC_INIT(0); | 1895 | static atomic_t input_no = ATOMIC_INIT(0); |
| 1818 | struct input_handler *handler; | 1896 | struct input_handler *handler; |
| 1897 | unsigned int packet_size; | ||
| 1819 | const char *path; | 1898 | const char *path; |
| 1820 | int error; | 1899 | int error; |
| 1821 | 1900 | ||
| @@ -1828,9 +1907,14 @@ int input_register_device(struct input_dev *dev) | |||
| 1828 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ | 1907 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ |
| 1829 | input_cleanse_bitmasks(dev); | 1908 | input_cleanse_bitmasks(dev); |
| 1830 | 1909 | ||
| 1831 | if (!dev->hint_events_per_packet) | 1910 | packet_size = input_estimate_events_per_packet(dev); |
| 1832 | dev->hint_events_per_packet = | 1911 | if (dev->hint_events_per_packet < packet_size) |
| 1833 | input_estimate_events_per_packet(dev); | 1912 | dev->hint_events_per_packet = packet_size; |
| 1913 | |||
| 1914 | dev->max_vals = max(dev->hint_events_per_packet, packet_size) + 2; | ||
| 1915 | dev->vals = kcalloc(dev->max_vals, sizeof(*dev->vals), GFP_KERNEL); | ||
| 1916 | if (!dev->vals) | ||
| 1917 | return -ENOMEM; | ||
| 1834 | 1918 | ||
| 1835 | /* | 1919 | /* |
| 1836 | * If delay and period are pre-set by the driver, then autorepeating | 1920 | * If delay and period are pre-set by the driver, then autorepeating |
