aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/mouse/alps.c52
-rw-r--r--drivers/input/mouse/elantech.c84
-rw-r--r--drivers/input/mouse/hgpk.c84
-rw-r--r--drivers/input/mouse/hgpk.h11
-rw-r--r--drivers/input/mouse/lifebook.c6
-rw-r--r--drivers/input/mouse/logips2pp.c16
-rw-r--r--drivers/input/mouse/psmouse-base.c67
-rw-r--r--drivers/input/mouse/psmouse.h25
-rw-r--r--drivers/input/mouse/sentelic.c13
-rw-r--r--drivers/input/mouse/synaptics.c83
10 files changed, 243 insertions, 198 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 99d58764ef03..003587c71f43 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -23,13 +23,6 @@
23#include "psmouse.h" 23#include "psmouse.h"
24#include "alps.h" 24#include "alps.h"
25 25
26#undef DEBUG
27#ifdef DEBUG
28#define dbg(format, arg...) printk(KERN_INFO "alps.c: " format "\n", ## arg)
29#else
30#define dbg(format, arg...) do {} while (0)
31#endif
32
33#define ALPS_OLDPROTO 0x01 /* old style input */ 26#define ALPS_OLDPROTO 0x01 /* old style input */
34#define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ 27#define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */
35#define ALPS_PASS 0x04 /* device has a pass-through port */ 28#define ALPS_PASS 0x04 /* device has a pass-through port */
@@ -297,10 +290,10 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
297 psmouse->packet[4] | 290 psmouse->packet[4] |
298 psmouse->packet[5]) & 0x80) || 291 psmouse->packet[5]) & 0x80) ||
299 (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) { 292 (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) {
300 dbg("refusing packet %x %x %x %x " 293 psmouse_dbg(psmouse,
301 "(suspected interleaved ps/2)\n", 294 "refusing packet %x %x %x %x (suspected interleaved ps/2)\n",
302 psmouse->packet[3], psmouse->packet[4], 295 psmouse->packet[3], psmouse->packet[4],
303 psmouse->packet[5], psmouse->packet[6]); 296 psmouse->packet[5], psmouse->packet[6]);
304 return PSMOUSE_BAD_DATA; 297 return PSMOUSE_BAD_DATA;
305 } 298 }
306 299
@@ -319,13 +312,13 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
319 * There is also possibility that we got 6-byte ALPS 312 * There is also possibility that we got 6-byte ALPS
320 * packet followed by 3-byte packet from trackpoint. We 313 * packet followed by 3-byte packet from trackpoint. We
321 * can not distinguish between these 2 scenarios but 314 * can not distinguish between these 2 scenarios but
322 * becase the latter is unlikely to happen in course of 315 * because the latter is unlikely to happen in course of
323 * normal operation (user would need to press all 316 * normal operation (user would need to press all
324 * buttons on the pad and start moving trackpoint 317 * buttons on the pad and start moving trackpoint
325 * without touching the pad surface) we assume former. 318 * without touching the pad surface) we assume former.
326 * Even if we are wrong the wost thing that would happen 319 * Even if we are wrong the wost thing that would happen
327 * the cursor would jump but we should not get protocol 320 * the cursor would jump but we should not get protocol
328 * desynchronization. 321 * de-synchronization.
329 */ 322 */
330 323
331 alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3], 324 alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
@@ -361,10 +354,10 @@ static void alps_flush_packet(unsigned long data)
361 if ((psmouse->packet[3] | 354 if ((psmouse->packet[3] |
362 psmouse->packet[4] | 355 psmouse->packet[4] |
363 psmouse->packet[5]) & 0x80) { 356 psmouse->packet[5]) & 0x80) {
364 dbg("refusing packet %x %x %x " 357 psmouse_dbg(psmouse,
365 "(suspected interleaved ps/2)\n", 358 "refusing packet %x %x %x (suspected interleaved ps/2)\n",
366 psmouse->packet[3], psmouse->packet[4], 359 psmouse->packet[3], psmouse->packet[4],
367 psmouse->packet[5]); 360 psmouse->packet[5]);
368 } else { 361 } else {
369 alps_process_packet(psmouse); 362 alps_process_packet(psmouse);
370 } 363 }
@@ -396,16 +389,18 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
396 } 389 }
397 390
398 if (!alps_is_valid_first_byte(model, psmouse->packet[0])) { 391 if (!alps_is_valid_first_byte(model, psmouse->packet[0])) {
399 dbg("refusing packet[0] = %x (mask0 = %x, byte0 = %x)\n", 392 psmouse_dbg(psmouse,
400 psmouse->packet[0], model->mask0, model->byte0); 393 "refusing packet[0] = %x (mask0 = %x, byte0 = %x)\n",
394 psmouse->packet[0], model->mask0, model->byte0);
401 return PSMOUSE_BAD_DATA; 395 return PSMOUSE_BAD_DATA;
402 } 396 }
403 397
404 /* Bytes 2 - 6 should have 0 in the highest bit */ 398 /* Bytes 2 - 6 should have 0 in the highest bit */
405 if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 && 399 if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 &&
406 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { 400 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
407 dbg("refusing packet[%i] = %x\n", 401 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n",
408 psmouse->pktcnt - 1, psmouse->packet[psmouse->pktcnt - 1]); 402 psmouse->pktcnt - 1,
403 psmouse->packet[psmouse->pktcnt - 1]);
409 return PSMOUSE_BAD_DATA; 404 return PSMOUSE_BAD_DATA;
410 } 405 }
411 406
@@ -439,7 +434,8 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
439 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) 434 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
440 return NULL; 435 return NULL;
441 436
442 dbg("E6 report: %2.2x %2.2x %2.2x", param[0], param[1], param[2]); 437 psmouse_dbg(psmouse, "E6 report: %2.2x %2.2x %2.2x",
438 param[0], param[1], param[2]);
443 439
444 if (param[0] != 0 || param[1] != 0 || (param[2] != 10 && param[2] != 100)) 440 if (param[0] != 0 || param[1] != 0 || (param[2] != 10 && param[2] != 100))
445 return NULL; 441 return NULL;
@@ -459,7 +455,8 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
459 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) 455 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
460 return NULL; 456 return NULL;
461 457
462 dbg("E7 report: %2.2x %2.2x %2.2x", param[0], param[1], param[2]); 458 psmouse_dbg(psmouse, "E7 report: %2.2x %2.2x %2.2x",
459 param[0], param[1], param[2]);
463 460
464 if (version) { 461 if (version) {
465 for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++) 462 for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++)
@@ -527,7 +524,8 @@ static int alps_get_status(struct psmouse *psmouse, char *param)
527 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) 524 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
528 return -1; 525 return -1;
529 526
530 dbg("Status: %2.2x %2.2x %2.2x", param[0], param[1], param[2]); 527 psmouse_dbg(psmouse, "Status: %2.2x %2.2x %2.2x",
528 param[0], param[1], param[2]);
531 529
532 return 0; 530 return 0;
533} 531}
@@ -605,12 +603,12 @@ static int alps_hw_init(struct psmouse *psmouse)
605 } 603 }
606 604
607 if (alps_tap_mode(psmouse, true)) { 605 if (alps_tap_mode(psmouse, true)) {
608 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); 606 psmouse_warn(psmouse, "Failed to enable hardware tapping\n");
609 return -1; 607 return -1;
610 } 608 }
611 609
612 if (alps_absolute_mode(psmouse)) { 610 if (alps_absolute_mode(psmouse)) {
613 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); 611 psmouse_err(psmouse, "Failed to enable absolute mode\n");
614 return -1; 612 return -1;
615 } 613 }
616 614
@@ -621,7 +619,7 @@ static int alps_hw_init(struct psmouse *psmouse)
621 619
622 /* ALPS needs stream mode, otherwise it won't report any data */ 620 /* ALPS needs stream mode, otherwise it won't report any data */
623 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) { 621 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) {
624 printk(KERN_ERR "alps.c: Failed to enable stream mode\n"); 622 psmouse_err(psmouse, "Failed to enable stream mode\n");
625 return -1; 623 return -1;
626 } 624 }
627 625
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 25290b395c88..09b93b11a274 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -10,8 +10,6 @@
10 * Trademarks are the property of their respective owners. 10 * Trademarks are the property of their respective owners.
11 */ 11 */
12 12
13#define pr_fmt(fmt) KBUILD_BASENAME ": " fmt
14
15#include <linux/delay.h> 13#include <linux/delay.h>
16#include <linux/slab.h> 14#include <linux/slab.h>
17#include <linux/module.h> 15#include <linux/module.h>
@@ -25,7 +23,8 @@
25#define elantech_debug(fmt, ...) \ 23#define elantech_debug(fmt, ...) \
26 do { \ 24 do { \
27 if (etd->debug) \ 25 if (etd->debug) \
28 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ 26 psmouse_printk(KERN_DEBUG, psmouse, \
27 fmt, ##__VA_ARGS__); \
29 } while (0) 28 } while (0)
30 29
31/* 30/*
@@ -36,7 +35,7 @@ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
36{ 35{
37 if (psmouse_sliced_command(psmouse, c) || 36 if (psmouse_sliced_command(psmouse, c) ||
38 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) { 37 ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) {
39 pr_err("synaptics_send_cmd query 0x%02x failed.\n", c); 38 psmouse_err(psmouse, "%s query 0x%02x failed.\n", __func__, c);
40 return -1; 39 return -1;
41 } 40 }
42 41
@@ -65,7 +64,7 @@ static int elantech_ps2_command(struct psmouse *psmouse,
65 } while (tries > 0); 64 } while (tries > 0);
66 65
67 if (rc) 66 if (rc)
68 pr_err("ps2 command 0x%02x failed.\n", command); 67 psmouse_err(psmouse, "ps2 command 0x%02x failed.\n", command);
69 68
70 return rc; 69 return rc;
71} 70}
@@ -117,7 +116,7 @@ static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg,
117 } 116 }
118 117
119 if (rc) 118 if (rc)
120 pr_err("failed to read register 0x%02x.\n", reg); 119 psmouse_err(psmouse, "failed to read register 0x%02x.\n", reg);
121 else if (etd->hw_version != 4) 120 else if (etd->hw_version != 4)
122 *val = param[0]; 121 *val = param[0];
123 else 122 else
@@ -191,8 +190,9 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
191 } 190 }
192 191
193 if (rc) 192 if (rc)
194 pr_err("failed to write register 0x%02x with value 0x%02x.\n", 193 psmouse_err(psmouse,
195 reg, val); 194 "failed to write register 0x%02x with value 0x%02x.\n",
195 reg, val);
196 196
197 return rc; 197 return rc;
198} 198}
@@ -200,13 +200,13 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
200/* 200/*
201 * Dump a complete mouse movement packet to the syslog 201 * Dump a complete mouse movement packet to the syslog
202 */ 202 */
203static void elantech_packet_dump(unsigned char *packet, int size) 203static void elantech_packet_dump(struct psmouse *psmouse)
204{ 204{
205 int i; 205 int i;
206 206
207 printk(KERN_DEBUG pr_fmt("PS/2 packet [")); 207 psmouse_printk(KERN_DEBUG, psmouse, "PS/2 packet [");
208 for (i = 0; i < size; i++) 208 for (i = 0; i < psmouse->pktsize; i++)
209 printk("%s0x%02x ", (i) ? ", " : " ", packet[i]); 209 printk("%s0x%02x ", i ? ", " : " ", psmouse->packet[i]);
210 printk("]\n"); 210 printk("]\n");
211} 211}
212 212
@@ -705,7 +705,7 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
705 return PSMOUSE_GOOD_DATA; 705 return PSMOUSE_GOOD_DATA;
706 706
707 if (etd->debug > 1) 707 if (etd->debug > 1)
708 elantech_packet_dump(psmouse->packet, psmouse->pktsize); 708 elantech_packet_dump(psmouse);
709 709
710 switch (etd->hw_version) { 710 switch (etd->hw_version) {
711 case 1: 711 case 1:
@@ -801,7 +801,7 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
801 /* 801 /*
802 * Read back reg 0x10. For hardware version 1 we must make 802 * Read back reg 0x10. For hardware version 1 we must make
803 * sure the absolute mode bit is set. For hardware version 2 803 * sure the absolute mode bit is set. For hardware version 2
804 * the touchpad is probably initalising and not ready until 804 * the touchpad is probably initializing and not ready until
805 * we read back the value we just wrote. 805 * we read back the value we just wrote.
806 */ 806 */
807 do { 807 do {
@@ -814,17 +814,19 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
814 } while (tries > 0); 814 } while (tries > 0);
815 815
816 if (rc) { 816 if (rc) {
817 pr_err("failed to read back register 0x10.\n"); 817 psmouse_err(psmouse,
818 "failed to read back register 0x10.\n");
818 } else if (etd->hw_version == 1 && 819 } else if (etd->hw_version == 1 &&
819 !(val & ETP_R10_ABSOLUTE_MODE)) { 820 !(val & ETP_R10_ABSOLUTE_MODE)) {
820 pr_err("touchpad refuses to switch to absolute mode.\n"); 821 psmouse_err(psmouse,
822 "touchpad refuses to switch to absolute mode.\n");
821 rc = -1; 823 rc = -1;
822 } 824 }
823 } 825 }
824 826
825 skip_readback_reg_10: 827 skip_readback_reg_10:
826 if (rc) 828 if (rc)
827 pr_err("failed to initialise registers.\n"); 829 psmouse_err(psmouse, "failed to initialise registers.\n");
828 830
829 return rc; 831 return rc;
830} 832}
@@ -1131,7 +1133,7 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
1131 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || 1133 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1132 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) || 1134 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1133 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { 1135 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) {
1134 pr_debug("sending Elantech magic knock failed.\n"); 1136 psmouse_dbg(psmouse, "sending Elantech magic knock failed.\n");
1135 return -1; 1137 return -1;
1136 } 1138 }
1137 1139
@@ -1141,8 +1143,9 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
1141 */ 1143 */
1142 if (param[0] != 0x3c || param[1] != 0x03 || 1144 if (param[0] != 0x3c || param[1] != 0x03 ||
1143 (param[2] != 0xc8 && param[2] != 0x00)) { 1145 (param[2] != 0xc8 && param[2] != 0x00)) {
1144 pr_debug("unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n", 1146 psmouse_dbg(psmouse,
1145 param[0], param[1], param[2]); 1147 "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
1148 param[0], param[1], param[2]);
1146 return -1; 1149 return -1;
1147 } 1150 }
1148 1151
@@ -1152,15 +1155,17 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
1152 * to Elantech magic knock and there might be more. 1155 * to Elantech magic knock and there might be more.
1153 */ 1156 */
1154 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { 1157 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
1155 pr_debug("failed to query firmware version.\n"); 1158 psmouse_dbg(psmouse, "failed to query firmware version.\n");
1156 return -1; 1159 return -1;
1157 } 1160 }
1158 1161
1159 pr_debug("Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n", 1162 psmouse_dbg(psmouse,
1160 param[0], param[1], param[2]); 1163 "Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
1164 param[0], param[1], param[2]);
1161 1165
1162 if (!elantech_is_signature_valid(param)) { 1166 if (!elantech_is_signature_valid(param)) {
1163 pr_debug("Probably not a real Elantech touchpad. Aborting.\n"); 1167 psmouse_dbg(psmouse,
1168 "Probably not a real Elantech touchpad. Aborting.\n");
1164 return -1; 1169 return -1;
1165 } 1170 }
1166 1171
@@ -1192,7 +1197,8 @@ static int elantech_reconnect(struct psmouse *psmouse)
1192 return -1; 1197 return -1;
1193 1198
1194 if (elantech_set_absolute_mode(psmouse)) { 1199 if (elantech_set_absolute_mode(psmouse)) {
1195 pr_err("failed to put touchpad back into absolute mode.\n"); 1200 psmouse_err(psmouse,
1201 "failed to put touchpad back into absolute mode.\n");
1196 return -1; 1202 return -1;
1197 } 1203 }
1198 1204
@@ -1262,42 +1268,46 @@ int elantech_init(struct psmouse *psmouse)
1262 * Do the version query again so we can store the result 1268 * Do the version query again so we can store the result
1263 */ 1269 */
1264 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) { 1270 if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
1265 pr_err("failed to query firmware version.\n"); 1271 psmouse_err(psmouse, "failed to query firmware version.\n");
1266 goto init_fail; 1272 goto init_fail;
1267 } 1273 }
1268 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2]; 1274 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
1269 1275
1270 if (elantech_set_properties(etd)) { 1276 if (elantech_set_properties(etd)) {
1271 pr_err("unknown hardware version, aborting...\n"); 1277 psmouse_err(psmouse, "unknown hardware version, aborting...\n");
1272 goto init_fail; 1278 goto init_fail;
1273 } 1279 }
1274 pr_info("assuming hardware version %d " 1280 psmouse_info(psmouse,
1275 "(with firmware version 0x%02x%02x%02x)\n", 1281 "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n",
1276 etd->hw_version, param[0], param[1], param[2]); 1282 etd->hw_version, param[0], param[1], param[2]);
1277 1283
1278 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, 1284 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
1279 etd->capabilities)) { 1285 etd->capabilities)) {
1280 pr_err("failed to query capabilities.\n"); 1286 psmouse_err(psmouse, "failed to query capabilities.\n");
1281 goto init_fail; 1287 goto init_fail;
1282 } 1288 }
1283 pr_info("Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n", 1289 psmouse_info(psmouse,
1284 etd->capabilities[0], etd->capabilities[1], 1290 "Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n",
1285 etd->capabilities[2]); 1291 etd->capabilities[0], etd->capabilities[1],
1292 etd->capabilities[2]);
1286 1293
1287 if (elantech_set_absolute_mode(psmouse)) { 1294 if (elantech_set_absolute_mode(psmouse)) {
1288 pr_err("failed to put touchpad into absolute mode.\n"); 1295 psmouse_err(psmouse,
1296 "failed to put touchpad into absolute mode.\n");
1289 goto init_fail; 1297 goto init_fail;
1290 } 1298 }
1291 1299
1292 if (elantech_set_input_params(psmouse)) { 1300 if (elantech_set_input_params(psmouse)) {
1293 pr_err("failed to query touchpad range.\n"); 1301 psmouse_err(psmouse, "failed to query touchpad range.\n");
1294 goto init_fail; 1302 goto init_fail;
1295 } 1303 }
1296 1304
1297 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, 1305 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj,
1298 &elantech_attr_group); 1306 &elantech_attr_group);
1299 if (error) { 1307 if (error) {
1300 pr_err("failed to create sysfs attributes, error: %d.\n", error); 1308 psmouse_err(psmouse,
1309 "failed to create sysfs attributes, error: %d.\n",
1310 error);
1301 goto init_fail; 1311 goto init_fail;
1302 } 1312 }
1303 1313
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
index 4d17d9f3320b..0470dd46b566 100644
--- a/drivers/input/mouse/hgpk.c
+++ b/drivers/input/mouse/hgpk.c
@@ -136,10 +136,10 @@ static int hgpk_discard_decay_hack(struct psmouse *psmouse, int x, int y)
136 /* discard if too big, or half that but > 4 times the prev delta */ 136 /* discard if too big, or half that but > 4 times the prev delta */
137 if (avx > recalib_delta || 137 if (avx > recalib_delta ||
138 (avx > recalib_delta / 2 && ((avx / 4) > priv->xlast))) { 138 (avx > recalib_delta / 2 && ((avx / 4) > priv->xlast))) {
139 hgpk_err(psmouse, "detected %dpx jump in x\n", x); 139 psmouse_warn(psmouse, "detected %dpx jump in x\n", x);
140 priv->xbigj = avx; 140 priv->xbigj = avx;
141 } else if (approx_half(avx, priv->xbigj)) { 141 } else if (approx_half(avx, priv->xbigj)) {
142 hgpk_err(psmouse, "detected secondary %dpx jump in x\n", x); 142 psmouse_warn(psmouse, "detected secondary %dpx jump in x\n", x);
143 priv->xbigj = avx; 143 priv->xbigj = avx;
144 priv->xsaw_secondary++; 144 priv->xsaw_secondary++;
145 } else { 145 } else {
@@ -151,10 +151,10 @@ static int hgpk_discard_decay_hack(struct psmouse *psmouse, int x, int y)
151 151
152 if (avy > recalib_delta || 152 if (avy > recalib_delta ||
153 (avy > recalib_delta / 2 && ((avy / 4) > priv->ylast))) { 153 (avy > recalib_delta / 2 && ((avy / 4) > priv->ylast))) {
154 hgpk_err(psmouse, "detected %dpx jump in y\n", y); 154 psmouse_warn(psmouse, "detected %dpx jump in y\n", y);
155 priv->ybigj = avy; 155 priv->ybigj = avy;
156 } else if (approx_half(avy, priv->ybigj)) { 156 } else if (approx_half(avy, priv->ybigj)) {
157 hgpk_err(psmouse, "detected secondary %dpx jump in y\n", y); 157 psmouse_warn(psmouse, "detected secondary %dpx jump in y\n", y);
158 priv->ybigj = avy; 158 priv->ybigj = avy;
159 priv->ysaw_secondary++; 159 priv->ysaw_secondary++;
160 } else { 160 } else {
@@ -168,7 +168,7 @@ static int hgpk_discard_decay_hack(struct psmouse *psmouse, int x, int y)
168 priv->ylast = avy; 168 priv->ylast = avy;
169 169
170 if (do_recal && jumpy_delay) { 170 if (do_recal && jumpy_delay) {
171 hgpk_err(psmouse, "scheduling recalibration\n"); 171 psmouse_warn(psmouse, "scheduling recalibration\n");
172 psmouse_queue_work(psmouse, &priv->recalib_wq, 172 psmouse_queue_work(psmouse, &priv->recalib_wq,
173 msecs_to_jiffies(jumpy_delay)); 173 msecs_to_jiffies(jumpy_delay));
174 } 174 }
@@ -260,8 +260,8 @@ static void hgpk_spewing_hack(struct psmouse *psmouse,
260 * movement, it is probably a case of the user moving the 260 * movement, it is probably a case of the user moving the
261 * cursor very slowly across the screen. */ 261 * cursor very slowly across the screen. */
262 if (abs(priv->x_tally) < 3 && abs(priv->y_tally) < 3) { 262 if (abs(priv->x_tally) < 3 && abs(priv->y_tally) < 3) {
263 hgpk_err(psmouse, "packet spew detected (%d,%d)\n", 263 psmouse_warn(psmouse, "packet spew detected (%d,%d)\n",
264 priv->x_tally, priv->y_tally); 264 priv->x_tally, priv->y_tally);
265 priv->spew_flag = RECALIBRATING; 265 priv->spew_flag = RECALIBRATING;
266 psmouse_queue_work(psmouse, &priv->recalib_wq, 266 psmouse_queue_work(psmouse, &priv->recalib_wq,
267 msecs_to_jiffies(spew_delay)); 267 msecs_to_jiffies(spew_delay));
@@ -333,12 +333,12 @@ static bool hgpk_is_byte_valid(struct psmouse *psmouse, unsigned char *packet)
333 } 333 }
334 334
335 if (!valid) 335 if (!valid)
336 hgpk_dbg(psmouse, 336 psmouse_dbg(psmouse,
337 "bad data, mode %d (%d) %02x %02x %02x %02x %02x %02x\n", 337 "bad data, mode %d (%d) %02x %02x %02x %02x %02x %02x\n",
338 priv->mode, pktcnt, 338 priv->mode, pktcnt,
339 psmouse->packet[0], psmouse->packet[1], 339 psmouse->packet[0], psmouse->packet[1],
340 psmouse->packet[2], psmouse->packet[3], 340 psmouse->packet[2], psmouse->packet[3],
341 psmouse->packet[4], psmouse->packet[5]); 341 psmouse->packet[4], psmouse->packet[5]);
342 342
343 return valid; 343 return valid;
344} 344}
@@ -361,19 +361,20 @@ static void hgpk_process_advanced_packet(struct psmouse *psmouse)
361 361
362 input_report_abs(idev, ABS_PRESSURE, z); 362 input_report_abs(idev, ABS_PRESSURE, z);
363 if (tpdebug) 363 if (tpdebug)
364 hgpk_dbg(psmouse, "pd=%d fd=%d z=%d", 364 psmouse_dbg(psmouse, "pd=%d fd=%d z=%d",
365 pt_down, finger_down, z); 365 pt_down, finger_down, z);
366 } else { 366 } else {
367 /* 367 /*
368 * PenTablet mode does not report pressure, so we don't 368 * PenTablet mode does not report pressure, so we don't
369 * report it here 369 * report it here
370 */ 370 */
371 if (tpdebug) 371 if (tpdebug)
372 hgpk_dbg(psmouse, "pd=%d ", down); 372 psmouse_dbg(psmouse, "pd=%d ", down);
373 } 373 }
374 374
375 if (tpdebug) 375 if (tpdebug)
376 hgpk_dbg(psmouse, "l=%d r=%d x=%d y=%d\n", left, right, x, y); 376 psmouse_dbg(psmouse, "l=%d r=%d x=%d y=%d\n",
377 left, right, x, y);
377 378
378 input_report_key(idev, BTN_TOUCH, down); 379 input_report_key(idev, BTN_TOUCH, down);
379 input_report_key(idev, BTN_LEFT, left); 380 input_report_key(idev, BTN_LEFT, left);
@@ -395,7 +396,7 @@ static void hgpk_process_advanced_packet(struct psmouse *psmouse)
395 if (x == priv->abs_x && y == priv->abs_y) { 396 if (x == priv->abs_x && y == priv->abs_y) {
396 if (++priv->dupe_count > SPEW_WATCH_COUNT) { 397 if (++priv->dupe_count > SPEW_WATCH_COUNT) {
397 if (tpdebug) 398 if (tpdebug)
398 hgpk_dbg(psmouse, "hard spew detected\n"); 399 psmouse_dbg(psmouse, "hard spew detected\n");
399 priv->spew_flag = RECALIBRATING; 400 priv->spew_flag = RECALIBRATING;
400 psmouse_queue_work(psmouse, &priv->recalib_wq, 401 psmouse_queue_work(psmouse, &priv->recalib_wq,
401 msecs_to_jiffies(spew_delay)); 402 msecs_to_jiffies(spew_delay));
@@ -412,7 +413,7 @@ static void hgpk_process_advanced_packet(struct psmouse *psmouse)
412 int y_diff = priv->abs_y - y; 413 int y_diff = priv->abs_y - y;
413 if (hgpk_discard_decay_hack(psmouse, x_diff, y_diff)) { 414 if (hgpk_discard_decay_hack(psmouse, x_diff, y_diff)) {
414 if (tpdebug) 415 if (tpdebug)
415 hgpk_dbg(psmouse, "discarding\n"); 416 psmouse_dbg(psmouse, "discarding\n");
416 goto done; 417 goto done;
417 } 418 }
418 hgpk_spewing_hack(psmouse, left, right, x_diff, y_diff); 419 hgpk_spewing_hack(psmouse, left, right, x_diff, y_diff);
@@ -437,20 +438,21 @@ static void hgpk_process_simple_packet(struct psmouse *psmouse)
437 int y = ((packet[0] << 3) & 0x100) - packet[2]; 438 int y = ((packet[0] << 3) & 0x100) - packet[2];
438 439
439 if (packet[0] & 0xc0) 440 if (packet[0] & 0xc0)
440 hgpk_dbg(psmouse, 441 psmouse_dbg(psmouse,
441 "overflow -- 0x%02x 0x%02x 0x%02x\n", 442 "overflow -- 0x%02x 0x%02x 0x%02x\n",
442 packet[0], packet[1], packet[2]); 443 packet[0], packet[1], packet[2]);
443 444
444 if (hgpk_discard_decay_hack(psmouse, x, y)) { 445 if (hgpk_discard_decay_hack(psmouse, x, y)) {
445 if (tpdebug) 446 if (tpdebug)
446 hgpk_dbg(psmouse, "discarding\n"); 447 psmouse_dbg(psmouse, "discarding\n");
447 return; 448 return;
448 } 449 }
449 450
450 hgpk_spewing_hack(psmouse, left, right, x, y); 451 hgpk_spewing_hack(psmouse, left, right, x, y);
451 452
452 if (tpdebug) 453 if (tpdebug)
453 hgpk_dbg(psmouse, "l=%d r=%d x=%d y=%d\n", left, right, x, y); 454 psmouse_dbg(psmouse, "l=%d r=%d x=%d y=%d\n",
455 left, right, x, y);
454 456
455 input_report_key(dev, BTN_LEFT, left); 457 input_report_key(dev, BTN_LEFT, left);
456 input_report_key(dev, BTN_RIGHT, right); 458 input_report_key(dev, BTN_RIGHT, right);
@@ -482,9 +484,8 @@ static psmouse_ret_t hgpk_process_byte(struct psmouse *psmouse)
482 * ugh, got a packet inside our recalibration 484 * ugh, got a packet inside our recalibration
483 * window, schedule another recalibration. 485 * window, schedule another recalibration.
484 */ 486 */
485 hgpk_dbg(psmouse, 487 psmouse_dbg(psmouse,
486 "packet inside calibration window, " 488 "packet inside calibration window, queueing another recalibration\n");
487 "queueing another recalibration\n");
488 psmouse_queue_work(psmouse, &priv->recalib_wq, 489 psmouse_queue_work(psmouse, &priv->recalib_wq,
489 msecs_to_jiffies(post_interrupt_delay)); 490 msecs_to_jiffies(post_interrupt_delay));
490 } 491 }
@@ -628,7 +629,7 @@ static int hgpk_reset_device(struct psmouse *psmouse, bool recalibrate)
628 629
629 err = hgpk_select_mode(psmouse); 630 err = hgpk_select_mode(psmouse);
630 if (err) { 631 if (err) {
631 hgpk_err(psmouse, "failed to select mode\n"); 632 psmouse_err(psmouse, "failed to select mode\n");
632 return err; 633 return err;
633 } 634 }
634 635
@@ -648,11 +649,11 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse)
648 return 0; 649 return 0;
649 650
650 if (!autorecal) { 651 if (!autorecal) {
651 hgpk_dbg(psmouse, "recalibrations disabled, ignoring\n"); 652 psmouse_dbg(psmouse, "recalibration disabled, ignoring\n");
652 return 0; 653 return 0;
653 } 654 }
654 655
655 hgpk_dbg(psmouse, "recalibrating touchpad..\n"); 656 psmouse_dbg(psmouse, "recalibrating touchpad..\n");
656 657
657 /* we don't want to race with the irq handler, nor with resyncs */ 658 /* we don't want to race with the irq handler, nor with resyncs */
658 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING); 659 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
@@ -675,7 +676,7 @@ static int hgpk_force_recalibrate(struct psmouse *psmouse)
675 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); 676 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
676 677
677 if (tpdebug) 678 if (tpdebug)
678 hgpk_dbg(psmouse, "touchpad reactivated\n"); 679 psmouse_dbg(psmouse, "touchpad reactivated\n");
679 680
680 /* 681 /*
681 * If we get packets right away after recalibrating, it's likely 682 * If we get packets right away after recalibrating, it's likely
@@ -727,16 +728,16 @@ static int hgpk_toggle_powersave(struct psmouse *psmouse, int enable)
727 728
728 err = hgpk_reset_device(psmouse, false); 729 err = hgpk_reset_device(psmouse, false);
729 if (err) { 730 if (err) {
730 hgpk_err(psmouse, "Failed to reset device!\n"); 731 psmouse_err(psmouse, "Failed to reset device!\n");
731 return err; 732 return err;
732 } 733 }
733 734
734 /* should be all set, enable the touchpad */ 735 /* should be all set, enable the touchpad */
735 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE); 736 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
736 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); 737 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
737 hgpk_dbg(psmouse, "Touchpad powered up.\n"); 738 psmouse_dbg(psmouse, "Touchpad powered up.\n");
738 } else { 739 } else {
739 hgpk_dbg(psmouse, "Powering off touchpad.\n"); 740 psmouse_dbg(psmouse, "Powering off touchpad.\n");
740 741
741 if (ps2_command(ps2dev, NULL, 0xec) || 742 if (ps2_command(ps2dev, NULL, 0xec) ||
742 ps2_command(ps2dev, NULL, 0xec) || 743 ps2_command(ps2dev, NULL, 0xec) ||
@@ -923,7 +924,7 @@ static void hgpk_recalib_work(struct work_struct *work)
923 struct psmouse *psmouse = priv->psmouse; 924 struct psmouse *psmouse = priv->psmouse;
924 925
925 if (hgpk_force_recalibrate(psmouse)) 926 if (hgpk_force_recalibrate(psmouse))
926 hgpk_err(psmouse, "recalibration failed!\n"); 927 psmouse_err(psmouse, "recalibration failed!\n");
927} 928}
928 929
929static int hgpk_register(struct psmouse *psmouse) 930static int hgpk_register(struct psmouse *psmouse)
@@ -947,14 +948,15 @@ static int hgpk_register(struct psmouse *psmouse)
947 err = device_create_file(&psmouse->ps2dev.serio->dev, 948 err = device_create_file(&psmouse->ps2dev.serio->dev,
948 &psmouse_attr_powered.dattr); 949 &psmouse_attr_powered.dattr);
949 if (err) { 950 if (err) {
950 hgpk_err(psmouse, "Failed creating 'powered' sysfs node\n"); 951 psmouse_err(psmouse, "Failed creating 'powered' sysfs node\n");
951 return err; 952 return err;
952 } 953 }
953 954
954 err = device_create_file(&psmouse->ps2dev.serio->dev, 955 err = device_create_file(&psmouse->ps2dev.serio->dev,
955 &psmouse_attr_hgpk_mode.dattr); 956 &psmouse_attr_hgpk_mode.dattr);
956 if (err) { 957 if (err) {
957 hgpk_err(psmouse, "Failed creating 'hgpk_mode' sysfs node\n"); 958 psmouse_err(psmouse,
959 "Failed creating 'hgpk_mode' sysfs node\n");
958 goto err_remove_powered; 960 goto err_remove_powered;
959 } 961 }
960 962
@@ -963,8 +965,8 @@ static int hgpk_register(struct psmouse *psmouse)
963 err = device_create_file(&psmouse->ps2dev.serio->dev, 965 err = device_create_file(&psmouse->ps2dev.serio->dev,
964 &psmouse_attr_recalibrate.dattr); 966 &psmouse_attr_recalibrate.dattr);
965 if (err) { 967 if (err) {
966 hgpk_err(psmouse, 968 psmouse_err(psmouse,
967 "Failed creating 'recalibrate' sysfs node\n"); 969 "Failed creating 'recalibrate' sysfs node\n");
968 goto err_remove_mode; 970 goto err_remove_mode;
969 } 971 }
970 } 972 }
@@ -1027,13 +1029,13 @@ static enum hgpk_model_t hgpk_get_model(struct psmouse *psmouse)
1027 return -EIO; 1029 return -EIO;
1028 } 1030 }
1029 1031
1030 hgpk_dbg(psmouse, "ID: %02x %02x %02x\n", param[0], param[1], param[2]); 1032 psmouse_dbg(psmouse, "ID: %02x %02x %02x\n", param[0], param[1], param[2]);
1031 1033
1032 /* HGPK signature: 0x67, 0x00, 0x<model> */ 1034 /* HGPK signature: 0x67, 0x00, 0x<model> */
1033 if (param[0] != 0x67 || param[1] != 0x00) 1035 if (param[0] != 0x67 || param[1] != 0x00)
1034 return -ENODEV; 1036 return -ENODEV;
1035 1037
1036 hgpk_info(psmouse, "OLPC touchpad revision 0x%x\n", param[2]); 1038 psmouse_info(psmouse, "OLPC touchpad revision 0x%x\n", param[2]);
1037 1039
1038 return param[2]; 1040 return param[2];
1039} 1041}
diff --git a/drivers/input/mouse/hgpk.h b/drivers/input/mouse/hgpk.h
index 311c0e87fcbf..dd686771cfe0 100644
--- a/drivers/input/mouse/hgpk.h
+++ b/drivers/input/mouse/hgpk.h
@@ -46,17 +46,6 @@ struct hgpk_data {
46 int xsaw_secondary, ysaw_secondary; /* jumpiness detection */ 46 int xsaw_secondary, ysaw_secondary; /* jumpiness detection */
47}; 47};
48 48
49#define hgpk_dbg(psmouse, format, arg...) \
50 dev_dbg(&(psmouse)->ps2dev.serio->dev, format, ## arg)
51#define hgpk_err(psmouse, format, arg...) \
52 dev_err(&(psmouse)->ps2dev.serio->dev, format, ## arg)
53#define hgpk_info(psmouse, format, arg...) \
54 dev_info(&(psmouse)->ps2dev.serio->dev, format, ## arg)
55#define hgpk_warn(psmouse, format, arg...) \
56 dev_warn(&(psmouse)->ps2dev.serio->dev, format, ## arg)
57#define hgpk_notice(psmouse, format, arg...) \
58 dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg)
59
60#ifdef CONFIG_MOUSE_PS2_OLPC 49#ifdef CONFIG_MOUSE_PS2_OLPC
61void hgpk_module_init(void); 50void hgpk_module_init(void);
62int hgpk_detect(struct psmouse *psmouse, bool set_properties); 51int hgpk_detect(struct psmouse *psmouse, bool set_properties);
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 83bcaba96b89..2c4db636de6c 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -169,8 +169,8 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
169 169
170 if (relative_packet) { 170 if (relative_packet) {
171 if (!dev2) 171 if (!dev2)
172 printk(KERN_WARNING "lifebook.c: got relative packet " 172 psmouse_warn(psmouse,
173 "but no relative device set up\n"); 173 "got relative packet but no relative device set up\n");
174 } else { 174 } else {
175 if (lifebook_use_6byte_proto) { 175 if (lifebook_use_6byte_proto) {
176 input_report_abs(dev1, ABS_X, 176 input_report_abs(dev1, ABS_X,
@@ -212,7 +212,7 @@ static int lifebook_absolute_mode(struct psmouse *psmouse)
212 212
213 /* 213 /*
214 * Enable absolute output -- ps2_command fails always but if 214 * Enable absolute output -- ps2_command fails always but if
215 * you leave this call out the touchsreen will never send 215 * you leave this call out the touchscreen will never send
216 * absolute coordinates 216 * absolute coordinates
217 */ 217 */
218 param = lifebook_use_6byte_proto ? 0x08 : 0x07; 218 param = lifebook_use_6byte_proto ? 0x08 : 0x07;
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index c9983aee9082..faac2c3bef74 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -82,11 +82,11 @@ static psmouse_ret_t ps2pp_process_byte(struct psmouse *psmouse)
82 packet[0] = packet[2] | 0x08; 82 packet[0] = packet[2] | 0x08;
83 break; 83 break;
84 84
85#ifdef DEBUG
86 default: 85 default:
87 printk(KERN_WARNING "psmouse.c: Received PS2++ packet #%x, but don't know how to handle.\n", 86 psmouse_dbg(psmouse,
88 (packet[1] >> 4) | (packet[0] & 0x30)); 87 "Received PS2++ packet #%x, but don't know how to handle.\n",
89#endif 88 (packet[1] >> 4) | (packet[0] & 0x30));
89 break;
90 } 90 }
91 } else { 91 } else {
92 /* Standard PS/2 motion data */ 92 /* Standard PS/2 motion data */
@@ -382,7 +382,7 @@ int ps2pp_init(struct psmouse *psmouse, bool set_properties)
382 } 382 }
383 383
384 } else { 384 } else {
385 printk(KERN_WARNING "logips2pp: Detected unknown logitech mouse model %d\n", model); 385 psmouse_warn(psmouse, "Detected unknown Logitech mouse model %d\n", model);
386 } 386 }
387 387
388 if (set_properties) { 388 if (set_properties) {
@@ -400,9 +400,9 @@ int ps2pp_init(struct psmouse *psmouse, bool set_properties)
400 error = device_create_file(&psmouse->ps2dev.serio->dev, 400 error = device_create_file(&psmouse->ps2dev.serio->dev,
401 &psmouse_attr_smartscroll.dattr); 401 &psmouse_attr_smartscroll.dattr);
402 if (error) { 402 if (error) {
403 printk(KERN_ERR 403 psmouse_err(psmouse,
404 "logips2pp.c: failed to create smartscroll " 404 "failed to create smartscroll sysfs attribute, error: %d\n",
405 "sysfs attribute, error: %d\n", error); 405 error);
406 return -1; 406 return -1;
407 } 407 }
408 } 408 }
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 3f74baee102b..9f352fbd7b4f 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -11,6 +11,9 @@
11 * the Free Software Foundation. 11 * the Free Software Foundation.
12 */ 12 */
13 13
14#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15#define psmouse_fmt(fmt) fmt
16
14#include <linux/delay.h> 17#include <linux/delay.h>
15#include <linux/module.h> 18#include <linux/module.h>
16#include <linux/slab.h> 19#include <linux/slab.h>
@@ -251,11 +254,14 @@ static int psmouse_handle_byte(struct psmouse *psmouse)
251 switch (rc) { 254 switch (rc) {
252 case PSMOUSE_BAD_DATA: 255 case PSMOUSE_BAD_DATA:
253 if (psmouse->state == PSMOUSE_ACTIVATED) { 256 if (psmouse->state == PSMOUSE_ACTIVATED) {
254 printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n", 257 psmouse_warn(psmouse,
255 psmouse->name, psmouse->phys, psmouse->pktcnt); 258 "%s at %s lost sync at byte %d\n",
259 psmouse->name, psmouse->phys,
260 psmouse->pktcnt);
256 if (++psmouse->out_of_sync_cnt == psmouse->resetafter) { 261 if (++psmouse->out_of_sync_cnt == psmouse->resetafter) {
257 __psmouse_set_state(psmouse, PSMOUSE_IGNORE); 262 __psmouse_set_state(psmouse, PSMOUSE_IGNORE);
258 printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n"); 263 psmouse_notice(psmouse,
264 "issuing reconnect request\n");
259 serio_reconnect(psmouse->ps2dev.serio); 265 serio_reconnect(psmouse->ps2dev.serio);
260 return -1; 266 return -1;
261 } 267 }
@@ -267,8 +273,9 @@ static int psmouse_handle_byte(struct psmouse *psmouse)
267 psmouse->pktcnt = 0; 273 psmouse->pktcnt = 0;
268 if (psmouse->out_of_sync_cnt) { 274 if (psmouse->out_of_sync_cnt) {
269 psmouse->out_of_sync_cnt = 0; 275 psmouse->out_of_sync_cnt = 0;
270 printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n", 276 psmouse_notice(psmouse,
271 psmouse->name, psmouse->phys); 277 "%s at %s - driver resynced.\n",
278 psmouse->name, psmouse->phys);
272 } 279 }
273 break; 280 break;
274 281
@@ -295,9 +302,10 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
295 ((flags & SERIO_PARITY) && !psmouse->ignore_parity))) { 302 ((flags & SERIO_PARITY) && !psmouse->ignore_parity))) {
296 303
297 if (psmouse->state == PSMOUSE_ACTIVATED) 304 if (psmouse->state == PSMOUSE_ACTIVATED)
298 printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n", 305 psmouse_warn(psmouse,
299 flags & SERIO_TIMEOUT ? " timeout" : "", 306 "bad data from KBC -%s%s\n",
300 flags & SERIO_PARITY ? " bad parity" : ""); 307 flags & SERIO_TIMEOUT ? " timeout" : "",
308 flags & SERIO_PARITY ? " bad parity" : "");
301 ps2_cmd_aborted(&psmouse->ps2dev); 309 ps2_cmd_aborted(&psmouse->ps2dev);
302 goto out; 310 goto out;
303 } 311 }
@@ -315,8 +323,8 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
315 323
316 if (psmouse->state == PSMOUSE_ACTIVATED && 324 if (psmouse->state == PSMOUSE_ACTIVATED &&
317 psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) { 325 psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) {
318 printk(KERN_INFO "psmouse.c: %s at %s lost synchronization, throwing %d bytes away.\n", 326 psmouse_info(psmouse, "%s at %s lost synchronization, throwing %d bytes away.\n",
319 psmouse->name, psmouse->phys, psmouse->pktcnt); 327 psmouse->name, psmouse->phys, psmouse->pktcnt);
320 psmouse->badbyte = psmouse->packet[0]; 328 psmouse->badbyte = psmouse->packet[0];
321 __psmouse_set_state(psmouse, PSMOUSE_RESYNCING); 329 __psmouse_set_state(psmouse, PSMOUSE_RESYNCING);
322 psmouse_queue_work(psmouse, &psmouse->resync_work, 0); 330 psmouse_queue_work(psmouse, &psmouse->resync_work, 0);
@@ -943,7 +951,8 @@ static int psmouse_probe(struct psmouse *psmouse)
943 */ 951 */
944 952
945 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_DIS)) 953 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_DIS))
946 printk(KERN_WARNING "psmouse.c: Failed to reset mouse on %s\n", ps2dev->serio->phys); 954 psmouse_warn(psmouse, "Failed to reset mouse on %s\n",
955 ps2dev->serio->phys);
947 956
948 return 0; 957 return 0;
949} 958}
@@ -1005,8 +1014,8 @@ static void psmouse_initialize(struct psmouse *psmouse)
1005static void psmouse_activate(struct psmouse *psmouse) 1014static void psmouse_activate(struct psmouse *psmouse)
1006{ 1015{
1007 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) 1016 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE))
1008 printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n", 1017 psmouse_warn(psmouse, "Failed to enable mouse on %s\n",
1009 psmouse->ps2dev.serio->phys); 1018 psmouse->ps2dev.serio->phys);
1010 1019
1011 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); 1020 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
1012} 1021}
@@ -1020,14 +1029,14 @@ static void psmouse_activate(struct psmouse *psmouse)
1020static void psmouse_deactivate(struct psmouse *psmouse) 1029static void psmouse_deactivate(struct psmouse *psmouse)
1021{ 1030{
1022 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE)) 1031 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE))
1023 printk(KERN_WARNING "psmouse.c: Failed to deactivate mouse on %s\n", 1032 psmouse_warn(psmouse, "Failed to deactivate mouse on %s\n",
1024 psmouse->ps2dev.serio->phys); 1033 psmouse->ps2dev.serio->phys);
1025 1034
1026 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); 1035 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
1027} 1036}
1028 1037
1029/* 1038/*
1030 * psmouse_poll() - default poll hanlder. Everyone except for ALPS uses it. 1039 * psmouse_poll() - default poll handler. Everyone except for ALPS uses it.
1031 */ 1040 */
1032 1041
1033static int psmouse_poll(struct psmouse *psmouse) 1042static int psmouse_poll(struct psmouse *psmouse)
@@ -1115,14 +1124,15 @@ static void psmouse_resync(struct work_struct *work)
1115 } 1124 }
1116 1125
1117 if (!enabled) { 1126 if (!enabled) {
1118 printk(KERN_WARNING "psmouse.c: failed to re-enable mouse on %s\n", 1127 psmouse_warn(psmouse, "failed to re-enable mouse on %s\n",
1119 psmouse->ps2dev.serio->phys); 1128 psmouse->ps2dev.serio->phys);
1120 failed = true; 1129 failed = true;
1121 } 1130 }
1122 1131
1123 if (failed) { 1132 if (failed) {
1124 psmouse_set_state(psmouse, PSMOUSE_IGNORE); 1133 psmouse_set_state(psmouse, PSMOUSE_IGNORE);
1125 printk(KERN_INFO "psmouse.c: resync failed, issuing reconnect request\n"); 1134 psmouse_info(psmouse,
1135 "resync failed, issuing reconnect request\n");
1126 serio_reconnect(serio); 1136 serio_reconnect(serio);
1127 } else 1137 } else
1128 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED); 1138 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
@@ -1155,8 +1165,8 @@ static void psmouse_cleanup(struct serio *serio)
1155 * Disable stream mode so cleanup routine can proceed undisturbed. 1165 * Disable stream mode so cleanup routine can proceed undisturbed.
1156 */ 1166 */
1157 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE)) 1167 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE))
1158 printk(KERN_WARNING "psmouse.c: Failed to disable mouse on %s\n", 1168 psmouse_warn(psmouse, "Failed to disable mouse on %s\n",
1159 psmouse->ps2dev.serio->phys); 1169 psmouse->ps2dev.serio->phys);
1160 1170
1161 if (psmouse->cleanup) 1171 if (psmouse->cleanup)
1162 psmouse->cleanup(psmouse); 1172 psmouse->cleanup(psmouse);
@@ -1400,7 +1410,8 @@ static int psmouse_reconnect(struct serio *serio)
1400 int rc = -1; 1410 int rc = -1;
1401 1411
1402 if (!drv || !psmouse) { 1412 if (!drv || !psmouse) {
1403 printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n"); 1413 psmouse_dbg(psmouse,
1414 "reconnect request, but serio is disconnected, ignoring...\n");
1404 return -1; 1415 return -1;
1405 } 1416 }
1406 1417
@@ -1427,8 +1438,9 @@ static int psmouse_reconnect(struct serio *serio)
1427 goto out; 1438 goto out;
1428 } 1439 }
1429 1440
1430 /* ok, the device type (and capabilities) match the old one, 1441 /*
1431 * we can continue using it, complete intialization 1442 * OK, the device type (and capabilities) match the old one,
1443 * we can continue using it, complete initialization
1432 */ 1444 */
1433 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); 1445 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
1434 1446
@@ -1586,9 +1598,8 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
1586 1598
1587 while (!list_empty(&serio->children)) { 1599 while (!list_empty(&serio->children)) {
1588 if (++retry > 3) { 1600 if (++retry > 3) {
1589 printk(KERN_WARNING 1601 psmouse_warn(psmouse,
1590 "psmouse: failed to destroy children ports, " 1602 "failed to destroy children ports, protocol change aborted.\n");
1591 "protocol change aborted.\n");
1592 input_free_device(new_dev); 1603 input_free_device(new_dev);
1593 return -EIO; 1604 return -EIO;
1594 } 1605 }
@@ -1715,7 +1726,7 @@ static int __init psmouse_init(void)
1715 1726
1716 kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); 1727 kpsmoused_wq = create_singlethread_workqueue("kpsmoused");
1717 if (!kpsmoused_wq) { 1728 if (!kpsmoused_wq) {
1718 printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); 1729 pr_err("failed to create kpsmoused workqueue\n");
1719 return -ENOMEM; 1730 return -ENOMEM;
1720 } 1731 }
1721 1732
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 593e910bfc7a..9b84b0c4e371 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -150,4 +150,29 @@ static struct psmouse_attribute psmouse_attr_##_name = { \
150 static ssize_t _set(struct psmouse *, void *, const char *, size_t); \ 150 static ssize_t _set(struct psmouse *, void *, const char *, size_t); \
151 __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, NULL, _set, true) 151 __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, NULL, _set, true)
152 152
153#ifndef psmouse_fmt
154#define psmouse_fmt(fmt) KBUILD_BASENAME ": " fmt
155#endif
156
157#define psmouse_dbg(psmouse, format, ...) \
158 dev_dbg(&(psmouse)->ps2dev.serio->dev, \
159 psmouse_fmt(format), ##__VA_ARGS__)
160#define psmouse_info(psmouse, format, ...) \
161 dev_info(&(psmouse)->ps2dev.serio->dev, \
162 psmouse_fmt(format), ##__VA_ARGS__)
163#define psmouse_warn(psmouse, format, ...) \
164 dev_warn(&(psmouse)->ps2dev.serio->dev, \
165 psmouse_fmt(format), ##__VA_ARGS__)
166#define psmouse_err(psmouse, format, ...) \
167 dev_err(&(psmouse)->ps2dev.serio->dev, \
168 psmouse_fmt(format), ##__VA_ARGS__)
169#define psmouse_notice(psmouse, format, ...) \
170 dev_notice(&(psmouse)->ps2dev.serio->dev, \
171 psmouse_fmt(format), ##__VA_ARGS__)
172#define psmouse_printk(level, psmouse, format, ...) \
173 dev_printk(level, \
174 &(psmouse)->ps2dev.serio->dev, \
175 psmouse_fmt(format), ##__VA_ARGS__)
176
177
153#endif /* _PSMOUSE_H */ 178#endif /* _PSMOUSE_H */
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index 2fc887a51066..c5b12d2e955a 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -607,11 +607,12 @@ static void fsp_packet_debug(unsigned char packet[])
607 607
608 ps2_packet_cnt++; 608 ps2_packet_cnt++;
609 jiffies_msec = jiffies_to_msecs(jiffies); 609 jiffies_msec = jiffies_to_msecs(jiffies);
610 printk(KERN_DEBUG "%08dms PS/2 packets: %02x, %02x, %02x, %02x\n", 610 psmouse_dbg(psmouse,
611 jiffies_msec, packet[0], packet[1], packet[2], packet[3]); 611 "%08dms PS/2 packets: %02x, %02x, %02x, %02x\n",
612 jiffies_msec, packet[0], packet[1], packet[2], packet[3]);
612 613
613 if (jiffies_msec - ps2_last_second > 1000) { 614 if (jiffies_msec - ps2_last_second > 1000) {
614 printk(KERN_DEBUG "PS/2 packets/sec = %d\n", ps2_packet_cnt); 615 psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt);
615 ps2_packet_cnt = 0; 616 ps2_packet_cnt = 0;
616 ps2_last_second = jiffies_msec; 617 ps2_last_second = jiffies_msec;
617 } 618 }
@@ -820,9 +821,9 @@ int fsp_init(struct psmouse *psmouse)
820 return -ENODEV; 821 return -ENODEV;
821 } 822 }
822 823
823 printk(KERN_INFO 824 psmouse_info(psmouse,
824 "Finger Sensing Pad, hw: %d.%d.%d, sw: %s, buttons: %d\n", 825 "Finger Sensing Pad, hw: %d.%d.%d, sw: %s, buttons: %d\n",
825 ver >> 4, ver & 0x0F, rev, fsp_drv_ver, buttons & 7); 826 ver >> 4, ver & 0x0F, rev, fsp_drv_ver, buttons & 7);
826 827
827 psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL); 828 psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL);
828 if (!priv) 829 if (!priv)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 30c85a5b7184..c080b828e5dc 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -167,8 +167,8 @@ static int synaptics_capability(struct psmouse *psmouse)
167 167
168 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { 168 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) {
169 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { 169 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) {
170 printk(KERN_ERR "Synaptics claims to have extended capabilities," 170 psmouse_warn(psmouse,
171 " but I'm not able to read them.\n"); 171 "device claims to have extended capabilities, but I'm not able to read them.\n");
172 } else { 172 } else {
173 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; 173 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
174 174
@@ -183,8 +183,8 @@ static int synaptics_capability(struct psmouse *psmouse)
183 183
184 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) { 184 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) {
185 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) { 185 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) {
186 printk(KERN_ERR "Synaptics claims to have extended capability 0x0c," 186 psmouse_warn(psmouse,
187 " but I'm not able to read it.\n"); 187 "device claims to have extended capability 0x0c, but I'm not able to read it.\n");
188 } else { 188 } else {
189 priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2]; 189 priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2];
190 } 190 }
@@ -232,8 +232,8 @@ static int synaptics_resolution(struct psmouse *psmouse)
232 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 && 232 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
233 SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) { 233 SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
234 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) { 234 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
235 printk(KERN_ERR "Synaptics claims to have max coordinates" 235 psmouse_warn(psmouse,
236 " query, but I'm not able to read it.\n"); 236 "device claims to have max coordinates query, but I'm not able to read it.\n");
237 } else { 237 } else {
238 priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); 238 priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
239 priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); 239 priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
@@ -243,8 +243,8 @@ static int synaptics_resolution(struct psmouse *psmouse)
243 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 && 243 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
244 SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) { 244 SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
245 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) { 245 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
246 printk(KERN_ERR "Synaptics claims to have min coordinates" 246 psmouse_warn(psmouse,
247 " query, but I'm not able to read it.\n"); 247 "device claims to have min coordinates query, but I'm not able to read it.\n");
248 } else { 248 } else {
249 priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); 249 priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
250 priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); 250 priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
@@ -388,7 +388,8 @@ static void synaptics_pt_activate(struct psmouse *psmouse)
388 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; 388 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT;
389 389
390 if (synaptics_mode_cmd(psmouse, priv->mode)) 390 if (synaptics_mode_cmd(psmouse, priv->mode))
391 printk(KERN_INFO "synaptics: failed to switch guest protocol\n"); 391 psmouse_warn(psmouse,
392 "failed to switch guest protocol\n");
392 } 393 }
393} 394}
394 395
@@ -398,7 +399,8 @@ static void synaptics_pt_create(struct psmouse *psmouse)
398 399
399 serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 400 serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
400 if (!serio) { 401 if (!serio) {
401 printk(KERN_ERR "synaptics: not enough memory to allocate pass-through port\n"); 402 psmouse_err(psmouse,
403 "not enough memory for pass-through port\n");
402 return; 404 return;
403 } 405 }
404 406
@@ -412,7 +414,8 @@ static void synaptics_pt_create(struct psmouse *psmouse)
412 414
413 psmouse->pt_activate = synaptics_pt_activate; 415 psmouse->pt_activate = synaptics_pt_activate;
414 416
415 printk(KERN_INFO "serio: %s port at %s\n", serio->name, psmouse->phys); 417 psmouse_info(psmouse, "serio: %s port at %s\n",
418 serio->name, psmouse->phys);
416 serio_register_port(serio); 419 serio_register_port(serio);
417} 420}
418 421
@@ -1049,13 +1052,15 @@ static void synaptics_process_packet(struct psmouse *psmouse)
1049 input_sync(dev); 1052 input_sync(dev);
1050} 1053}
1051 1054
1052static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned char pkt_type) 1055static int synaptics_validate_byte(struct psmouse *psmouse,
1056 int idx, unsigned char pkt_type)
1053{ 1057{
1054 static const unsigned char newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 }; 1058 static const unsigned char newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 };
1055 static const unsigned char newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 }; 1059 static const unsigned char newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 };
1056 static const unsigned char newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 }; 1060 static const unsigned char newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 };
1057 static const unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 }; 1061 static const unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 };
1058 static const unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 }; 1062 static const unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 };
1063 const char *packet = psmouse->packet;
1059 1064
1060 if (idx < 0 || idx > 4) 1065 if (idx < 0 || idx > 4)
1061 return 0; 1066 return 0;
@@ -1073,7 +1078,7 @@ static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned cha
1073 return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx]; 1078 return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx];
1074 1079
1075 default: 1080 default:
1076 printk(KERN_ERR "synaptics: unknown packet type %d\n", pkt_type); 1081 psmouse_err(psmouse, "unknown packet type %d\n", pkt_type);
1077 return 0; 1082 return 0;
1078 } 1083 }
1079} 1084}
@@ -1083,8 +1088,8 @@ static unsigned char synaptics_detect_pkt_type(struct psmouse *psmouse)
1083 int i; 1088 int i;
1084 1089
1085 for (i = 0; i < 5; i++) 1090 for (i = 0; i < 5; i++)
1086 if (!synaptics_validate_byte(psmouse->packet, i, SYN_NEWABS_STRICT)) { 1091 if (!synaptics_validate_byte(psmouse, i, SYN_NEWABS_STRICT)) {
1087 printk(KERN_INFO "synaptics: using relaxed packet validation\n"); 1092 psmouse_info(psmouse, "using relaxed packet validation\n");
1088 return SYN_NEWABS_RELAXED; 1093 return SYN_NEWABS_RELAXED;
1089 } 1094 }
1090 1095
@@ -1109,7 +1114,7 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse)
1109 return PSMOUSE_FULL_PACKET; 1114 return PSMOUSE_FULL_PACKET;
1110 } 1115 }
1111 1116
1112 return synaptics_validate_byte(psmouse->packet, psmouse->pktcnt - 1, priv->pkt_type) ? 1117 return synaptics_validate_byte(psmouse, psmouse->pktcnt - 1, priv->pkt_type) ?
1113 PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA; 1118 PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
1114} 1119}
1115 1120
@@ -1222,21 +1227,21 @@ static int synaptics_reconnect(struct psmouse *psmouse)
1222 return -1; 1227 return -1;
1223 1228
1224 if (retry > 1) 1229 if (retry > 1)
1225 printk(KERN_DEBUG "Synaptics reconnected after %d tries\n", 1230 psmouse_dbg(psmouse, "reconnected after %d tries\n", retry);
1226 retry);
1227 1231
1228 if (synaptics_query_hardware(psmouse)) { 1232 if (synaptics_query_hardware(psmouse)) {
1229 printk(KERN_ERR "Unable to query Synaptics hardware.\n"); 1233 psmouse_err(psmouse, "Unable to query device.\n");
1230 return -1; 1234 return -1;
1231 } 1235 }
1232 1236
1233 if (synaptics_set_absolute_mode(psmouse)) { 1237 if (synaptics_set_absolute_mode(psmouse)) {
1234 printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); 1238 psmouse_err(psmouse, "Unable to initialize device.\n");
1235 return -1; 1239 return -1;
1236 } 1240 }
1237 1241
1238 if (synaptics_set_advanced_gesture_mode(psmouse)) { 1242 if (synaptics_set_advanced_gesture_mode(psmouse)) {
1239 printk(KERN_ERR "Advanced gesture mode reconnect failed.\n"); 1243 psmouse_err(psmouse,
1244 "Advanced gesture mode reconnect failed.\n");
1240 return -1; 1245 return -1;
1241 } 1246 }
1242 1247
@@ -1244,12 +1249,12 @@ static int synaptics_reconnect(struct psmouse *psmouse)
1244 old_priv.model_id != priv->model_id || 1249 old_priv.model_id != priv->model_id ||
1245 old_priv.capabilities != priv->capabilities || 1250 old_priv.capabilities != priv->capabilities ||
1246 old_priv.ext_cap != priv->ext_cap) { 1251 old_priv.ext_cap != priv->ext_cap) {
1247 printk(KERN_ERR "Synaptics hardware appears to be different: " 1252 psmouse_err(psmouse,
1248 "id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n", 1253 "hardware appears to be different: id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n",
1249 old_priv.identity, priv->identity, 1254 old_priv.identity, priv->identity,
1250 old_priv.model_id, priv->model_id, 1255 old_priv.model_id, priv->model_id,
1251 old_priv.capabilities, priv->capabilities, 1256 old_priv.capabilities, priv->capabilities,
1252 old_priv.ext_cap, priv->ext_cap); 1257 old_priv.ext_cap, priv->ext_cap);
1253 return -1; 1258 return -1;
1254 } 1259 }
1255 1260
@@ -1330,7 +1335,8 @@ int synaptics_init(struct psmouse *psmouse)
1330 * just fine. 1335 * just fine.
1331 */ 1336 */
1332 if (broken_olpc_ec) { 1337 if (broken_olpc_ec) {
1333 printk(KERN_INFO "synaptics: OLPC XO detected, not enabling Synaptics protocol.\n"); 1338 psmouse_info(psmouse,
1339 "OLPC XO detected, not enabling Synaptics protocol.\n");
1334 return -ENODEV; 1340 return -ENODEV;
1335 } 1341 }
1336 1342
@@ -1341,26 +1347,28 @@ int synaptics_init(struct psmouse *psmouse)
1341 psmouse_reset(psmouse); 1347 psmouse_reset(psmouse);
1342 1348
1343 if (synaptics_query_hardware(psmouse)) { 1349 if (synaptics_query_hardware(psmouse)) {
1344 printk(KERN_ERR "Unable to query Synaptics hardware.\n"); 1350 psmouse_err(psmouse, "Unable to query device.\n");
1345 goto init_fail; 1351 goto init_fail;
1346 } 1352 }
1347 1353
1348 if (synaptics_set_absolute_mode(psmouse)) { 1354 if (synaptics_set_absolute_mode(psmouse)) {
1349 printk(KERN_ERR "Unable to initialize Synaptics hardware.\n"); 1355 psmouse_err(psmouse, "Unable to initialize device.\n");
1350 goto init_fail; 1356 goto init_fail;
1351 } 1357 }
1352 1358
1353 if (synaptics_set_advanced_gesture_mode(psmouse)) { 1359 if (synaptics_set_advanced_gesture_mode(psmouse)) {
1354 printk(KERN_ERR "Advanced gesture mode init failed.\n"); 1360 psmouse_err(psmouse, "Advanced gesture mode init failed.\n");
1355 goto init_fail; 1361 goto init_fail;
1356 } 1362 }
1357 1363
1358 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; 1364 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
1359 1365
1360 printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n", 1366 psmouse_info(psmouse,
1361 SYN_ID_MODEL(priv->identity), 1367 "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n",
1362 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), 1368 SYN_ID_MODEL(priv->identity),
1363 priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c); 1369 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
1370 priv->model_id,
1371 priv->capabilities, priv->ext_cap, priv->ext_cap_0c);
1364 1372
1365 set_input_params(psmouse->dev, priv); 1373 set_input_params(psmouse->dev, priv);
1366 1374
@@ -1392,8 +1400,9 @@ int synaptics_init(struct psmouse *psmouse)
1392 * the same rate as a standard PS/2 mouse). 1400 * the same rate as a standard PS/2 mouse).
1393 */ 1401 */
1394 if (psmouse->rate >= 80 && impaired_toshiba_kbc) { 1402 if (psmouse->rate >= 80 && impaired_toshiba_kbc) {
1395 printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", 1403 psmouse_info(psmouse,
1396 dmi_get_system_info(DMI_PRODUCT_NAME)); 1404 "Toshiba %s detected, limiting rate to 40pps.\n",
1405 dmi_get_system_info(DMI_PRODUCT_NAME));
1397 psmouse->rate = 40; 1406 psmouse->rate = 40;
1398 } 1407 }
1399 1408