aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/alps.c8
-rw-r--r--drivers/input/mouse/alps.h2
-rw-r--r--drivers/input/mouse/lifebook.c8
-rw-r--r--drivers/input/mouse/logips2pp.c23
-rw-r--r--drivers/input/mouse/psmouse-base.c42
-rw-r--r--drivers/input/mouse/sermouse.c2
-rw-r--r--drivers/input/mouse/synaptics.c10
7 files changed, 52 insertions, 43 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
39static struct alps_model_info alps_model_data[] = { 39static 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
212static struct alps_model_info *alps_get_model(struct psmouse *psmouse, int *version) 212static 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:
504int alps_detect(struct psmouse *psmouse, int set_properties) 504int 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
116static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolution) 116static 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, &params[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
127static void lifebook_disconnect(struct psmouse *psmouse) 129static void lifebook_disconnect(struct psmouse *psmouse)
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index 54b696cfe1e3..7972eecbcfe4 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -30,9 +30,9 @@
30#define PS2PP_NAV_BTN 0x20 30#define PS2PP_NAV_BTN 0x20
31 31
32struct ps2pp_info { 32struct ps2pp_info {
33 const int model; 33 u8 model;
34 unsigned const int kind; 34 u8 kind;
35 unsigned const int features; 35 u16 features;
36}; 36};
37 37
38/* 38/*
@@ -199,9 +199,9 @@ static void ps2pp_disconnect(struct psmouse *psmouse)
199 device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll.dattr); 199 device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_smartscroll.dattr);
200} 200}
201 201
202static struct ps2pp_info *get_model_info(unsigned char model) 202static const struct ps2pp_info *get_model_info(unsigned char model)
203{ 203{
204 static struct ps2pp_info ps2pp_list[] = { 204 static const struct ps2pp_info ps2pp_list[] = {
205 { 12, 0, PS2PP_SIDE_BTN}, 205 { 12, 0, PS2PP_SIDE_BTN},
206 { 13, 0, 0 }, 206 { 13, 0, 0 },
207 { 15, PS2PP_KIND_MX, /* MX1000 */ 207 { 15, PS2PP_KIND_MX, /* MX1000 */
@@ -215,6 +215,7 @@ static struct ps2pp_info *get_model_info(unsigned char model)
215 { 51, 0, 0 }, 215 { 51, 0, 0 },
216 { 52, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, 216 { 52, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL },
217 { 53, PS2PP_KIND_WHEEL, PS2PP_WHEEL }, 217 { 53, PS2PP_KIND_WHEEL, PS2PP_WHEEL },
218 { 56, PS2PP_KIND_WHEEL, PS2PP_SIDE_BTN | PS2PP_WHEEL }, /* Cordless MouseMan Wheel */
218 { 61, PS2PP_KIND_MX, /* MX700 */ 219 { 61, PS2PP_KIND_MX, /* MX700 */
219 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN | 220 PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
220 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, 221 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
@@ -244,12 +245,11 @@ static struct ps2pp_info *get_model_info(unsigned char model)
244 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN }, 245 PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
245 { 114, PS2PP_KIND_MX, /* MX310 */ 246 { 114, PS2PP_KIND_MX, /* MX310 */
246 PS2PP_WHEEL | PS2PP_SIDE_BTN | 247 PS2PP_WHEEL | PS2PP_SIDE_BTN |
247 PS2PP_TASK_BTN | PS2PP_EXTRA_BTN }, 248 PS2PP_TASK_BTN | PS2PP_EXTRA_BTN }
248 { }
249 }; 249 };
250 int i; 250 int i;
251 251
252 for (i = 0; ps2pp_list[i].model; i++) 252 for (i = 0; i < ARRAY_SIZE(ps2pp_list); i++)
253 if (model == ps2pp_list[i].model) 253 if (model == ps2pp_list[i].model)
254 return &ps2pp_list[i]; 254 return &ps2pp_list[i];
255 255
@@ -261,7 +261,8 @@ static struct ps2pp_info *get_model_info(unsigned char model)
261 * Set up input device's properties based on the detected mouse model. 261 * Set up input device's properties based on the detected mouse model.
262 */ 262 */
263 263
264static void ps2pp_set_model_properties(struct psmouse *psmouse, struct ps2pp_info *model_info, 264static void ps2pp_set_model_properties(struct psmouse *psmouse,
265 const struct ps2pp_info *model_info,
265 int using_ps2pp) 266 int using_ps2pp)
266{ 267{
267 struct input_dev *input_dev = psmouse->dev; 268 struct input_dev *input_dev = psmouse->dev;
@@ -327,7 +328,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
327 struct ps2dev *ps2dev = &psmouse->ps2dev; 328 struct ps2dev *ps2dev = &psmouse->ps2dev;
328 unsigned char param[4]; 329 unsigned char param[4];
329 unsigned char model, buttons; 330 unsigned char model, buttons;
330 struct ps2pp_info *model_info; 331 const struct ps2pp_info *model_info;
331 int use_ps2pp = 0; 332 int use_ps2pp = 0;
332 333
333 param[0] = 0; 334 param[0] = 0;
@@ -349,7 +350,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
349/* 350/*
350 * Do Logitech PS2++ / PS2T++ magic init. 351 * Do Logitech PS2++ / PS2T++ magic init.
351 */ 352 */
352 if (model == 97) { /* Touch Pad 3 */ 353 if (model_info->kind == PS2PP_KIND_TP3) { /* Touch Pad 3 */
353 354
354 /* Unprotect RAM */ 355 /* Unprotect RAM */
355 param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; 356 param[0] = 0x11; param[1] = 0x04; param[2] = 0x68;
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 343afa38f4c2..9fb7eb6b0f71 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
113struct psmouse_protocol { 113struct 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 *);
@@ -507,15 +507,17 @@ static int thinking_detect(struct psmouse *psmouse, int set_properties)
507{ 507{
508 struct ps2dev *ps2dev = &psmouse->ps2dev; 508 struct ps2dev *ps2dev = &psmouse->ps2dev;
509 unsigned char param[2]; 509 unsigned char param[2];
510 unsigned char seq[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20, 0 }; 510 static const unsigned char seq[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20 };
511 int i; 511 int i;
512 512
513 param[0] = 10; 513 param[0] = 10;
514 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); 514 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
515 param[0] = 0; 515 param[0] = 0;
516 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); 516 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
517 for (i = 0; seq[i]; i++) 517 for (i = 0; i < ARRAY_SIZE(seq); i++) {
518 ps2_command(ps2dev, seq + i, PSMOUSE_CMD_SETRATE); 518 param[0] = seq[i];
519 ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
520 }
519 ps2_command(ps2dev, param, PSMOUSE_CMD_GETID); 521 ps2_command(ps2dev, param, PSMOUSE_CMD_GETID);
520 522
521 if (param[0] != 2) 523 if (param[0] != 2)
@@ -652,7 +654,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
652 return PSMOUSE_PS2; 654 return PSMOUSE_PS2;
653} 655}
654 656
655static struct psmouse_protocol psmouse_protocols[] = { 657static const struct psmouse_protocol psmouse_protocols[] = {
656 { 658 {
657 .type = PSMOUSE_PS2, 659 .type = PSMOUSE_PS2,
658 .name = "PS/2", 660 .name = "PS/2",
@@ -726,7 +728,7 @@ static struct psmouse_protocol psmouse_protocols[] = {
726 }, 728 },
727}; 729};
728 730
729static struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type) 731static const struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type)
730{ 732{
731 int i; 733 int i;
732 734
@@ -738,9 +740,9 @@ static struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type)
738 return &psmouse_protocols[0]; 740 return &psmouse_protocols[0];
739} 741}
740 742
741static struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len) 743static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len)
742{ 744{
743 struct psmouse_protocol *p; 745 const struct psmouse_protocol *p;
744 int i; 746 int i;
745 747
746 for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++) { 748 for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++) {
@@ -795,13 +797,15 @@ static int psmouse_probe(struct psmouse *psmouse)
795 797
796void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution) 798void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution)
797{ 799{
798 unsigned char params[] = { 0, 1, 2, 2, 3 }; 800 static const unsigned char params[] = { 0, 1, 2, 2, 3 };
801 unsigned char p;
799 802
800 if (resolution == 0 || resolution > 200) 803 if (resolution == 0 || resolution > 200)
801 resolution = 200; 804 resolution = 200;
802 805
803 ps2_command(&psmouse->ps2dev, &params[resolution / 50], PSMOUSE_CMD_SETRES); 806 p = params[resolution / 50];
804 psmouse->resolution = 25 << params[resolution / 50]; 807 ps2_command(&psmouse->ps2dev, &p, PSMOUSE_CMD_SETRES);
808 psmouse->resolution = 25 << p;
805} 809}
806 810
807/* 811/*
@@ -810,12 +814,14 @@ void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution)
810 814
811static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) 815static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate)
812{ 816{
813 unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 }; 817 static const unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10, 0 };
818 unsigned char r;
814 int i = 0; 819 int i = 0;
815 820
816 while (rates[i] > rate) i++; 821 while (rates[i] > rate) i++;
817 ps2_command(&psmouse->ps2dev, &rates[i], PSMOUSE_CMD_SETRATE); 822 r = rates[i];
818 psmouse->rate = rates[i]; 823 ps2_command(&psmouse->ps2dev, &r, PSMOUSE_CMD_SETRATE);
824 psmouse->rate = r;
819} 825}
820 826
821/* 827/*
@@ -1031,7 +1037,7 @@ static void psmouse_disconnect(struct serio *serio)
1031 mutex_unlock(&psmouse_mutex); 1037 mutex_unlock(&psmouse_mutex);
1032} 1038}
1033 1039
1034static int psmouse_switch_protocol(struct psmouse *psmouse, struct psmouse_protocol *proto) 1040static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse_protocol *proto)
1035{ 1041{
1036 struct input_dev *input_dev = psmouse->dev; 1042 struct input_dev *input_dev = psmouse->dev;
1037 1043
@@ -1362,7 +1368,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
1362 struct serio *serio = psmouse->ps2dev.serio; 1368 struct serio *serio = psmouse->ps2dev.serio;
1363 struct psmouse *parent = NULL; 1369 struct psmouse *parent = NULL;
1364 struct input_dev *new_dev; 1370 struct input_dev *new_dev;
1365 struct psmouse_protocol *proto; 1371 const struct psmouse_protocol *proto;
1366 int retry = 0; 1372 int retry = 0;
1367 1373
1368 if (!(proto = psmouse_protocol_by_name(buf, count))) 1374 if (!(proto = psmouse_protocol_by_name(buf, count)))
@@ -1459,7 +1465,7 @@ static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data,
1459 1465
1460static int psmouse_set_maxproto(const char *val, struct kernel_param *kp) 1466static int psmouse_set_maxproto(const char *val, struct kernel_param *kp)
1461{ 1467{
1462 struct psmouse_protocol *proto; 1468 const struct psmouse_protocol *proto;
1463 1469
1464 if (!val) 1470 if (!val)
1465 return -EINVAL; 1471 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>");
42MODULE_DESCRIPTION(DRIVER_DESC); 42MODULE_DESCRIPTION(DRIVER_DESC);
43MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
44 44
45static char *sermouse_protocols[] = { "None", "Mouse Systems Mouse", "Sun Mouse", "Microsoft Mouse", 45static 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
431static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned char pkt_type) 431static 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;