Skip to content

Commit b7802c5

Browse files
committed
Input: psmouse - use boolean type
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent f811341 commit b7802c5

20 files changed

Lines changed: 133 additions & 125 deletions

‎drivers/input/mouse/alps.c‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
279279
* subsequent commands. It looks like glidepad is behind stickpointer,
280280
* I'd thought it would be other way around...
281281
*/
282-
static int alps_passthrough_mode(struct psmouse *psmouse, int enable)
282+
static int alps_passthrough_mode(struct psmouse *psmouse, bool enable)
283283
{
284284
struct ps2dev *ps2dev = &psmouse->ps2dev;
285285
int cmd = enable ? PSMOUSE_CMD_SETSCALE21 : PSMOUSE_CMD_SETSCALE11;
@@ -367,16 +367,16 @@ static int alps_poll(struct psmouse *psmouse)
367367
{
368368
struct alps_data *priv = psmouse->private;
369369
unsigned char buf[6];
370-
int poll_failed;
370+
bool poll_failed;
371371

372372
if (priv->i->flags & ALPS_PASS)
373-
alps_passthrough_mode(psmouse, 1);
373+
alps_passthrough_mode(psmouse, true);
374374

375375
poll_failed = ps2_command(&psmouse->ps2dev, buf,
376376
PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0;
377377

378378
if (priv->i->flags & ALPS_PASS)
379-
alps_passthrough_mode(psmouse, 0);
379+
alps_passthrough_mode(psmouse, false);
380380

381381
if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0)
382382
return -1;
@@ -401,10 +401,12 @@ static int alps_hw_init(struct psmouse *psmouse, int *version)
401401
if (!priv->i)
402402
return -1;
403403

404-
if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
404+
if ((priv->i->flags & ALPS_PASS) &&
405+
alps_passthrough_mode(psmouse, true)) {
405406
return -1;
407+
}
406408

407-
if (alps_tap_mode(psmouse, 1)) {
409+
if (alps_tap_mode(psmouse, true)) {
408410
printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
409411
return -1;
410412
}
@@ -414,8 +416,10 @@ static int alps_hw_init(struct psmouse *psmouse, int *version)
414416
return -1;
415417
}
416418

417-
if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
419+
if ((priv->i->flags & ALPS_PASS) &&
420+
alps_passthrough_mode(psmouse, false)) {
418421
return -1;
422+
}
419423

420424
/* ALPS needs stream mode, otherwise it won't report any data */
421425
if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) {
@@ -519,7 +523,7 @@ int alps_init(struct psmouse *psmouse)
519523
return -1;
520524
}
521525

522-
int alps_detect(struct psmouse *psmouse, int set_properties)
526+
int alps_detect(struct psmouse *psmouse, bool set_properties)
523527
{
524528
int version;
525529
const struct alps_model_info *model;

‎drivers/input/mouse/alps.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ struct alps_data {
2626
};
2727

2828
#ifdef CONFIG_MOUSE_PS2_ALPS
29-
int alps_detect(struct psmouse *psmouse, int set_properties);
29+
int alps_detect(struct psmouse *psmouse, bool set_properties);
3030
int alps_init(struct psmouse *psmouse);
3131
#else
32-
inline int alps_detect(struct psmouse *psmouse, int set_properties)
32+
inline int alps_detect(struct psmouse *psmouse, bool set_properties)
3333
{
3434
return -ENOSYS;
3535
}

‎drivers/input/mouse/elantech.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static struct attribute_group elantech_attr_group = {
553553
/*
554554
* Use magic knock to detect Elantech touchpad
555555
*/
556-
int elantech_detect(struct psmouse *psmouse, int set_properties)
556+
int elantech_detect(struct psmouse *psmouse, bool set_properties)
557557
{
558558
struct ps2dev *ps2dev = &psmouse->ps2dev;
559559
unsigned char param[3];

‎drivers/input/mouse/elantech.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ struct elantech_data {
109109
};
110110

111111
#ifdef CONFIG_MOUSE_PS2_ELANTECH
112-
int elantech_detect(struct psmouse *psmouse, int set_properties);
112+
int elantech_detect(struct psmouse *psmouse, bool set_properties);
113113
int elantech_init(struct psmouse *psmouse);
114114
#else
115-
static inline int elantech_detect(struct psmouse *psmouse, int set_properties)
115+
static inline int elantech_detect(struct psmouse *psmouse, bool set_properties)
116116
{
117117
return -ENOSYS;
118118
}

‎drivers/input/mouse/hgpk.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data,
367367
}
368368

369369
__PSMOUSE_DEFINE_ATTR(powered, S_IWUSR | S_IRUGO, NULL,
370-
hgpk_show_powered, hgpk_set_powered, 0);
370+
hgpk_show_powered, hgpk_set_powered, false);
371371

372372
static ssize_t hgpk_trigger_recal_show(struct psmouse *psmouse,
373373
void *data, char *buf)
@@ -396,7 +396,7 @@ static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data,
396396
}
397397

398398
__PSMOUSE_DEFINE_ATTR(recalibrate, S_IWUSR | S_IRUGO, NULL,
399-
hgpk_trigger_recal_show, hgpk_trigger_recal, 0);
399+
hgpk_trigger_recal_show, hgpk_trigger_recal, false);
400400

401401
static void hgpk_disconnect(struct psmouse *psmouse)
402402
{
@@ -489,7 +489,7 @@ int hgpk_init(struct psmouse *psmouse)
489489

490490
psmouse->private = priv;
491491
priv->psmouse = psmouse;
492-
priv->powered = 1;
492+
priv->powered = true;
493493
INIT_DELAYED_WORK(&priv->recalib_wq, hgpk_recalib_work);
494494

495495
err = psmouse_reset(psmouse);
@@ -532,7 +532,7 @@ static enum hgpk_model_t hgpk_get_model(struct psmouse *psmouse)
532532
return param[2];
533533
}
534534

535-
int hgpk_detect(struct psmouse *psmouse, int set_properties)
535+
int hgpk_detect(struct psmouse *psmouse, bool set_properties)
536536
{
537537
int version;
538538

‎drivers/input/mouse/hgpk.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum hgpk_model_t {
1515

1616
struct hgpk_data {
1717
struct psmouse *psmouse;
18-
int powered;
18+
bool powered;
1919
int count, x_tally, y_tally; /* hardware workaround stuff */
2020
unsigned long recalib_window;
2121
struct delayed_work recalib_wq;
@@ -33,10 +33,10 @@ struct hgpk_data {
3333
dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg)
3434

3535
#ifdef CONFIG_MOUSE_PS2_OLPC
36-
int hgpk_detect(struct psmouse *psmouse, int set_properties);
36+
int hgpk_detect(struct psmouse *psmouse, bool set_properties);
3737
int hgpk_init(struct psmouse *psmouse);
3838
#else
39-
static inline int hgpk_detect(struct psmouse *psmouse, int set_properties)
39+
static inline int hgpk_detect(struct psmouse *psmouse, bool set_properties)
4040
{
4141
return -ENODEV;
4242
}

‎drivers/input/mouse/lifebook.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ static int lifebook_set_serio_phys(const struct dmi_system_id *d)
3333
return 0;
3434
}
3535

36-
static unsigned char lifebook_use_6byte_proto;
36+
static bool lifebook_use_6byte_proto;
3737

3838
static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
3939
{
40-
lifebook_use_6byte_proto = 1;
40+
lifebook_use_6byte_proto = true;
4141
return 0;
4242
}
4343

@@ -125,7 +125,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
125125
struct input_dev *dev1 = psmouse->dev;
126126
struct input_dev *dev2 = priv ? priv->dev2 : NULL;
127127
unsigned char *packet = psmouse->packet;
128-
int relative_packet = packet[0] & 0x08;
128+
bool relative_packet = packet[0] & 0x08;
129129

130130
if (relative_packet || !lifebook_use_6byte_proto) {
131131
if (psmouse->pktcnt != 3)
@@ -242,7 +242,7 @@ static void lifebook_disconnect(struct psmouse *psmouse)
242242
psmouse->private = NULL;
243243
}
244244

245-
int lifebook_detect(struct psmouse *psmouse, int set_properties)
245+
int lifebook_detect(struct psmouse *psmouse, bool set_properties)
246246
{
247247
if (!dmi_check_system(lifebook_dmi_table))
248248
return -1;

‎drivers/input/mouse/lifebook.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
#define _LIFEBOOK_H
1313

1414
#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
15-
int lifebook_detect(struct psmouse *psmouse, int set_properties);
15+
int lifebook_detect(struct psmouse *psmouse, bool set_properties);
1616
int lifebook_init(struct psmouse *psmouse);
1717
#else
18-
inline int lifebook_detect(struct psmouse *psmouse, int set_properties)
18+
inline int lifebook_detect(struct psmouse *psmouse, bool set_properties)
1919
{
2020
return -ENOSYS;
2121
}

‎drivers/input/mouse/logips2pp.c‎

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,11 @@ static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned cha
130130
* 0 - disabled
131131
*/
132132

133-
static void ps2pp_set_smartscroll(struct psmouse *psmouse, unsigned int smartscroll)
133+
static void ps2pp_set_smartscroll(struct psmouse *psmouse, bool smartscroll)
134134
{
135135
struct ps2dev *ps2dev = &psmouse->ps2dev;
136136
unsigned char param[4];
137137

138-
if (smartscroll > 1)
139-
smartscroll = 1;
140-
141138
ps2pp_cmd(psmouse, param, 0x32);
142139

143140
param[0] = 0;
@@ -149,12 +146,14 @@ static void ps2pp_set_smartscroll(struct psmouse *psmouse, unsigned int smartscr
149146
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
150147
}
151148

152-
static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, void *data, char *buf)
149+
static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse,
150+
void *data, char *buf)
153151
{
154-
return sprintf(buf, "%d\n", psmouse->smartscroll ? 1 : 0);
152+
return sprintf(buf, "%d\n", psmouse->smartscroll);
155153
}
156154

157-
static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, const char *buf, size_t count)
155+
static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data,
156+
const char *buf, size_t count)
158157
{
159158
unsigned long value;
160159

@@ -261,29 +260,29 @@ static const struct ps2pp_info *get_model_info(unsigned char model)
261260

262261
static void ps2pp_set_model_properties(struct psmouse *psmouse,
263262
const struct ps2pp_info *model_info,
264-
int using_ps2pp)
263+
bool using_ps2pp)
265264
{
266265
struct input_dev *input_dev = psmouse->dev;
267266

268267
if (model_info->features & PS2PP_SIDE_BTN)
269-
set_bit(BTN_SIDE, input_dev->keybit);
268+
__set_bit(BTN_SIDE, input_dev->keybit);
270269

271270
if (model_info->features & PS2PP_EXTRA_BTN)
272-
set_bit(BTN_EXTRA, input_dev->keybit);
271+
__set_bit(BTN_EXTRA, input_dev->keybit);
273272

274273
if (model_info->features & PS2PP_TASK_BTN)
275-
set_bit(BTN_TASK, input_dev->keybit);
274+
__set_bit(BTN_TASK, input_dev->keybit);
276275

277276
if (model_info->features & PS2PP_NAV_BTN) {
278-
set_bit(BTN_FORWARD, input_dev->keybit);
279-
set_bit(BTN_BACK, input_dev->keybit);
277+
__set_bit(BTN_FORWARD, input_dev->keybit);
278+
__set_bit(BTN_BACK, input_dev->keybit);
280279
}
281280

282281
if (model_info->features & PS2PP_WHEEL)
283-
set_bit(REL_WHEEL, input_dev->relbit);
282+
__set_bit(REL_WHEEL, input_dev->relbit);
284283

285284
if (model_info->features & PS2PP_HWHEEL)
286-
set_bit(REL_HWHEEL, input_dev->relbit);
285+
__set_bit(REL_HWHEEL, input_dev->relbit);
287286

288287
switch (model_info->kind) {
289288
case PS2PP_KIND_WHEEL:
@@ -321,13 +320,13 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
321320
* that support it.
322321
*/
323322

324-
int ps2pp_init(struct psmouse *psmouse, int set_properties)
323+
int ps2pp_init(struct psmouse *psmouse, bool set_properties)
325324
{
326325
struct ps2dev *ps2dev = &psmouse->ps2dev;
327326
unsigned char param[4];
328327
unsigned char model, buttons;
329328
const struct ps2pp_info *model_info;
330-
int use_ps2pp = 0;
329+
bool use_ps2pp = false;
331330
int error;
332331

333332
param[0] = 0;
@@ -364,7 +363,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
364363
param[0] = 0;
365364
if (!ps2_command(ps2dev, param, 0x13d1) &&
366365
param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) {
367-
use_ps2pp = 1;
366+
use_ps2pp = true;
368367
}
369368

370369
} else {
@@ -376,8 +375,8 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
376375
if ((param[0] & 0x78) == 0x48 &&
377376
(param[1] & 0xf3) == 0xc2 &&
378377
(param[2] & 0x03) == ((param[1] >> 2) & 3)) {
379-
ps2pp_set_smartscroll(psmouse, psmouse->smartscroll);
380-
use_ps2pp = 1;
378+
ps2pp_set_smartscroll(psmouse, false);
379+
use_ps2pp = true;
381380
}
382381
}
383382
}
@@ -406,7 +405,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
406405
}
407406

408407
if (buttons < 3)
409-
clear_bit(BTN_MIDDLE, psmouse->dev->keybit);
408+
__clear_bit(BTN_MIDDLE, psmouse->dev->keybit);
410409

411410
if (model_info)
412411
ps2pp_set_model_properties(psmouse, model_info, use_ps2pp);

‎drivers/input/mouse/logips2pp.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#define _LOGIPS2PP_H
1313

1414
#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
15-
int ps2pp_init(struct psmouse *psmouse, int set_properties);
15+
int ps2pp_init(struct psmouse *psmouse, bool set_properties);
1616
#else
17-
inline int ps2pp_init(struct psmouse *psmouse, int set_properties)
17+
inline int ps2pp_init(struct psmouse *psmouse, bool set_properties)
1818
{
1919
return -ENOSYS;
2020
}

0 commit comments

Comments
 (0)