Commit 66e66118837ed95a299328437c2d9fb4b5137352

Authored by Dmitry Torokhov
1 parent 5206c0d5ec

Input: constify input core

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Showing 9 changed files with 34 additions and 30 deletions Side-by-side Diff

drivers/char/keyboard.c
... ... @@ -1285,7 +1285,7 @@
1285 1285 */
1286 1286 static struct input_handle *kbd_connect(struct input_handler *handler,
1287 1287 struct input_dev *dev,
1288   - struct input_device_id *id)
  1288 + const struct input_device_id *id)
1289 1289 {
1290 1290 struct input_handle *handle;
1291 1291 int i;
... ... @@ -1334,7 +1334,7 @@
1334 1334 tasklet_enable(&keyboard_tasklet);
1335 1335 }
1336 1336  
1337   -static struct input_device_id kbd_ids[] = {
  1337 +static const struct input_device_id kbd_ids[] = {
1338 1338 {
1339 1339 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
1340 1340 .evbit = { BIT(EV_KEY) },
drivers/input/evbug.c
... ... @@ -42,10 +42,12 @@
42 42  
43 43 static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
44 44 {
45   - printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", handle->dev->phys, type, code, value);
  45 + printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n",
  46 + handle->dev->phys, type, code, value);
46 47 }
47 48  
48   -static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
  49 +static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev,
  50 + const struct input_device_id *id)
49 51 {
50 52 struct input_handle *handle;
51 53  
... ... @@ -72,7 +74,7 @@
72 74 kfree(handle);
73 75 }
74 76  
75   -static struct input_device_id evbug_ids[] = {
  77 +static const struct input_device_id evbug_ids[] = {
76 78 { .driver_info = 1 }, /* Matches all devices */
77 79 { }, /* Terminating zero entry */
78 80 };
drivers/input/evdev.c
... ... @@ -601,7 +601,7 @@
601 601 }
602 602 #endif
603 603  
604   -static struct file_operations evdev_fops = {
  604 +static const struct file_operations evdev_fops = {
605 605 .owner = THIS_MODULE,
606 606 .read = evdev_read,
607 607 .write = evdev_write,
... ... @@ -616,7 +616,8 @@
616 616 .flush = evdev_flush
617 617 };
618 618  
619   -static struct input_handle *evdev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
  619 +static struct input_handle *evdev_connect(struct input_handler *handler, struct input_dev *dev,
  620 + const struct input_device_id *id)
620 621 {
621 622 struct evdev *evdev;
622 623 struct class_device *cdev;
... ... @@ -675,7 +676,7 @@
675 676 evdev_free(evdev);
676 677 }
677 678  
678   -static struct input_device_id evdev_ids[] = {
  679 +static const struct input_device_id evdev_ids[] = {
679 680 { .driver_info = 1 }, /* Matches all devices */
680 681 { }, /* Terminating zero entry */
681 682 };
drivers/input/input.c
... ... @@ -313,7 +313,8 @@
313 313 if (i != NBITS(max)) \
314 314 continue;
315 315  
316   -static struct input_device_id *input_match_device(struct input_device_id *id, struct input_dev *dev)
  316 +static const struct input_device_id *input_match_device(const struct input_device_id *id,
  317 + struct input_dev *dev)
317 318 {
318 319 int i;
319 320  
... ... @@ -935,7 +936,7 @@
935 936 static atomic_t input_no = ATOMIC_INIT(0);
936 937 struct input_handle *handle;
937 938 struct input_handler *handler;
938   - struct input_device_id *id;
  939 + const struct input_device_id *id;
939 940 const char *path;
940 941 int error;
941 942  
... ... @@ -1050,7 +1051,7 @@
1050 1051 {
1051 1052 struct input_dev *dev;
1052 1053 struct input_handle *handle;
1053   - struct input_device_id *id;
  1054 + const struct input_device_id *id;
1054 1055  
1055 1056 if (!handler)
1056 1057 return;
drivers/input/joydev.c
... ... @@ -451,7 +451,7 @@
451 451 }
452 452 }
453 453  
454   -static struct file_operations joydev_fops = {
  454 +static const struct file_operations joydev_fops = {
455 455 .owner = THIS_MODULE,
456 456 .read = joydev_read,
457 457 .write = joydev_write,
... ... @@ -465,7 +465,8 @@
465 465 .fasync = joydev_fasync,
466 466 };
467 467  
468   -static struct input_handle *joydev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
  468 +static struct input_handle *joydev_connect(struct input_handler *handler, struct input_dev *dev,
  469 + const struct input_device_id *id)
469 470 {
470 471 struct joydev *joydev;
471 472 struct class_device *cdev;
... ... @@ -562,7 +563,7 @@
562 563 joydev_free(joydev);
563 564 }
564 565  
565   -static struct input_device_id joydev_blacklist[] = {
  566 +static const struct input_device_id joydev_blacklist[] = {
566 567 {
567 568 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
568 569 .evbit = { BIT(EV_KEY) },
... ... @@ -571,7 +572,7 @@
571 572 { } /* Terminating entry */
572 573 };
573 574  
574   -static struct input_device_id joydev_ids[] = {
  575 +static const struct input_device_id joydev_ids[] = {
575 576 {
576 577 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
577 578 .evbit = { BIT(EV_ABS) },
drivers/input/mousedev.c
... ... @@ -614,7 +614,7 @@
614 614 (list->mousedev->exist ? 0 : (POLLHUP | POLLERR));
615 615 }
616 616  
617   -static struct file_operations mousedev_fops = {
  617 +static const struct file_operations mousedev_fops = {
618 618 .owner = THIS_MODULE,
619 619 .read = mousedev_read,
620 620 .write = mousedev_write,
... ... @@ -624,7 +624,8 @@
624 624 .fasync = mousedev_fasync,
625 625 };
626 626  
627   -static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id)
  627 +static struct input_handle *mousedev_connect(struct input_handler *handler, struct input_dev *dev,
  628 + const struct input_device_id *id)
628 629 {
629 630 struct mousedev *mousedev;
630 631 struct class_device *cdev;
... ... @@ -688,7 +689,7 @@
688 689 }
689 690 }
690 691  
691   -static struct input_device_id mousedev_ids[] = {
  692 +static const struct input_device_id mousedev_ids[] = {
692 693 {
693 694 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_RELBIT,
694 695 .evbit = { BIT(EV_KEY) | BIT(EV_REL) },
drivers/input/power.c
... ... @@ -98,7 +98,7 @@
98 98  
99 99 static struct input_handle *power_connect(struct input_handler *handler,
100 100 struct input_dev *dev,
101   - struct input_device_id *id)
  101 + const struct input_device_id *id)
102 102 {
103 103 struct input_handle *handle;
104 104  
... ... @@ -120,7 +120,7 @@
120 120 kfree(handle);
121 121 }
122 122  
123   -static struct input_device_id power_ids[] = {
  123 +static const struct input_device_id power_ids[] = {
124 124 {
125 125 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
126 126 .evbit = { BIT(EV_KEY) },
drivers/input/tsdev.c
... ... @@ -135,8 +135,6 @@
135 135 #define TS_GET_CAL _IOR(IOC_H3600_TS_MAGIC, 10, struct ts_calibration)
136 136 #define TS_SET_CAL _IOW(IOC_H3600_TS_MAGIC, 11, struct ts_calibration)
137 137  
138   -static struct input_handler tsdev_handler;
139   -
140 138 static struct tsdev *tsdev_table[TSDEV_MINORS/2];
141 139  
142 140 static int tsdev_fasync(int fd, struct file *file, int on)
... ... @@ -263,7 +261,7 @@
263 261 return retval;
264 262 }
265 263  
266   -static struct file_operations tsdev_fops = {
  264 +static const struct file_operations tsdev_fops = {
267 265 .owner = THIS_MODULE,
268 266 .open = tsdev_open,
269 267 .release = tsdev_release,
... ... @@ -370,7 +368,7 @@
370 368  
371 369 static struct input_handle *tsdev_connect(struct input_handler *handler,
372 370 struct input_dev *dev,
373   - struct input_device_id *id)
  371 + const struct input_device_id *id)
374 372 {
375 373 struct tsdev *tsdev;
376 374 struct class_device *cdev;
... ... @@ -443,7 +441,7 @@
443 441 tsdev_free(tsdev);
444 442 }
445 443  
446   -static struct input_device_id tsdev_ids[] = {
  444 +static const struct input_device_id tsdev_ids[] = {
447 445 {
448 446 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_RELBIT,
449 447 .evbit = { BIT(EV_KEY) | BIT(EV_REL) },
include/linux/input.h
... ... @@ -1059,16 +1059,16 @@
1059 1059 void *private;
1060 1060  
1061 1061 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1062   - struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
  1062 + struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
1063 1063 void (*disconnect)(struct input_handle *handle);
1064 1064 void (*start)(struct input_handle *handle);
1065 1065  
1066 1066 const struct file_operations *fops;
1067 1067 int minor;
1068   - char *name;
  1068 + const char *name;
1069 1069  
1070   - struct input_device_id *id_table;
1071   - struct input_device_id *blacklist;
  1070 + const struct input_device_id *id_table;
  1071 + const struct input_device_id *blacklist;
1072 1072  
1073 1073 struct list_head h_list;
1074 1074 struct list_head node;
... ... @@ -1079,7 +1079,7 @@
1079 1079 void *private;
1080 1080  
1081 1081 int open;
1082   - char *name;
  1082 + const char *name;
1083 1083  
1084 1084 struct input_dev *dev;
1085 1085 struct input_handler *handler;