Commit b5d21704361eefe337a36ebbb57a1d9927132511

Authored by Dmitry Torokhov
1 parent ae927560a7

Input: psmouse - switch to using dev_*() for messages

This will ensure our reporting is consistent with the rest of the system
and we do not refer to obsolete source file names.

Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: JJ Ding <dgdunix@gmail.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Showing 10 changed files with 243 additions and 198 deletions Side-by-side Diff

drivers/input/mouse/alps.c
... ... @@ -23,13 +23,6 @@
23 23 #include "psmouse.h"
24 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 26 #define ALPS_OLDPROTO 0x01 /* old style input */
34 27 #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */
35 28 #define ALPS_PASS 0x04 /* device has a pass-through port */
... ... @@ -297,10 +290,10 @@
297 290 psmouse->packet[4] |
298 291 psmouse->packet[5]) & 0x80) ||
299 292 (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) {
300   - dbg("refusing packet %x %x %x %x "
301   - "(suspected interleaved ps/2)\n",
302   - psmouse->packet[3], psmouse->packet[4],
303   - psmouse->packet[5], psmouse->packet[6]);
  293 + psmouse_dbg(psmouse,
  294 + "refusing packet %x %x %x %x (suspected interleaved ps/2)\n",
  295 + psmouse->packet[3], psmouse->packet[4],
  296 + psmouse->packet[5], psmouse->packet[6]);
304 297 return PSMOUSE_BAD_DATA;
305 298 }
306 299  
307 300  
... ... @@ -319,13 +312,13 @@
319 312 * There is also possibility that we got 6-byte ALPS
320 313 * packet followed by 3-byte packet from trackpoint. We
321 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 316 * normal operation (user would need to press all
324 317 * buttons on the pad and start moving trackpoint
325 318 * without touching the pad surface) we assume former.
326 319 * Even if we are wrong the wost thing that would happen
327 320 * the cursor would jump but we should not get protocol
328   - * desynchronization.
  321 + * de-synchronization.
329 322 */
330 323  
331 324 alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
... ... @@ -361,10 +354,10 @@
361 354 if ((psmouse->packet[3] |
362 355 psmouse->packet[4] |
363 356 psmouse->packet[5]) & 0x80) {
364   - dbg("refusing packet %x %x %x "
365   - "(suspected interleaved ps/2)\n",
366   - psmouse->packet[3], psmouse->packet[4],
367   - psmouse->packet[5]);
  357 + psmouse_dbg(psmouse,
  358 + "refusing packet %x %x %x (suspected interleaved ps/2)\n",
  359 + psmouse->packet[3], psmouse->packet[4],
  360 + psmouse->packet[5]);
368 361 } else {
369 362 alps_process_packet(psmouse);
370 363 }
371 364  
... ... @@ -396,16 +389,18 @@
396 389 }
397 390  
398 391 if (!alps_is_valid_first_byte(model, psmouse->packet[0])) {
399   - dbg("refusing packet[0] = %x (mask0 = %x, byte0 = %x)\n",
400   - psmouse->packet[0], model->mask0, model->byte0);
  392 + psmouse_dbg(psmouse,
  393 + "refusing packet[0] = %x (mask0 = %x, byte0 = %x)\n",
  394 + psmouse->packet[0], model->mask0, model->byte0);
401 395 return PSMOUSE_BAD_DATA;
402 396 }
403 397  
404 398 /* Bytes 2 - 6 should have 0 in the highest bit */
405 399 if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 &&
406 400 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
407   - dbg("refusing packet[%i] = %x\n",
408   - psmouse->pktcnt - 1, psmouse->packet[psmouse->pktcnt - 1]);
  401 + psmouse_dbg(psmouse, "refusing packet[%i] = %x\n",
  402 + psmouse->pktcnt - 1,
  403 + psmouse->packet[psmouse->pktcnt - 1]);
409 404 return PSMOUSE_BAD_DATA;
410 405 }
411 406  
... ... @@ -439,7 +434,8 @@
439 434 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
440 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 440 if (param[0] != 0 || param[1] != 0 || (param[2] != 10 && param[2] != 100))
445 441 return NULL;
... ... @@ -459,7 +455,8 @@
459 455 if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
460 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 461 if (version) {
465 462 for (i = 0; i < ARRAY_SIZE(rates) && param[2] != rates[i]; i++)
... ... @@ -527,7 +524,8 @@
527 524 ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
528 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 530 return 0;
533 531 }
534 532  
... ... @@ -605,12 +603,12 @@
605 603 }
606 604  
607 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 607 return -1;
610 608 }
611 609  
612 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 612 return -1;
615 613 }
616 614  
... ... @@ -621,7 +619,7 @@
621 619  
622 620 /* ALPS needs stream mode, otherwise it won't report any data */
623 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 623 return -1;
626 624 }
627 625  
drivers/input/mouse/elantech.c
... ... @@ -10,8 +10,6 @@
10 10 * Trademarks are the property of their respective owners.
11 11 */
12 12  
13   -#define pr_fmt(fmt) KBUILD_BASENAME ": " fmt
14   -
15 13 #include <linux/delay.h>
16 14 #include <linux/slab.h>
17 15 #include <linux/module.h>
... ... @@ -25,7 +23,8 @@
25 23 #define elantech_debug(fmt, ...) \
26 24 do { \
27 25 if (etd->debug) \
28   - printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
  26 + psmouse_printk(KERN_DEBUG, psmouse, \
  27 + fmt, ##__VA_ARGS__); \
29 28 } while (0)
30 29  
31 30 /*
... ... @@ -36,7 +35,7 @@
36 35 {
37 36 if (psmouse_sliced_command(psmouse, c) ||
38 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 39 return -1;
41 40 }
42 41  
... ... @@ -65,7 +64,7 @@
65 64 } while (tries > 0);
66 65  
67 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 69 return rc;
71 70 }
... ... @@ -117,7 +116,7 @@
117 116 }
118 117  
119 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 120 else if (etd->hw_version != 4)
122 121 *val = param[0];
123 122 else
... ... @@ -191,8 +190,9 @@
191 190 }
192 191  
193 192 if (rc)
194   - pr_err("failed to write register 0x%02x with value 0x%02x.\n",
195   - reg, val);
  193 + psmouse_err(psmouse,
  194 + "failed to write register 0x%02x with value 0x%02x.\n",
  195 + reg, val);
196 196  
197 197 return rc;
198 198 }
199 199  
... ... @@ -200,13 +200,13 @@
200 200 /*
201 201 * Dump a complete mouse movement packet to the syslog
202 202 */
203   -static void elantech_packet_dump(unsigned char *packet, int size)
  203 +static void elantech_packet_dump(struct psmouse *psmouse)
204 204 {
205 205 int i;
206 206  
207   - printk(KERN_DEBUG pr_fmt("PS/2 packet ["));
208   - for (i = 0; i < size; i++)
209   - printk("%s0x%02x ", (i) ? ", " : " ", packet[i]);
  207 + psmouse_printk(KERN_DEBUG, psmouse, "PS/2 packet [");
  208 + for (i = 0; i < psmouse->pktsize; i++)
  209 + printk("%s0x%02x ", i ? ", " : " ", psmouse->packet[i]);
210 210 printk("]\n");
211 211 }
212 212  
... ... @@ -705,7 +705,7 @@
705 705 return PSMOUSE_GOOD_DATA;
706 706  
707 707 if (etd->debug > 1)
708   - elantech_packet_dump(psmouse->packet, psmouse->pktsize);
  708 + elantech_packet_dump(psmouse);
709 709  
710 710 switch (etd->hw_version) {
711 711 case 1:
... ... @@ -801,7 +801,7 @@
801 801 /*
802 802 * Read back reg 0x10. For hardware version 1 we must make
803 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 805 * we read back the value we just wrote.
806 806 */
807 807 do {
808 808  
809 809  
... ... @@ -814,17 +814,19 @@
814 814 } while (tries > 0);
815 815  
816 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 819 } else if (etd->hw_version == 1 &&
819 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 823 rc = -1;
822 824 }
823 825 }
824 826  
825 827 skip_readback_reg_10:
826 828 if (rc)
827   - pr_err("failed to initialise registers.\n");
  829 + psmouse_err(psmouse, "failed to initialise registers.\n");
828 830  
829 831 return rc;
830 832 }
... ... @@ -1131,7 +1133,7 @@
1131 1133 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1132 1134 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1133 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 1137 return -1;
1136 1138 }
1137 1139  
... ... @@ -1141,8 +1143,9 @@
1141 1143 */
1142 1144 if (param[0] != 0x3c || param[1] != 0x03 ||
1143 1145 (param[2] != 0xc8 && param[2] != 0x00)) {
1144   - pr_debug("unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
1145   - param[0], param[1], param[2]);
  1146 + psmouse_dbg(psmouse,
  1147 + "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
  1148 + param[0], param[1], param[2]);
1146 1149 return -1;
1147 1150 }
1148 1151  
1149 1152  
1150 1153  
... ... @@ -1152,15 +1155,17 @@
1152 1155 * to Elantech magic knock and there might be more.
1153 1156 */
1154 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 1159 return -1;
1157 1160 }
1158 1161  
1159   - pr_debug("Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
1160   - param[0], param[1], param[2]);
  1162 + psmouse_dbg(psmouse,
  1163 + "Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
  1164 + param[0], param[1], param[2]);
1161 1165  
1162 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 1169 return -1;
1165 1170 }
1166 1171  
... ... @@ -1192,7 +1197,8 @@
1192 1197 return -1;
1193 1198  
1194 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 1202 return -1;
1197 1203 }
1198 1204  
1199 1205  
1200 1206  
1201 1207  
1202 1208  
1203 1209  
1204 1210  
1205 1211  
... ... @@ -1262,42 +1268,46 @@
1262 1268 * Do the version query again so we can store the result
1263 1269 */
1264 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 1272 goto init_fail;
1267 1273 }
1268 1274 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
1269 1275  
1270 1276 if (elantech_set_properties(etd)) {
1271   - pr_err("unknown hardware version, aborting...\n");
  1277 + psmouse_err(psmouse, "unknown hardware version, aborting...\n");
1272 1278 goto init_fail;
1273 1279 }
1274   - pr_info("assuming hardware version %d "
1275   - "(with firmware version 0x%02x%02x%02x)\n",
1276   - etd->hw_version, param[0], param[1], param[2]);
  1280 + psmouse_info(psmouse,
  1281 + "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n",
  1282 + etd->hw_version, param[0], param[1], param[2]);
1277 1283  
1278 1284 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
1279 1285 etd->capabilities)) {
1280   - pr_err("failed to query capabilities.\n");
  1286 + psmouse_err(psmouse, "failed to query capabilities.\n");
1281 1287 goto init_fail;
1282 1288 }
1283   - pr_info("Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n",
1284   - etd->capabilities[0], etd->capabilities[1],
1285   - etd->capabilities[2]);
  1289 + psmouse_info(psmouse,
  1290 + "Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n",
  1291 + etd->capabilities[0], etd->capabilities[1],
  1292 + etd->capabilities[2]);
1286 1293  
1287 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 1297 goto init_fail;
1290 1298 }
1291 1299  
1292 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 1302 goto init_fail;
1295 1303 }
1296 1304  
1297 1305 error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj,
1298 1306 &elantech_attr_group);
1299 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 1311 goto init_fail;
1302 1312 }
1303 1313  
drivers/input/mouse/hgpk.c
... ... @@ -136,10 +136,10 @@
136 136 /* discard if too big, or half that but > 4 times the prev delta */
137 137 if (avx > recalib_delta ||
138 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 140 priv->xbigj = avx;
141 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 143 priv->xbigj = avx;
144 144 priv->xsaw_secondary++;
145 145 } else {
146 146  
... ... @@ -151,10 +151,10 @@
151 151  
152 152 if (avy > recalib_delta ||
153 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 155 priv->ybigj = avy;
156 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 158 priv->ybigj = avy;
159 159 priv->ysaw_secondary++;
160 160 } else {
... ... @@ -168,7 +168,7 @@
168 168 priv->ylast = avy;
169 169  
170 170 if (do_recal && jumpy_delay) {
171   - hgpk_err(psmouse, "scheduling recalibration\n");
  171 + psmouse_warn(psmouse, "scheduling recalibration\n");
172 172 psmouse_queue_work(psmouse, &priv->recalib_wq,
173 173 msecs_to_jiffies(jumpy_delay));
174 174 }
... ... @@ -260,8 +260,8 @@
260 260 * movement, it is probably a case of the user moving the
261 261 * cursor very slowly across the screen. */
262 262 if (abs(priv->x_tally) < 3 && abs(priv->y_tally) < 3) {
263   - hgpk_err(psmouse, "packet spew detected (%d,%d)\n",
264   - priv->x_tally, priv->y_tally);
  263 + psmouse_warn(psmouse, "packet spew detected (%d,%d)\n",
  264 + priv->x_tally, priv->y_tally);
265 265 priv->spew_flag = RECALIBRATING;
266 266 psmouse_queue_work(psmouse, &priv->recalib_wq,
267 267 msecs_to_jiffies(spew_delay));
... ... @@ -333,12 +333,12 @@
333 333 }
334 334  
335 335 if (!valid)
336   - hgpk_dbg(psmouse,
337   - "bad data, mode %d (%d) %02x %02x %02x %02x %02x %02x\n",
338   - priv->mode, pktcnt,
339   - psmouse->packet[0], psmouse->packet[1],
340   - psmouse->packet[2], psmouse->packet[3],
341   - psmouse->packet[4], psmouse->packet[5]);
  336 + psmouse_dbg(psmouse,
  337 + "bad data, mode %d (%d) %02x %02x %02x %02x %02x %02x\n",
  338 + priv->mode, pktcnt,
  339 + psmouse->packet[0], psmouse->packet[1],
  340 + psmouse->packet[2], psmouse->packet[3],
  341 + psmouse->packet[4], psmouse->packet[5]);
342 342  
343 343 return valid;
344 344 }
345 345  
346 346  
... ... @@ -361,19 +361,20 @@
361 361  
362 362 input_report_abs(idev, ABS_PRESSURE, z);
363 363 if (tpdebug)
364   - hgpk_dbg(psmouse, "pd=%d fd=%d z=%d",
365   - pt_down, finger_down, z);
  364 + psmouse_dbg(psmouse, "pd=%d fd=%d z=%d",
  365 + pt_down, finger_down, z);
366 366 } else {
367 367 /*
368 368 * PenTablet mode does not report pressure, so we don't
369 369 * report it here
370 370 */
371 371 if (tpdebug)
372   - hgpk_dbg(psmouse, "pd=%d ", down);
  372 + psmouse_dbg(psmouse, "pd=%d ", down);
373 373 }
374 374  
375 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 379 input_report_key(idev, BTN_TOUCH, down);
379 380 input_report_key(idev, BTN_LEFT, left);
... ... @@ -395,7 +396,7 @@
395 396 if (x == priv->abs_x && y == priv->abs_y) {
396 397 if (++priv->dupe_count > SPEW_WATCH_COUNT) {
397 398 if (tpdebug)
398   - hgpk_dbg(psmouse, "hard spew detected\n");
  399 + psmouse_dbg(psmouse, "hard spew detected\n");
399 400 priv->spew_flag = RECALIBRATING;
400 401 psmouse_queue_work(psmouse, &priv->recalib_wq,
401 402 msecs_to_jiffies(spew_delay));
... ... @@ -412,7 +413,7 @@
412 413 int y_diff = priv->abs_y - y;
413 414 if (hgpk_discard_decay_hack(psmouse, x_diff, y_diff)) {
414 415 if (tpdebug)
415   - hgpk_dbg(psmouse, "discarding\n");
  416 + psmouse_dbg(psmouse, "discarding\n");
416 417 goto done;
417 418 }
418 419 hgpk_spewing_hack(psmouse, left, right, x_diff, y_diff);
419 420  
420 421  
... ... @@ -437,20 +438,21 @@
437 438 int y = ((packet[0] << 3) & 0x100) - packet[2];
438 439  
439 440 if (packet[0] & 0xc0)
440   - hgpk_dbg(psmouse,
441   - "overflow -- 0x%02x 0x%02x 0x%02x\n",
442   - packet[0], packet[1], packet[2]);
  441 + psmouse_dbg(psmouse,
  442 + "overflow -- 0x%02x 0x%02x 0x%02x\n",
  443 + packet[0], packet[1], packet[2]);
443 444  
444 445 if (hgpk_discard_decay_hack(psmouse, x, y)) {
445 446 if (tpdebug)
446   - hgpk_dbg(psmouse, "discarding\n");
  447 + psmouse_dbg(psmouse, "discarding\n");
447 448 return;
448 449 }
449 450  
450 451 hgpk_spewing_hack(psmouse, left, right, x, y);
451 452  
452 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 457 input_report_key(dev, BTN_LEFT, left);
456 458 input_report_key(dev, BTN_RIGHT, right);
... ... @@ -482,9 +484,8 @@
482 484 * ugh, got a packet inside our recalibration
483 485 * window, schedule another recalibration.
484 486 */
485   - hgpk_dbg(psmouse,
486   - "packet inside calibration window, "
487   - "queueing another recalibration\n");
  487 + psmouse_dbg(psmouse,
  488 + "packet inside calibration window, queueing another recalibration\n");
488 489 psmouse_queue_work(psmouse, &priv->recalib_wq,
489 490 msecs_to_jiffies(post_interrupt_delay));
490 491 }
... ... @@ -628,7 +629,7 @@
628 629  
629 630 err = hgpk_select_mode(psmouse);
630 631 if (err) {
631   - hgpk_err(psmouse, "failed to select mode\n");
  632 + psmouse_err(psmouse, "failed to select mode\n");
632 633 return err;
633 634 }
634 635  
635 636  
... ... @@ -648,11 +649,11 @@
648 649 return 0;
649 650  
650 651 if (!autorecal) {
651   - hgpk_dbg(psmouse, "recalibrations disabled, ignoring\n");
  652 + psmouse_dbg(psmouse, "recalibration disabled, ignoring\n");
652 653 return 0;
653 654 }
654 655  
655   - hgpk_dbg(psmouse, "recalibrating touchpad..\n");
  656 + psmouse_dbg(psmouse, "recalibrating touchpad..\n");
656 657  
657 658 /* we don't want to race with the irq handler, nor with resyncs */
658 659 psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
... ... @@ -675,7 +676,7 @@
675 676 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
676 677  
677 678 if (tpdebug)
678   - hgpk_dbg(psmouse, "touchpad reactivated\n");
  679 + psmouse_dbg(psmouse, "touchpad reactivated\n");
679 680  
680 681 /*
681 682 * If we get packets right away after recalibrating, it's likely
682 683  
683 684  
... ... @@ -727,16 +728,16 @@
727 728  
728 729 err = hgpk_reset_device(psmouse, false);
729 730 if (err) {
730   - hgpk_err(psmouse, "Failed to reset device!\n");
  731 + psmouse_err(psmouse, "Failed to reset device!\n");
731 732 return err;
732 733 }
733 734  
734 735 /* should be all set, enable the touchpad */
735 736 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
736 737 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
737   - hgpk_dbg(psmouse, "Touchpad powered up.\n");
  738 + psmouse_dbg(psmouse, "Touchpad powered up.\n");
738 739 } else {
739   - hgpk_dbg(psmouse, "Powering off touchpad.\n");
  740 + psmouse_dbg(psmouse, "Powering off touchpad.\n");
740 741  
741 742 if (ps2_command(ps2dev, NULL, 0xec) ||
742 743 ps2_command(ps2dev, NULL, 0xec) ||
... ... @@ -923,7 +924,7 @@
923 924 struct psmouse *psmouse = priv->psmouse;
924 925  
925 926 if (hgpk_force_recalibrate(psmouse))
926   - hgpk_err(psmouse, "recalibration failed!\n");
  927 + psmouse_err(psmouse, "recalibration failed!\n");
927 928 }
928 929  
929 930 static int hgpk_register(struct psmouse *psmouse)
930 931  
... ... @@ -947,14 +948,15 @@
947 948 err = device_create_file(&psmouse->ps2dev.serio->dev,
948 949 &psmouse_attr_powered.dattr);
949 950 if (err) {
950   - hgpk_err(psmouse, "Failed creating 'powered' sysfs node\n");
  951 + psmouse_err(psmouse, "Failed creating 'powered' sysfs node\n");
951 952 return err;
952 953 }
953 954  
954 955 err = device_create_file(&psmouse->ps2dev.serio->dev,
955 956 &psmouse_attr_hgpk_mode.dattr);
956 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 960 goto err_remove_powered;
959 961 }
960 962  
... ... @@ -963,8 +965,8 @@
963 965 err = device_create_file(&psmouse->ps2dev.serio->dev,
964 966 &psmouse_attr_recalibrate.dattr);
965 967 if (err) {
966   - hgpk_err(psmouse,
967   - "Failed creating 'recalibrate' sysfs node\n");
  968 + psmouse_err(psmouse,
  969 + "Failed creating 'recalibrate' sysfs node\n");
968 970 goto err_remove_mode;
969 971 }
970 972 }
971 973  
... ... @@ -1027,13 +1029,13 @@
1027 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 1034 /* HGPK signature: 0x67, 0x00, 0x<model> */
1033 1035 if (param[0] != 0x67 || param[1] != 0x00)
1034 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 1040 return param[2];
1039 1041 }
drivers/input/mouse/hgpk.h
... ... @@ -46,17 +46,6 @@
46 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 49 #ifdef CONFIG_MOUSE_PS2_OLPC
61 50 void hgpk_module_init(void);
62 51 int hgpk_detect(struct psmouse *psmouse, bool set_properties);
drivers/input/mouse/lifebook.c
... ... @@ -169,8 +169,8 @@
169 169  
170 170 if (relative_packet) {
171 171 if (!dev2)
172   - printk(KERN_WARNING "lifebook.c: got relative packet "
173   - "but no relative device set up\n");
  172 + psmouse_warn(psmouse,
  173 + "got relative packet but no relative device set up\n");
174 174 } else {
175 175 if (lifebook_use_6byte_proto) {
176 176 input_report_abs(dev1, ABS_X,
... ... @@ -212,7 +212,7 @@
212 212  
213 213 /*
214 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 216 * absolute coordinates
217 217 */
218 218 param = lifebook_use_6byte_proto ? 0x08 : 0x07;
drivers/input/mouse/logips2pp.c
... ... @@ -82,11 +82,11 @@
82 82 packet[0] = packet[2] | 0x08;
83 83 break;
84 84  
85   -#ifdef DEBUG
86 85 default:
87   - printk(KERN_WARNING "psmouse.c: Received PS2++ packet #%x, but don't know how to handle.\n",
88   - (packet[1] >> 4) | (packet[0] & 0x30));
89   -#endif
  86 + psmouse_dbg(psmouse,
  87 + "Received PS2++ packet #%x, but don't know how to handle.\n",
  88 + (packet[1] >> 4) | (packet[0] & 0x30));
  89 + break;
90 90 }
91 91 } else {
92 92 /* Standard PS/2 motion data */
... ... @@ -382,7 +382,7 @@
382 382 }
383 383  
384 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 388 if (set_properties) {
... ... @@ -400,9 +400,9 @@
400 400 error = device_create_file(&psmouse->ps2dev.serio->dev,
401 401 &psmouse_attr_smartscroll.dattr);
402 402 if (error) {
403   - printk(KERN_ERR
404   - "logips2pp.c: failed to create smartscroll "
405   - "sysfs attribute, error: %d\n", error);
  403 + psmouse_err(psmouse,
  404 + "failed to create smartscroll sysfs attribute, error: %d\n",
  405 + error);
406 406 return -1;
407 407 }
408 408 }
drivers/input/mouse/psmouse-base.c
... ... @@ -11,6 +11,9 @@
11 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 17 #include <linux/delay.h>
15 18 #include <linux/module.h>
16 19 #include <linux/slab.h>
17 20  
... ... @@ -251,11 +254,14 @@
251 254 switch (rc) {
252 255 case PSMOUSE_BAD_DATA:
253 256 if (psmouse->state == PSMOUSE_ACTIVATED) {
254   - printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n",
255   - psmouse->name, psmouse->phys, psmouse->pktcnt);
  257 + psmouse_warn(psmouse,
  258 + "%s at %s lost sync at byte %d\n",
  259 + psmouse->name, psmouse->phys,
  260 + psmouse->pktcnt);
256 261 if (++psmouse->out_of_sync_cnt == psmouse->resetafter) {
257 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 265 serio_reconnect(psmouse->ps2dev.serio);
260 266 return -1;
261 267 }
... ... @@ -267,8 +273,9 @@
267 273 psmouse->pktcnt = 0;
268 274 if (psmouse->out_of_sync_cnt) {
269 275 psmouse->out_of_sync_cnt = 0;
270   - printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n",
271   - psmouse->name, psmouse->phys);
  276 + psmouse_notice(psmouse,
  277 + "%s at %s - driver resynced.\n",
  278 + psmouse->name, psmouse->phys);
272 279 }
273 280 break;
274 281  
... ... @@ -295,9 +302,10 @@
295 302 ((flags & SERIO_PARITY) && !psmouse->ignore_parity))) {
296 303  
297 304 if (psmouse->state == PSMOUSE_ACTIVATED)
298   - printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n",
299   - flags & SERIO_TIMEOUT ? " timeout" : "",
300   - flags & SERIO_PARITY ? " bad parity" : "");
  305 + psmouse_warn(psmouse,
  306 + "bad data from KBC -%s%s\n",
  307 + flags & SERIO_TIMEOUT ? " timeout" : "",
  308 + flags & SERIO_PARITY ? " bad parity" : "");
301 309 ps2_cmd_aborted(&psmouse->ps2dev);
302 310 goto out;
303 311 }
... ... @@ -315,8 +323,8 @@
315 323  
316 324 if (psmouse->state == PSMOUSE_ACTIVATED &&
317 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",
319   - psmouse->name, psmouse->phys, psmouse->pktcnt);
  326 + psmouse_info(psmouse, "%s at %s lost synchronization, throwing %d bytes away.\n",
  327 + psmouse->name, psmouse->phys, psmouse->pktcnt);
320 328 psmouse->badbyte = psmouse->packet[0];
321 329 __psmouse_set_state(psmouse, PSMOUSE_RESYNCING);
322 330 psmouse_queue_work(psmouse, &psmouse->resync_work, 0);
... ... @@ -943,7 +951,8 @@
943 951 */
944 952  
945 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 957 return 0;
949 958 }
... ... @@ -1005,8 +1014,8 @@
1005 1014 static void psmouse_activate(struct psmouse *psmouse)
1006 1015 {
1007 1016 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE))
1008   - printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n",
1009   - psmouse->ps2dev.serio->phys);
  1017 + psmouse_warn(psmouse, "Failed to enable mouse on %s\n",
  1018 + psmouse->ps2dev.serio->phys);
1010 1019  
1011 1020 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
1012 1021 }
1013 1022  
... ... @@ -1020,14 +1029,14 @@
1020 1029 static void psmouse_deactivate(struct psmouse *psmouse)
1021 1030 {
1022 1031 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE))
1023   - printk(KERN_WARNING "psmouse.c: Failed to deactivate mouse on %s\n",
1024   - psmouse->ps2dev.serio->phys);
  1032 + psmouse_warn(psmouse, "Failed to deactivate mouse on %s\n",
  1033 + psmouse->ps2dev.serio->phys);
1025 1034  
1026 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  
1033 1042 static int psmouse_poll(struct psmouse *psmouse)
1034 1043  
... ... @@ -1115,14 +1124,15 @@
1115 1124 }
1116 1125  
1117 1126 if (!enabled) {
1118   - printk(KERN_WARNING "psmouse.c: failed to re-enable mouse on %s\n",
1119   - psmouse->ps2dev.serio->phys);
  1127 + psmouse_warn(psmouse, "failed to re-enable mouse on %s\n",
  1128 + psmouse->ps2dev.serio->phys);
1120 1129 failed = true;
1121 1130 }
1122 1131  
1123 1132 if (failed) {
1124 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 1136 serio_reconnect(serio);
1127 1137 } else
1128 1138 psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
... ... @@ -1155,8 +1165,8 @@
1155 1165 * Disable stream mode so cleanup routine can proceed undisturbed.
1156 1166 */
1157 1167 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE))
1158   - printk(KERN_WARNING "psmouse.c: Failed to disable mouse on %s\n",
1159   - psmouse->ps2dev.serio->phys);
  1168 + psmouse_warn(psmouse, "Failed to disable mouse on %s\n",
  1169 + psmouse->ps2dev.serio->phys);
1160 1170  
1161 1171 if (psmouse->cleanup)
1162 1172 psmouse->cleanup(psmouse);
... ... @@ -1400,7 +1410,8 @@
1400 1410 int rc = -1;
1401 1411  
1402 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 1415 return -1;
1405 1416 }
1406 1417  
... ... @@ -1427,8 +1438,9 @@
1427 1438 goto out;
1428 1439 }
1429 1440  
1430   - /* ok, the device type (and capabilities) match the old one,
1431   - * we can continue using it, complete intialization
  1441 + /*
  1442 + * OK, the device type (and capabilities) match the old one,
  1443 + * we can continue using it, complete initialization
1432 1444 */
1433 1445 psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
1434 1446  
... ... @@ -1586,9 +1598,8 @@
1586 1598  
1587 1599 while (!list_empty(&serio->children)) {
1588 1600 if (++retry > 3) {
1589   - printk(KERN_WARNING
1590   - "psmouse: failed to destroy children ports, "
1591   - "protocol change aborted.\n");
  1601 + psmouse_warn(psmouse,
  1602 + "failed to destroy children ports, protocol change aborted.\n");
1592 1603 input_free_device(new_dev);
1593 1604 return -EIO;
1594 1605 }
... ... @@ -1715,7 +1726,7 @@
1715 1726  
1716 1727 kpsmoused_wq = create_singlethread_workqueue("kpsmoused");
1717 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 1730 return -ENOMEM;
1720 1731 }
1721 1732  
drivers/input/mouse/psmouse.h
... ... @@ -150,5 +150,30 @@
150 150 static ssize_t _set(struct psmouse *, void *, const char *, size_t); \
151 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 178 #endif /* _PSMOUSE_H */
drivers/input/mouse/sentelic.c
... ... @@ -607,11 +607,12 @@
607 607  
608 608 ps2_packet_cnt++;
609 609 jiffies_msec = jiffies_to_msecs(jiffies);
610   - printk(KERN_DEBUG "%08dms PS/2 packets: %02x, %02x, %02x, %02x\n",
611   - jiffies_msec, packet[0], packet[1], packet[2], packet[3]);
  610 + psmouse_dbg(psmouse,
  611 + "%08dms PS/2 packets: %02x, %02x, %02x, %02x\n",
  612 + jiffies_msec, packet[0], packet[1], packet[2], packet[3]);
612 613  
613 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 616 ps2_packet_cnt = 0;
616 617 ps2_last_second = jiffies_msec;
617 618 }
... ... @@ -820,9 +821,9 @@
820 821 return -ENODEV;
821 822 }
822 823  
823   - printk(KERN_INFO
824   - "Finger Sensing Pad, hw: %d.%d.%d, sw: %s, buttons: %d\n",
825   - ver >> 4, ver & 0x0F, rev, fsp_drv_ver, buttons & 7);
  824 + psmouse_info(psmouse,
  825 + "Finger Sensing Pad, hw: %d.%d.%d, sw: %s, buttons: %d\n",
  826 + ver >> 4, ver & 0x0F, rev, fsp_drv_ver, buttons & 7);
826 827  
827 828 psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL);
828 829 if (!priv)
drivers/input/mouse/synaptics.c
... ... @@ -167,8 +167,8 @@
167 167  
168 168 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) {
169 169 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) {
170   - printk(KERN_ERR "Synaptics claims to have extended capabilities,"
171   - " but I'm not able to read them.\n");
  170 + psmouse_warn(psmouse,
  171 + "device claims to have extended capabilities, but I'm not able to read them.\n");
172 172 } else {
173 173 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
174 174  
... ... @@ -183,8 +183,8 @@
183 183  
184 184 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) {
185 185 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) {
186   - printk(KERN_ERR "Synaptics claims to have extended capability 0x0c,"
187   - " but I'm not able to read it.\n");
  186 + psmouse_warn(psmouse,
  187 + "device claims to have extended capability 0x0c, but I'm not able to read it.\n");
188 188 } else {
189 189 priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2];
190 190 }
... ... @@ -232,8 +232,8 @@
232 232 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
233 233 SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
234 234 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
235   - printk(KERN_ERR "Synaptics claims to have max coordinates"
236   - " query, but I'm not able to read it.\n");
  235 + psmouse_warn(psmouse,
  236 + "device claims to have max coordinates query, but I'm not able to read it.\n");
237 237 } else {
238 238 priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
239 239 priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
... ... @@ -243,8 +243,8 @@
243 243 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
244 244 SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
245 245 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
246   - printk(KERN_ERR "Synaptics claims to have min coordinates"
247   - " query, but I'm not able to read it.\n");
  246 + psmouse_warn(psmouse,
  247 + "device claims to have min coordinates query, but I'm not able to read it.\n");
248 248 } else {
249 249 priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
250 250 priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
... ... @@ -388,7 +388,8 @@
388 388 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT;
389 389  
390 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 @@
398 399  
399 400 serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
400 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 404 return;
403 405 }
404 406  
... ... @@ -412,7 +414,8 @@
412 414  
413 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 419 serio_register_port(serio);
417 420 }
418 421  
419 422  
... ... @@ -1049,13 +1052,15 @@
1049 1052 input_sync(dev);
1050 1053 }
1051 1054  
1052   -static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned char pkt_type)
  1055 +static int synaptics_validate_byte(struct psmouse *psmouse,
  1056 + int idx, unsigned char pkt_type)
1053 1057 {
1054 1058 static const unsigned char newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 };
1055 1059 static const unsigned char newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 };
1056 1060 static const unsigned char newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 };
1057 1061 static const unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 };
1058 1062 static const unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 };
  1063 + const char *packet = psmouse->packet;
1059 1064  
1060 1065 if (idx < 0 || idx > 4)
1061 1066 return 0;
... ... @@ -1073,7 +1078,7 @@
1073 1078 return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx];
1074 1079  
1075 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 1082 return 0;
1078 1083 }
1079 1084 }
... ... @@ -1083,8 +1088,8 @@
1083 1088 int i;
1084 1089  
1085 1090 for (i = 0; i < 5; i++)
1086   - if (!synaptics_validate_byte(psmouse->packet, i, SYN_NEWABS_STRICT)) {
1087   - printk(KERN_INFO "synaptics: using relaxed packet validation\n");
  1091 + if (!synaptics_validate_byte(psmouse, i, SYN_NEWABS_STRICT)) {
  1092 + psmouse_info(psmouse, "using relaxed packet validation\n");
1088 1093 return SYN_NEWABS_RELAXED;
1089 1094 }
1090 1095  
... ... @@ -1109,7 +1114,7 @@
1109 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 1118 PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
1114 1119 }
1115 1120  
1116 1121  
1117 1122  
1118 1123  
... ... @@ -1222,21 +1227,21 @@
1222 1227 return -1;
1223 1228  
1224 1229 if (retry > 1)
1225   - printk(KERN_DEBUG "Synaptics reconnected after %d tries\n",
1226   - retry);
  1230 + psmouse_dbg(psmouse, "reconnected after %d tries\n", retry);
1227 1231  
1228 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 1234 return -1;
1231 1235 }
1232 1236  
1233 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 1239 return -1;
1236 1240 }
1237 1241  
1238 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 1245 return -1;
1241 1246 }
1242 1247  
... ... @@ -1244,12 +1249,12 @@
1244 1249 old_priv.model_id != priv->model_id ||
1245 1250 old_priv.capabilities != priv->capabilities ||
1246 1251 old_priv.ext_cap != priv->ext_cap) {
1247   - printk(KERN_ERR "Synaptics hardware appears to be different: "
1248   - "id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n",
1249   - old_priv.identity, priv->identity,
1250   - old_priv.model_id, priv->model_id,
1251   - old_priv.capabilities, priv->capabilities,
1252   - old_priv.ext_cap, priv->ext_cap);
  1252 + psmouse_err(psmouse,
  1253 + "hardware appears to be different: id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n",
  1254 + old_priv.identity, priv->identity,
  1255 + old_priv.model_id, priv->model_id,
  1256 + old_priv.capabilities, priv->capabilities,
  1257 + old_priv.ext_cap, priv->ext_cap);
1253 1258 return -1;
1254 1259 }
1255 1260  
... ... @@ -1330,7 +1335,8 @@
1330 1335 * just fine.
1331 1336 */
1332 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 1340 return -ENODEV;
1335 1341 }
1336 1342  
1337 1343  
1338 1344  
1339 1345  
... ... @@ -1341,26 +1347,28 @@
1341 1347 psmouse_reset(psmouse);
1342 1348  
1343 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 1351 goto init_fail;
1346 1352 }
1347 1353  
1348 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 1356 goto init_fail;
1351 1357 }
1352 1358  
1353 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 1361 goto init_fail;
1356 1362 }
1357 1363  
1358 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",
1361   - SYN_ID_MODEL(priv->identity),
1362   - SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
1363   - priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c);
  1366 + psmouse_info(psmouse,
  1367 + "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n",
  1368 + SYN_ID_MODEL(priv->identity),
  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 1373 set_input_params(psmouse->dev, priv);
1366 1374  
... ... @@ -1392,8 +1400,9 @@
1392 1400 * the same rate as a standard PS/2 mouse).
1393 1401 */
1394 1402 if (psmouse->rate >= 80 && impaired_toshiba_kbc) {
1395   - printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n",
1396   - dmi_get_system_info(DMI_PRODUCT_NAME));
  1403 + psmouse_info(psmouse,
  1404 + "Toshiba %s detected, limiting rate to 40pps.\n",
  1405 + dmi_get_system_info(DMI_PRODUCT_NAME));
1397 1406 psmouse->rate = 40;
1398 1407 }
1399 1408