Skip to content

Commit b5d2170

Browse files
committed
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>
1 parent ae92756 commit b5d2170

10 files changed

Lines changed: 243 additions & 198 deletions

File tree

‎drivers/input/mouse/alps.c‎

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@
2323
#include "psmouse.h"
2424
#include "alps.h"
2525

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-
3326
#define ALPS_OLDPROTO 0x01 /* old style input */
3427
#define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */
3528
#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)
297290
psmouse->packet[4] |
298291
psmouse->packet[5]) & 0x80) ||
299292
(!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]);
304297
return PSMOUSE_BAD_DATA;
305298
}
306299

@@ -319,13 +312,13 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
319312
* There is also possibility that we got 6-byte ALPS
320313
* packet followed by 3-byte packet from trackpoint. We
321314
* 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
323316
* normal operation (user would need to press all
324317
* buttons on the pad and start moving trackpoint
325318
* without touching the pad surface) we assume former.
326319
* Even if we are wrong the wost thing that would happen
327320
* the cursor would jump but we should not get protocol
328-
* desynchronization.
321+
* de-synchronization.
329322
*/
330323

331324
alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
@@ -361,10 +354,10 @@ static void alps_flush_packet(unsigned long data)
361354
if ((psmouse->packet[3] |
362355
psmouse->packet[4] |
363356
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]);
368361
} else {
369362
alps_process_packet(psmouse);
370363
}
@@ -396,16 +389,18 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
396389
}
397390

398391
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);
401395
return PSMOUSE_BAD_DATA;
402396
}
403397

404398
/* Bytes 2 - 6 should have 0 in the highest bit */
405399
if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 &&
406400
(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]);
409404
return PSMOUSE_BAD_DATA;
410405
}
411406

@@ -439,7 +434,8 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
439434
if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
440435
return NULL;
441436

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]);
443439

444440
if (param[0] != 0 || param[1] != 0 || (param[2] != 10 && param[2] != 100))
445441
return NULL;
@@ -459,7 +455,8 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
459455
if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
460456
return NULL;
461457

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]);
463460

464461
if (version) {
465462
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)
527524
ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
528525
return -1;
529526

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]);
531529

532530
return 0;
533531
}
@@ -605,12 +603,12 @@ static int alps_hw_init(struct psmouse *psmouse)
605603
}
606604

607605
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");
609607
return -1;
610608
}
611609

612610
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");
614612
return -1;
615613
}
616614

@@ -621,7 +619,7 @@ static int alps_hw_init(struct psmouse *psmouse)
621619

622620
/* ALPS needs stream mode, otherwise it won't report any data */
623621
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");
625623
return -1;
626624
}
627625

‎drivers/input/mouse/elantech.c‎

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
* Trademarks are the property of their respective owners.
1111
*/
1212

13-
#define pr_fmt(fmt) KBUILD_BASENAME ": " fmt
14-
1513
#include <linux/delay.h>
1614
#include <linux/slab.h>
1715
#include <linux/module.h>
@@ -25,7 +23,8 @@
2523
#define elantech_debug(fmt, ...) \
2624
do { \
2725
if (etd->debug) \
28-
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
26+
psmouse_printk(KERN_DEBUG, psmouse, \
27+
fmt, ##__VA_ARGS__); \
2928
} while (0)
3029

3130
/*
@@ -36,7 +35,7 @@ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
3635
{
3736
if (psmouse_sliced_command(psmouse, c) ||
3837
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);
4039
return -1;
4140
}
4241

@@ -65,7 +64,7 @@ static int elantech_ps2_command(struct psmouse *psmouse,
6564
} while (tries > 0);
6665

6766
if (rc)
68-
pr_err("ps2 command 0x%02x failed.\n", command);
67+
psmouse_err(psmouse, "ps2 command 0x%02x failed.\n", command);
6968

7069
return rc;
7170
}
@@ -117,7 +116,7 @@ static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg,
117116
}
118117

119118
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);
121120
else if (etd->hw_version != 4)
122121
*val = param[0];
123122
else
@@ -191,22 +190,23 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
191190
}
192191

193192
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);
196196

197197
return rc;
198198
}
199199

200200
/*
201201
* Dump a complete mouse movement packet to the syslog
202202
*/
203-
static void elantech_packet_dump(unsigned char *packet, int size)
203+
static void elantech_packet_dump(struct psmouse *psmouse)
204204
{
205205
int i;
206206

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]);
210210
printk("]\n");
211211
}
212212

@@ -705,7 +705,7 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
705705
return PSMOUSE_GOOD_DATA;
706706

707707
if (etd->debug > 1)
708-
elantech_packet_dump(psmouse->packet, psmouse->pktsize);
708+
elantech_packet_dump(psmouse);
709709

710710
switch (etd->hw_version) {
711711
case 1:
@@ -801,7 +801,7 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
801801
/*
802802
* Read back reg 0x10. For hardware version 1 we must make
803803
* 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
805805
* we read back the value we just wrote.
806806
*/
807807
do {
@@ -814,17 +814,19 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
814814
} while (tries > 0);
815815

816816
if (rc) {
817-
pr_err("failed to read back register 0x10.\n");
817+
psmouse_err(psmouse,
818+
"failed to read back register 0x10.\n");
818819
} else if (etd->hw_version == 1 &&
819820
!(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");
821823
rc = -1;
822824
}
823825
}
824826

825827
skip_readback_reg_10:
826828
if (rc)
827-
pr_err("failed to initialise registers.\n");
829+
psmouse_err(psmouse, "failed to initialise registers.\n");
828830

829831
return rc;
830832
}
@@ -1131,7 +1133,7 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
11311133
ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
11321134
ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
11331135
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");
11351137
return -1;
11361138
}
11371139

@@ -1141,8 +1143,9 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
11411143
*/
11421144
if (param[0] != 0x3c || param[1] != 0x03 ||
11431145
(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]);
11461149
return -1;
11471150
}
11481151

@@ -1152,15 +1155,17 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
11521155
* to Elantech magic knock and there might be more.
11531156
*/
11541157
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");
11561159
return -1;
11571160
}
11581161

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]);
11611165

11621166
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");
11641169
return -1;
11651170
}
11661171

@@ -1192,7 +1197,8 @@ static int elantech_reconnect(struct psmouse *psmouse)
11921197
return -1;
11931198

11941199
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");
11961202
return -1;
11971203
}
11981204

@@ -1262,42 +1268,46 @@ int elantech_init(struct psmouse *psmouse)
12621268
* Do the version query again so we can store the result
12631269
*/
12641270
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");
12661272
goto init_fail;
12671273
}
12681274
etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
12691275

12701276
if (elantech_set_properties(etd)) {
1271-
pr_err("unknown hardware version, aborting...\n");
1277+
psmouse_err(psmouse, "unknown hardware version, aborting...\n");
12721278
goto init_fail;
12731279
}
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]);
12771283

12781284
if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
12791285
etd->capabilities)) {
1280-
pr_err("failed to query capabilities.\n");
1286+
psmouse_err(psmouse, "failed to query capabilities.\n");
12811287
goto init_fail;
12821288
}
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]);
12861293

12871294
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");
12891297
goto init_fail;
12901298
}
12911299

12921300
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");
12941302
goto init_fail;
12951303
}
12961304

12971305
error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj,
12981306
&elantech_attr_group);
12991307
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);
13011311
goto init_fail;
13021312
}
13031313

0 commit comments

Comments
 (0)