diff options
author | Helge Deller <deller@gmx.de> | 2006-09-10 21:54:39 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-09-10 21:54:39 -0400 |
commit | e38de678f6b19be3e46a678ec4deeaa7fa0fc140 (patch) | |
tree | aa7cd756abae71bb820cb14ea53675f68924bdd4 /drivers | |
parent | e2df452b8adca9d3e3195ff7d91be375342964d7 (diff) |
Input: constify psmouse driver
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/mouse/alps.c | 8 | ||||
-rw-r--r-- | drivers/input/mouse/alps.h | 2 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.c | 8 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 42 | ||||
-rw-r--r-- | drivers/input/mouse/sermouse.c | 2 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 10 |
6 files changed, 40 insertions, 32 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 070d75330afd..450b68a619fd 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #define ALPS_PASS 0x20 | 36 | #define ALPS_PASS 0x20 |
37 | #define ALPS_FW_BK_2 0x40 | 37 | #define ALPS_FW_BK_2 0x40 |
38 | 38 | ||
39 | static struct alps_model_info alps_model_data[] = { | 39 | static const struct alps_model_info alps_model_data[] = { |
40 | { { 0x33, 0x02, 0x0a }, 0x88, 0xf8, ALPS_OLDPROTO }, /* UMAX-530T */ | 40 | { { 0x33, 0x02, 0x0a }, 0x88, 0xf8, ALPS_OLDPROTO }, /* UMAX-530T */ |
41 | { { 0x53, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, | 41 | { { 0x53, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, |
42 | { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, | 42 | { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, |
@@ -209,10 +209,10 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse, struct pt_regs * | |||
209 | return PSMOUSE_GOOD_DATA; | 209 | return PSMOUSE_GOOD_DATA; |
210 | } | 210 | } |
211 | 211 | ||
212 | static struct alps_model_info *alps_get_model(struct psmouse *psmouse, int *version) | 212 | static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int *version) |
213 | { | 213 | { |
214 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 214 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
215 | unsigned char rates[] = { 0, 10, 20, 40, 60, 80, 100, 200 }; | 215 | static const unsigned char rates[] = { 0, 10, 20, 40, 60, 80, 100, 200 }; |
216 | unsigned char param[4]; | 216 | unsigned char param[4]; |
217 | int i; | 217 | int i; |
218 | 218 | ||
@@ -504,7 +504,7 @@ init_fail: | |||
504 | int alps_detect(struct psmouse *psmouse, int set_properties) | 504 | int alps_detect(struct psmouse *psmouse, int set_properties) |
505 | { | 505 | { |
506 | int version; | 506 | int version; |
507 | struct alps_model_info *model; | 507 | const struct alps_model_info *model; |
508 | 508 | ||
509 | if (!(model = alps_get_model(psmouse, &version))) | 509 | if (!(model = alps_get_model(psmouse, &version))) |
510 | return -1; | 510 | return -1; |
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h index e428f8d5d12e..69db7325a494 100644 --- a/drivers/input/mouse/alps.h +++ b/drivers/input/mouse/alps.h | |||
@@ -25,7 +25,7 @@ struct alps_data { | |||
25 | struct input_dev *dev2; /* Relative device */ | 25 | struct input_dev *dev2; /* Relative device */ |
26 | char name[32]; /* Name */ | 26 | char name[32]; /* Name */ |
27 | char phys[32]; /* Phys */ | 27 | char phys[32]; /* Phys */ |
28 | struct alps_model_info *i; /* Info */ | 28 | const struct alps_model_info *i;/* Info */ |
29 | int prev_fin; /* Finger bit from previous packet */ | 29 | int prev_fin; /* Finger bit from previous packet */ |
30 | }; | 30 | }; |
31 | 31 | ||
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index c14395ba7980..5e9d25067513 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -115,13 +115,15 @@ static int lifebook_absolute_mode(struct psmouse *psmouse) | |||
115 | 115 | ||
116 | static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolution) | 116 | static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolution) |
117 | { | 117 | { |
118 | unsigned char params[] = { 0, 1, 2, 2, 3 }; | 118 | static const unsigned char params[] = { 0, 1, 2, 2, 3 }; |
119 | unsigned char p; | ||
119 | 120 | ||
120 | if (resolution == 0 || resolution > 400) | 121 | if (resolution == 0 || resolution > 400) |
121 | resolution = 400; | 122 | resolution = 400; |
122 | 123 | ||
123 | ps2_command(&psmouse->ps2dev, ¶ms[resolution / 100], PSMOUSE_CMD_SETRES); | 124 | p = params[resolution / 100]; |
124 | psmouse->resolution = 50 << params[resolution / 100]; | 125 | ps2_command(&psmouse->ps2dev, &p, PSMOUSE_CMD_SETRES); |
126 | psmouse->resolution = 50 << p; | ||
125 | } | 127 | } |
126 | 128 | ||
127 | static void lifebook_disconnect(struct psmouse *psmouse) | 129 | static void lifebook_disconnect(struct psmouse *psmouse) |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 8bc9f51ae6c2..ec0119459bc6 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -112,8 +112,8 @@ static struct workqueue_struct *kpsmoused_wq; | |||
112 | 112 | ||
113 | struct psmouse_protocol { | 113 | struct psmouse_protocol { |
114 | enum psmouse_type type; | 114 | enum psmouse_type type; |
115 | char *name; | 115 | const char *name; |
116 | char *alias; | 116 | const char *alias; |
117 | int maxproto; | 117 | int maxproto; |
118 | int (*detect)(struct psmouse *, int); | 118 | int (*detect)(struct psmouse *, int); |
119 | int (*init)(struct psmouse *); | 119 | int (*init)(struct psmouse *); |
@@ -514,15 +514,17 @@ static int thinking_detect(struct psmouse *psmouse, int set_properties) | |||
514 | { | 514 | { |
515 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 515 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
516 | unsigned char param[2]; | 516 | unsigned char param[2]; |
517 | unsigned char seq[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20, 0 }; | 517 | static const unsigned char seq[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20 }; |
518 | int i; | 518 | int i; |
519 | 519 | ||
520 | param[0] = 10; | 520 | param[0] = 10; |
521 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | 521 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); |
522 | param[0] = 0; | 522 | param[0] = 0; |
523 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); | 523 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); |
524 | for (i = 0; seq[i]; i++) | 524 | for (i = 0; i < ARRAY_SIZE(seq); i++) { |
525 | ps2_command(ps2dev, seq + i, PSMOUSE_CMD_SETRATE); | 525 | param[0] = seq[i]; |
526 | ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); | ||
527 | } | ||
526 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETID); | 528 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETID); |
527 | 529 | ||
528 | if (param[0] != 2) | 530 | if (param[0] != 2) |
@@ -659,7 +661,7 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
659 | return PSMOUSE_PS2; | 661 | return PSMOUSE_PS2; |
660 | } | 662 | } |
661 | 663 | ||
662 | static struct psmouse_protocol psmouse_protocols[] = { | 664 | static const struct psmouse_protocol psmouse_protocols[] = { |
663 | { | 665 | { |
664 | .type = PSMOUSE_PS2, | 666 | .type = PSMOUSE_PS2, |
665 | .name = "PS/2", | 667 | .name = "PS/2", |
@@ -733,7 +735,7 @@ static struct psmouse_protocol psmouse_protocols[] = { | |||
733 | }, | 735 | }, |
734 | }; | 736 | }; |
735 | 737 | ||
736 | static struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type) | 738 | static const struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type) |
737 | { | 739 | { |
738 | int i; | 740 | int i; |
739 | 741 | ||
@@ -745,9 +747,9 @@ static struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type) | |||
745 | return &psmouse_protocols[0]; | 747 | return &psmouse_protocols[0]; |
746 | } | 748 | } |
747 | 749 | ||
748 | static struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len) | 750 | static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len) |
749 | { | 751 | { |
750 | struct psmouse_protocol *p; | 752 | const struct psmouse_protocol *p; |
751 | int i; | 753 | int i; |
752 | 754 | ||
753 | for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++) { | 755 | for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++) { |
@@ -802,13 +804,15 @@ static int psmouse_probe(struct psmouse *psmouse) | |||
802 | 804 | ||
803 | void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution) | 805 | void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution) |
804 | { | 806 | { |
805 | unsigned char params[] = { 0, 1, 2, 2, 3 }; | 807 | static const unsigned char params[] = { 0, 1, 2, 2, 3 }; |
808 | unsigned char p; | ||
806 | 809 | ||
807 | if (resolution == 0 || resolution > 200) | 810 | if (resolution == 0 || resolution > 200) |
808 | resolution = 200; | 811 | resolution = 200; |
809 | 812 | ||
810 | ps2_command(&psmouse->ps2dev, ¶ms[resolution / 50], PSMOUSE_CMD_SETRES); | 813 | p = params[resolution / 50]; |
811 | psmouse->resolution = 25 << params[resolution / 50]; | 814 | ps2_command(&psmouse->ps2dev, &p, PSMOUSE_CMD_SETRES); |
815 | psmouse->resolution = 25 << p; | ||
812 | } | 816 | } |
813 | 817 | ||
814 | /* | 818 | /* |
@@ -817,12 +821,14 @@ void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution) | |||
817 | 821 | ||
818 | static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) | 822 | static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) |
819 | { | 823 | { |
820 | unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 }; | 824 | static const unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 }; |
825 | unsigned char r; | ||
821 | int i = 0; | 826 | int i = 0; |
822 | 827 | ||
823 | while (rates[i] > rate) i++; | 828 | while (rates[i] > rate) i++; |
824 | ps2_command(&psmouse->ps2dev, &rates[i], PSMOUSE_CMD_SETRATE); | 829 | r = rates[i]; |
825 | psmouse->rate = rates[i]; | 830 | ps2_command(&psmouse->ps2dev, &r, PSMOUSE_CMD_SETRATE); |
831 | psmouse->rate = r; | ||
826 | } | 832 | } |
827 | 833 | ||
828 | /* | 834 | /* |
@@ -1038,7 +1044,7 @@ static void psmouse_disconnect(struct serio *serio) | |||
1038 | mutex_unlock(&psmouse_mutex); | 1044 | mutex_unlock(&psmouse_mutex); |
1039 | } | 1045 | } |
1040 | 1046 | ||
1041 | static int psmouse_switch_protocol(struct psmouse *psmouse, struct psmouse_protocol *proto) | 1047 | static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse_protocol *proto) |
1042 | { | 1048 | { |
1043 | struct input_dev *input_dev = psmouse->dev; | 1049 | struct input_dev *input_dev = psmouse->dev; |
1044 | 1050 | ||
@@ -1369,7 +1375,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1369 | struct serio *serio = psmouse->ps2dev.serio; | 1375 | struct serio *serio = psmouse->ps2dev.serio; |
1370 | struct psmouse *parent = NULL; | 1376 | struct psmouse *parent = NULL; |
1371 | struct input_dev *new_dev; | 1377 | struct input_dev *new_dev; |
1372 | struct psmouse_protocol *proto; | 1378 | const struct psmouse_protocol *proto; |
1373 | int retry = 0; | 1379 | int retry = 0; |
1374 | 1380 | ||
1375 | if (!(proto = psmouse_protocol_by_name(buf, count))) | 1381 | if (!(proto = psmouse_protocol_by_name(buf, count))) |
@@ -1466,7 +1472,7 @@ static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, | |||
1466 | 1472 | ||
1467 | static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) | 1473 | static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) |
1468 | { | 1474 | { |
1469 | struct psmouse_protocol *proto; | 1475 | const struct psmouse_protocol *proto; |
1470 | 1476 | ||
1471 | if (!val) | 1477 | if (!val) |
1472 | return -EINVAL; | 1478 | return -EINVAL; |
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index 0023501a5b63..680b32353884 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c | |||
@@ -42,7 +42,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | |||
42 | MODULE_DESCRIPTION(DRIVER_DESC); | 42 | MODULE_DESCRIPTION(DRIVER_DESC); |
43 | MODULE_LICENSE("GPL"); | 43 | MODULE_LICENSE("GPL"); |
44 | 44 | ||
45 | static char *sermouse_protocols[] = { "None", "Mouse Systems Mouse", "Sun Mouse", "Microsoft Mouse", | 45 | static const char *sermouse_protocols[] = { "None", "Mouse Systems Mouse", "Sun Mouse", "Microsoft Mouse", |
46 | "Logitech M+ Mouse", "Microsoft MZ Mouse", "Logitech MZ+ Mouse", | 46 | "Logitech M+ Mouse", "Microsoft MZ Mouse", "Logitech MZ+ Mouse", |
47 | "Logitech MZ++ Mouse"}; | 47 | "Logitech MZ++ Mouse"}; |
48 | 48 | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index ad5d0a85e960..392108c436ba 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -430,11 +430,11 @@ static void synaptics_process_packet(struct psmouse *psmouse) | |||
430 | 430 | ||
431 | static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned char pkt_type) | 431 | static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned char pkt_type) |
432 | { | 432 | { |
433 | static unsigned char newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 }; | 433 | static const unsigned char newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 }; |
434 | static unsigned char newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 }; | 434 | static const unsigned char newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 }; |
435 | static unsigned char newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 }; | 435 | static const unsigned char newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 }; |
436 | static unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 }; | 436 | static const unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 }; |
437 | static unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 }; | 437 | static const unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 }; |
438 | 438 | ||
439 | if (idx < 0 || idx > 4) | 439 | if (idx < 0 || idx > 4) |
440 | return 0; | 440 | return 0; |