Input: psmouse - use boolean type

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Dmitry Torokhov 2009-09-09 19:13:20 -07:00
parent f81134163f
commit b7802c5c1e
20 changed files with 133 additions and 125 deletions

View File

@ -279,7 +279,7 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
* subsequent commands. It looks like glidepad is behind stickpointer, * subsequent commands. It looks like glidepad is behind stickpointer,
* I'd thought it would be other way around... * I'd thought it would be other way around...
*/ */
static int alps_passthrough_mode(struct psmouse *psmouse, int enable) static int alps_passthrough_mode(struct psmouse *psmouse, bool enable)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
int cmd = enable ? PSMOUSE_CMD_SETSCALE21 : PSMOUSE_CMD_SETSCALE11; int cmd = enable ? PSMOUSE_CMD_SETSCALE21 : PSMOUSE_CMD_SETSCALE11;
@ -367,16 +367,16 @@ static int alps_poll(struct psmouse *psmouse)
{ {
struct alps_data *priv = psmouse->private; struct alps_data *priv = psmouse->private;
unsigned char buf[6]; unsigned char buf[6];
int poll_failed; bool poll_failed;
if (priv->i->flags & ALPS_PASS) if (priv->i->flags & ALPS_PASS)
alps_passthrough_mode(psmouse, 1); alps_passthrough_mode(psmouse, true);
poll_failed = ps2_command(&psmouse->ps2dev, buf, poll_failed = ps2_command(&psmouse->ps2dev, buf,
PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0; PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0;
if (priv->i->flags & ALPS_PASS) if (priv->i->flags & ALPS_PASS)
alps_passthrough_mode(psmouse, 0); alps_passthrough_mode(psmouse, false);
if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0) if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0)
return -1; return -1;
@ -401,10 +401,12 @@ static int alps_hw_init(struct psmouse *psmouse, int *version)
if (!priv->i) if (!priv->i)
return -1; return -1;
if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) if ((priv->i->flags & ALPS_PASS) &&
alps_passthrough_mode(psmouse, true)) {
return -1; return -1;
}
if (alps_tap_mode(psmouse, 1)) { if (alps_tap_mode(psmouse, true)) {
printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
return -1; return -1;
} }
@ -414,8 +416,10 @@ static int alps_hw_init(struct psmouse *psmouse, int *version)
return -1; return -1;
} }
if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0)) if ((priv->i->flags & ALPS_PASS) &&
alps_passthrough_mode(psmouse, false)) {
return -1; return -1;
}
/* ALPS needs stream mode, otherwise it won't report any data */ /* ALPS needs stream mode, otherwise it won't report any data */
if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) { if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM)) {
@ -519,7 +523,7 @@ init_fail:
return -1; return -1;
} }
int alps_detect(struct psmouse *psmouse, int set_properties) int alps_detect(struct psmouse *psmouse, bool set_properties)
{ {
int version; int version;
const struct alps_model_info *model; const struct alps_model_info *model;

View File

@ -26,10 +26,10 @@ struct alps_data {
}; };
#ifdef CONFIG_MOUSE_PS2_ALPS #ifdef CONFIG_MOUSE_PS2_ALPS
int alps_detect(struct psmouse *psmouse, int set_properties); int alps_detect(struct psmouse *psmouse, bool set_properties);
int alps_init(struct psmouse *psmouse); int alps_init(struct psmouse *psmouse);
#else #else
inline int alps_detect(struct psmouse *psmouse, int set_properties) inline int alps_detect(struct psmouse *psmouse, bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }

View File

@ -553,7 +553,7 @@ static struct attribute_group elantech_attr_group = {
/* /*
* Use magic knock to detect Elantech touchpad * Use magic knock to detect Elantech touchpad
*/ */
int elantech_detect(struct psmouse *psmouse, int set_properties) int elantech_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[3]; unsigned char param[3];

View File

@ -109,10 +109,10 @@ struct elantech_data {
}; };
#ifdef CONFIG_MOUSE_PS2_ELANTECH #ifdef CONFIG_MOUSE_PS2_ELANTECH
int elantech_detect(struct psmouse *psmouse, int set_properties); int elantech_detect(struct psmouse *psmouse, bool set_properties);
int elantech_init(struct psmouse *psmouse); int elantech_init(struct psmouse *psmouse);
#else #else
static inline int elantech_detect(struct psmouse *psmouse, int set_properties) static inline int elantech_detect(struct psmouse *psmouse, bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }

View File

@ -367,7 +367,7 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data,
} }
__PSMOUSE_DEFINE_ATTR(powered, S_IWUSR | S_IRUGO, NULL, __PSMOUSE_DEFINE_ATTR(powered, S_IWUSR | S_IRUGO, NULL,
hgpk_show_powered, hgpk_set_powered, 0); hgpk_show_powered, hgpk_set_powered, false);
static ssize_t hgpk_trigger_recal_show(struct psmouse *psmouse, static ssize_t hgpk_trigger_recal_show(struct psmouse *psmouse,
void *data, char *buf) void *data, char *buf)
@ -396,7 +396,7 @@ static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data,
} }
__PSMOUSE_DEFINE_ATTR(recalibrate, S_IWUSR | S_IRUGO, NULL, __PSMOUSE_DEFINE_ATTR(recalibrate, S_IWUSR | S_IRUGO, NULL,
hgpk_trigger_recal_show, hgpk_trigger_recal, 0); hgpk_trigger_recal_show, hgpk_trigger_recal, false);
static void hgpk_disconnect(struct psmouse *psmouse) static void hgpk_disconnect(struct psmouse *psmouse)
{ {
@ -489,7 +489,7 @@ int hgpk_init(struct psmouse *psmouse)
psmouse->private = priv; psmouse->private = priv;
priv->psmouse = psmouse; priv->psmouse = psmouse;
priv->powered = 1; priv->powered = true;
INIT_DELAYED_WORK(&priv->recalib_wq, hgpk_recalib_work); INIT_DELAYED_WORK(&priv->recalib_wq, hgpk_recalib_work);
err = psmouse_reset(psmouse); err = psmouse_reset(psmouse);
@ -532,7 +532,7 @@ static enum hgpk_model_t hgpk_get_model(struct psmouse *psmouse)
return param[2]; return param[2];
} }
int hgpk_detect(struct psmouse *psmouse, int set_properties) int hgpk_detect(struct psmouse *psmouse, bool set_properties)
{ {
int version; int version;

View File

@ -15,7 +15,7 @@ enum hgpk_model_t {
struct hgpk_data { struct hgpk_data {
struct psmouse *psmouse; struct psmouse *psmouse;
int powered; bool powered;
int count, x_tally, y_tally; /* hardware workaround stuff */ int count, x_tally, y_tally; /* hardware workaround stuff */
unsigned long recalib_window; unsigned long recalib_window;
struct delayed_work recalib_wq; struct delayed_work recalib_wq;
@ -33,10 +33,10 @@ struct hgpk_data {
dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg) dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg)
#ifdef CONFIG_MOUSE_PS2_OLPC #ifdef CONFIG_MOUSE_PS2_OLPC
int hgpk_detect(struct psmouse *psmouse, int set_properties); int hgpk_detect(struct psmouse *psmouse, bool set_properties);
int hgpk_init(struct psmouse *psmouse); int hgpk_init(struct psmouse *psmouse);
#else #else
static inline int hgpk_detect(struct psmouse *psmouse, int set_properties) static inline int hgpk_detect(struct psmouse *psmouse, bool set_properties)
{ {
return -ENODEV; return -ENODEV;
} }

View File

@ -33,11 +33,11 @@ static int lifebook_set_serio_phys(const struct dmi_system_id *d)
return 0; return 0;
} }
static unsigned char lifebook_use_6byte_proto; static bool lifebook_use_6byte_proto;
static int lifebook_set_6byte_proto(const struct dmi_system_id *d) static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
{ {
lifebook_use_6byte_proto = 1; lifebook_use_6byte_proto = true;
return 0; return 0;
} }
@ -125,7 +125,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
struct input_dev *dev1 = psmouse->dev; struct input_dev *dev1 = psmouse->dev;
struct input_dev *dev2 = priv ? priv->dev2 : NULL; struct input_dev *dev2 = priv ? priv->dev2 : NULL;
unsigned char *packet = psmouse->packet; unsigned char *packet = psmouse->packet;
int relative_packet = packet[0] & 0x08; bool relative_packet = packet[0] & 0x08;
if (relative_packet || !lifebook_use_6byte_proto) { if (relative_packet || !lifebook_use_6byte_proto) {
if (psmouse->pktcnt != 3) if (psmouse->pktcnt != 3)
@ -242,7 +242,7 @@ static void lifebook_disconnect(struct psmouse *psmouse)
psmouse->private = NULL; psmouse->private = NULL;
} }
int lifebook_detect(struct psmouse *psmouse, int set_properties) int lifebook_detect(struct psmouse *psmouse, bool set_properties)
{ {
if (!dmi_check_system(lifebook_dmi_table)) if (!dmi_check_system(lifebook_dmi_table))
return -1; return -1;

View File

@ -12,10 +12,10 @@
#define _LIFEBOOK_H #define _LIFEBOOK_H
#ifdef CONFIG_MOUSE_PS2_LIFEBOOK #ifdef CONFIG_MOUSE_PS2_LIFEBOOK
int lifebook_detect(struct psmouse *psmouse, int set_properties); int lifebook_detect(struct psmouse *psmouse, bool set_properties);
int lifebook_init(struct psmouse *psmouse); int lifebook_init(struct psmouse *psmouse);
#else #else
inline int lifebook_detect(struct psmouse *psmouse, int set_properties) inline int lifebook_detect(struct psmouse *psmouse, bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }

View File

@ -130,14 +130,11 @@ static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned cha
* 0 - disabled * 0 - disabled
*/ */
static void ps2pp_set_smartscroll(struct psmouse *psmouse, unsigned int smartscroll) static void ps2pp_set_smartscroll(struct psmouse *psmouse, bool smartscroll)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4]; unsigned char param[4];
if (smartscroll > 1)
smartscroll = 1;
ps2pp_cmd(psmouse, param, 0x32); ps2pp_cmd(psmouse, param, 0x32);
param[0] = 0; param[0] = 0;
@ -149,12 +146,14 @@ static void ps2pp_set_smartscroll(struct psmouse *psmouse, unsigned int smartscr
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
} }
static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, void *data, char *buf) static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse,
void *data, char *buf)
{ {
return sprintf(buf, "%d\n", psmouse->smartscroll ? 1 : 0); return sprintf(buf, "%d\n", psmouse->smartscroll);
} }
static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, const char *buf, size_t count) static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data,
const char *buf, size_t count)
{ {
unsigned long value; unsigned long value;
@ -261,29 +260,29 @@ static const struct ps2pp_info *get_model_info(unsigned char model)
static void ps2pp_set_model_properties(struct psmouse *psmouse, static void ps2pp_set_model_properties(struct psmouse *psmouse,
const struct ps2pp_info *model_info, const struct ps2pp_info *model_info,
int using_ps2pp) bool using_ps2pp)
{ {
struct input_dev *input_dev = psmouse->dev; struct input_dev *input_dev = psmouse->dev;
if (model_info->features & PS2PP_SIDE_BTN) if (model_info->features & PS2PP_SIDE_BTN)
set_bit(BTN_SIDE, input_dev->keybit); __set_bit(BTN_SIDE, input_dev->keybit);
if (model_info->features & PS2PP_EXTRA_BTN) if (model_info->features & PS2PP_EXTRA_BTN)
set_bit(BTN_EXTRA, input_dev->keybit); __set_bit(BTN_EXTRA, input_dev->keybit);
if (model_info->features & PS2PP_TASK_BTN) if (model_info->features & PS2PP_TASK_BTN)
set_bit(BTN_TASK, input_dev->keybit); __set_bit(BTN_TASK, input_dev->keybit);
if (model_info->features & PS2PP_NAV_BTN) { if (model_info->features & PS2PP_NAV_BTN) {
set_bit(BTN_FORWARD, input_dev->keybit); __set_bit(BTN_FORWARD, input_dev->keybit);
set_bit(BTN_BACK, input_dev->keybit); __set_bit(BTN_BACK, input_dev->keybit);
} }
if (model_info->features & PS2PP_WHEEL) if (model_info->features & PS2PP_WHEEL)
set_bit(REL_WHEEL, input_dev->relbit); __set_bit(REL_WHEEL, input_dev->relbit);
if (model_info->features & PS2PP_HWHEEL) if (model_info->features & PS2PP_HWHEEL)
set_bit(REL_HWHEEL, input_dev->relbit); __set_bit(REL_HWHEEL, input_dev->relbit);
switch (model_info->kind) { switch (model_info->kind) {
case PS2PP_KIND_WHEEL: case PS2PP_KIND_WHEEL:
@ -321,13 +320,13 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
* that support it. * that support it.
*/ */
int ps2pp_init(struct psmouse *psmouse, int set_properties) int ps2pp_init(struct psmouse *psmouse, bool set_properties)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4]; unsigned char param[4];
unsigned char model, buttons; unsigned char model, buttons;
const struct ps2pp_info *model_info; const struct ps2pp_info *model_info;
int use_ps2pp = 0; bool use_ps2pp = false;
int error; int error;
param[0] = 0; param[0] = 0;
@ -364,7 +363,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
param[0] = 0; param[0] = 0;
if (!ps2_command(ps2dev, param, 0x13d1) && if (!ps2_command(ps2dev, param, 0x13d1) &&
param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) { param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) {
use_ps2pp = 1; use_ps2pp = true;
} }
} else { } else {
@ -376,8 +375,8 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
if ((param[0] & 0x78) == 0x48 && if ((param[0] & 0x78) == 0x48 &&
(param[1] & 0xf3) == 0xc2 && (param[1] & 0xf3) == 0xc2 &&
(param[2] & 0x03) == ((param[1] >> 2) & 3)) { (param[2] & 0x03) == ((param[1] >> 2) & 3)) {
ps2pp_set_smartscroll(psmouse, psmouse->smartscroll); ps2pp_set_smartscroll(psmouse, false);
use_ps2pp = 1; use_ps2pp = true;
} }
} }
} }
@ -406,7 +405,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
} }
if (buttons < 3) if (buttons < 3)
clear_bit(BTN_MIDDLE, psmouse->dev->keybit); __clear_bit(BTN_MIDDLE, psmouse->dev->keybit);
if (model_info) if (model_info)
ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); ps2pp_set_model_properties(psmouse, model_info, use_ps2pp);

View File

@ -12,9 +12,9 @@
#define _LOGIPS2PP_H #define _LOGIPS2PP_H
#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
int ps2pp_init(struct psmouse *psmouse, int set_properties); int ps2pp_init(struct psmouse *psmouse, bool set_properties);
#else #else
inline int ps2pp_init(struct psmouse *psmouse, int set_properties) inline int ps2pp_init(struct psmouse *psmouse, bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }

View File

@ -109,10 +109,10 @@ static struct workqueue_struct *kpsmoused_wq;
struct psmouse_protocol { struct psmouse_protocol {
enum psmouse_type type; enum psmouse_type type;
bool maxproto;
const char *name; const char *name;
const char *alias; const char *alias;
int maxproto; int (*detect)(struct psmouse *, bool);
int (*detect)(struct psmouse *, int);
int (*init)(struct psmouse *); int (*init)(struct psmouse *);
}; };
@ -217,7 +217,7 @@ void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work,
static inline void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state) static inline void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
{ {
psmouse->state = new_state; psmouse->state = new_state;
psmouse->pktcnt = psmouse->out_of_sync = 0; psmouse->pktcnt = psmouse->out_of_sync_cnt = 0;
psmouse->ps2dev.flags = 0; psmouse->ps2dev.flags = 0;
psmouse->last = jiffies; psmouse->last = jiffies;
} }
@ -250,7 +250,7 @@ static int psmouse_handle_byte(struct psmouse *psmouse)
if (psmouse->state == PSMOUSE_ACTIVATED) { if (psmouse->state == PSMOUSE_ACTIVATED) {
printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n", printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n",
psmouse->name, psmouse->phys, psmouse->pktcnt); psmouse->name, psmouse->phys, psmouse->pktcnt);
if (++psmouse->out_of_sync == psmouse->resetafter) { if (++psmouse->out_of_sync_cnt == psmouse->resetafter) {
__psmouse_set_state(psmouse, PSMOUSE_IGNORE); __psmouse_set_state(psmouse, PSMOUSE_IGNORE);
printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n"); printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n");
serio_reconnect(psmouse->ps2dev.serio); serio_reconnect(psmouse->ps2dev.serio);
@ -262,8 +262,8 @@ static int psmouse_handle_byte(struct psmouse *psmouse)
case PSMOUSE_FULL_PACKET: case PSMOUSE_FULL_PACKET:
psmouse->pktcnt = 0; psmouse->pktcnt = 0;
if (psmouse->out_of_sync) { if (psmouse->out_of_sync_cnt) {
psmouse->out_of_sync = 0; psmouse->out_of_sync_cnt = 0;
printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n", printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n",
psmouse->name, psmouse->phys); psmouse->name, psmouse->phys);
} }
@ -409,7 +409,7 @@ int psmouse_reset(struct psmouse *psmouse)
/* /*
* Genius NetMouse magic init. * Genius NetMouse magic init.
*/ */
static int genius_detect(struct psmouse *psmouse, int set_properties) static int genius_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4]; unsigned char param[4];
@ -425,9 +425,9 @@ static int genius_detect(struct psmouse *psmouse, int set_properties)
return -1; return -1;
if (set_properties) { if (set_properties) {
set_bit(BTN_EXTRA, psmouse->dev->keybit); __set_bit(BTN_EXTRA, psmouse->dev->keybit);
set_bit(BTN_SIDE, psmouse->dev->keybit); __set_bit(BTN_SIDE, psmouse->dev->keybit);
set_bit(REL_WHEEL, psmouse->dev->relbit); __set_bit(REL_WHEEL, psmouse->dev->relbit);
psmouse->vendor = "Genius"; psmouse->vendor = "Genius";
psmouse->name = "Mouse"; psmouse->name = "Mouse";
@ -440,7 +440,7 @@ static int genius_detect(struct psmouse *psmouse, int set_properties)
/* /*
* IntelliMouse magic init. * IntelliMouse magic init.
*/ */
static int intellimouse_detect(struct psmouse *psmouse, int set_properties) static int intellimouse_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[2]; unsigned char param[2];
@ -457,8 +457,8 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties)
return -1; return -1;
if (set_properties) { if (set_properties) {
set_bit(BTN_MIDDLE, psmouse->dev->keybit); __set_bit(BTN_MIDDLE, psmouse->dev->keybit);
set_bit(REL_WHEEL, psmouse->dev->relbit); __set_bit(REL_WHEEL, psmouse->dev->relbit);
if (!psmouse->vendor) psmouse->vendor = "Generic"; if (!psmouse->vendor) psmouse->vendor = "Generic";
if (!psmouse->name) psmouse->name = "Wheel Mouse"; if (!psmouse->name) psmouse->name = "Wheel Mouse";
@ -471,7 +471,7 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties)
/* /*
* Try IntelliMouse/Explorer magic init. * Try IntelliMouse/Explorer magic init.
*/ */
static int im_explorer_detect(struct psmouse *psmouse, int set_properties) static int im_explorer_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[2]; unsigned char param[2];
@ -498,11 +498,11 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties)
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE); ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
if (set_properties) { if (set_properties) {
set_bit(BTN_MIDDLE, psmouse->dev->keybit); __set_bit(BTN_MIDDLE, psmouse->dev->keybit);
set_bit(REL_WHEEL, psmouse->dev->relbit); __set_bit(REL_WHEEL, psmouse->dev->relbit);
set_bit(REL_HWHEEL, psmouse->dev->relbit); __set_bit(REL_HWHEEL, psmouse->dev->relbit);
set_bit(BTN_SIDE, psmouse->dev->keybit); __set_bit(BTN_SIDE, psmouse->dev->keybit);
set_bit(BTN_EXTRA, psmouse->dev->keybit); __set_bit(BTN_EXTRA, psmouse->dev->keybit);
if (!psmouse->vendor) psmouse->vendor = "Generic"; if (!psmouse->vendor) psmouse->vendor = "Generic";
if (!psmouse->name) psmouse->name = "Explorer Mouse"; if (!psmouse->name) psmouse->name = "Explorer Mouse";
@ -515,7 +515,7 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties)
/* /*
* Kensington ThinkingMouse / ExpertMouse magic init. * Kensington ThinkingMouse / ExpertMouse magic init.
*/ */
static int thinking_detect(struct psmouse *psmouse, int set_properties) static int thinking_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[2]; unsigned char param[2];
@ -536,7 +536,7 @@ static int thinking_detect(struct psmouse *psmouse, int set_properties)
return -1; return -1;
if (set_properties) { if (set_properties) {
set_bit(BTN_EXTRA, psmouse->dev->keybit); __set_bit(BTN_EXTRA, psmouse->dev->keybit);
psmouse->vendor = "Kensington"; psmouse->vendor = "Kensington";
psmouse->name = "ThinkingMouse"; psmouse->name = "ThinkingMouse";
@ -548,7 +548,7 @@ static int thinking_detect(struct psmouse *psmouse, int set_properties)
/* /*
* Bare PS/2 protocol "detection". Always succeeds. * Bare PS/2 protocol "detection". Always succeeds.
*/ */
static int ps2bare_detect(struct psmouse *psmouse, int set_properties) static int ps2bare_detect(struct psmouse *psmouse, bool set_properties)
{ {
if (set_properties) { if (set_properties) {
if (!psmouse->vendor) psmouse->vendor = "Generic"; if (!psmouse->vendor) psmouse->vendor = "Generic";
@ -562,12 +562,12 @@ static int ps2bare_detect(struct psmouse *psmouse, int set_properties)
* Cortron PS/2 protocol detection. There's no special way to detect it, so it * Cortron PS/2 protocol detection. There's no special way to detect it, so it
* must be forced by sysfs protocol writing. * must be forced by sysfs protocol writing.
*/ */
static int cortron_detect(struct psmouse *psmouse, int set_properties) static int cortron_detect(struct psmouse *psmouse, bool set_properties)
{ {
if (set_properties) { if (set_properties) {
psmouse->vendor = "Cortron"; psmouse->vendor = "Cortron";
psmouse->name = "PS/2 Trackball"; psmouse->name = "PS/2 Trackball";
set_bit(BTN_SIDE, psmouse->dev->keybit); __set_bit(BTN_SIDE, psmouse->dev->keybit);
} }
return 0; return 0;
@ -579,9 +579,9 @@ static int cortron_detect(struct psmouse *psmouse, int set_properties)
*/ */
static int psmouse_extensions(struct psmouse *psmouse, static int psmouse_extensions(struct psmouse *psmouse,
unsigned int max_proto, int set_properties) unsigned int max_proto, bool set_properties)
{ {
int synaptics_hardware = 0; bool synaptics_hardware = true;
/* /*
* We always check for lifebook because it does not disturb mouse * We always check for lifebook because it does not disturb mouse
@ -608,7 +608,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
* can reset it properly after probing for intellimouse. * can reset it properly after probing for intellimouse.
*/ */
if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) { if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) {
synaptics_hardware = 1; synaptics_hardware = true;
if (max_proto > PSMOUSE_IMEX) { if (max_proto > PSMOUSE_IMEX) {
if (!set_properties || synaptics_init(psmouse) == 0) if (!set_properties || synaptics_init(psmouse) == 0)
@ -733,7 +733,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.type = PSMOUSE_PS2, .type = PSMOUSE_PS2,
.name = "PS/2", .name = "PS/2",
.alias = "bare", .alias = "bare",
.maxproto = 1, .maxproto = true,
.detect = ps2bare_detect, .detect = ps2bare_detect,
}, },
#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP #ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
@ -760,14 +760,14 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.type = PSMOUSE_IMPS, .type = PSMOUSE_IMPS,
.name = "ImPS/2", .name = "ImPS/2",
.alias = "imps", .alias = "imps",
.maxproto = 1, .maxproto = true,
.detect = intellimouse_detect, .detect = intellimouse_detect,
}, },
{ {
.type = PSMOUSE_IMEX, .type = PSMOUSE_IMEX,
.name = "ImExPS/2", .name = "ImExPS/2",
.alias = "exps", .alias = "exps",
.maxproto = 1, .maxproto = true,
.detect = im_explorer_detect, .detect = im_explorer_detect,
}, },
#ifdef CONFIG_MOUSE_PS2_SYNAPTICS #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
@ -848,7 +848,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.type = PSMOUSE_AUTO, .type = PSMOUSE_AUTO,
.name = "auto", .name = "auto",
.alias = "any", .alias = "any",
.maxproto = 1, .maxproto = true,
}, },
}; };
@ -1014,7 +1014,7 @@ static void psmouse_resync(struct work_struct *work)
container_of(work, struct psmouse, resync_work.work); container_of(work, struct psmouse, resync_work.work);
struct serio *serio = psmouse->ps2dev.serio; struct serio *serio = psmouse->ps2dev.serio;
psmouse_ret_t rc = PSMOUSE_GOOD_DATA; psmouse_ret_t rc = PSMOUSE_GOOD_DATA;
int failed = 0, enabled = 0; bool failed = false, enabled = false;
int i; int i;
mutex_lock(&psmouse_mutex); mutex_lock(&psmouse_mutex);
@ -1041,9 +1041,9 @@ static void psmouse_resync(struct work_struct *work)
if (ps2_sendbyte(&psmouse->ps2dev, PSMOUSE_CMD_DISABLE, 20)) { if (ps2_sendbyte(&psmouse->ps2dev, PSMOUSE_CMD_DISABLE, 20)) {
if (psmouse->num_resyncs < 3 || psmouse->acks_disable_command) if (psmouse->num_resyncs < 3 || psmouse->acks_disable_command)
failed = 1; failed = true;
} else } else
psmouse->acks_disable_command = 1; psmouse->acks_disable_command = true;
/* /*
* Poll the mouse. If it was reset the packet will be shorter than * Poll the mouse. If it was reset the packet will be shorter than
@ -1054,7 +1054,7 @@ static void psmouse_resync(struct work_struct *work)
*/ */
if (!failed) { if (!failed) {
if (psmouse->poll(psmouse)) if (psmouse->poll(psmouse))
failed = 1; failed = true;
else { else {
psmouse_set_state(psmouse, PSMOUSE_CMD_MODE); psmouse_set_state(psmouse, PSMOUSE_CMD_MODE);
for (i = 0; i < psmouse->pktsize; i++) { for (i = 0; i < psmouse->pktsize; i++) {
@ -1064,7 +1064,7 @@ static void psmouse_resync(struct work_struct *work)
break; break;
} }
if (rc != PSMOUSE_FULL_PACKET) if (rc != PSMOUSE_FULL_PACKET)
failed = 1; failed = true;
psmouse_set_state(psmouse, PSMOUSE_RESYNCING); psmouse_set_state(psmouse, PSMOUSE_RESYNCING);
} }
} }
@ -1075,7 +1075,7 @@ static void psmouse_resync(struct work_struct *work)
*/ */
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
if (!ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) { if (!ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE)) {
enabled = 1; enabled = true;
break; break;
} }
msleep(200); msleep(200);
@ -1084,7 +1084,7 @@ static void psmouse_resync(struct work_struct *work)
if (!enabled) { if (!enabled) {
printk(KERN_WARNING "psmouse.c: failed to re-enable mouse on %s\n", printk(KERN_WARNING "psmouse.c: failed to re-enable mouse on %s\n",
psmouse->ps2dev.serio->phys); psmouse->ps2dev.serio->phys);
failed = 1; failed = true;
} }
if (failed) { if (failed) {
@ -1211,7 +1211,8 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse
psmouse->type = proto->type; psmouse->type = proto->type;
} }
else else
psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1); psmouse->type = psmouse_extensions(psmouse,
psmouse_max_proto, true);
/* /*
* If mouse's packet size is 3 there is no point in polling the * If mouse's packet size is 3 there is no point in polling the
@ -1366,8 +1367,10 @@ static int psmouse_reconnect(struct serio *serio)
if (psmouse->reconnect(psmouse)) if (psmouse->reconnect(psmouse))
goto out; goto out;
} else if (psmouse_probe(psmouse) < 0 || } else if (psmouse_probe(psmouse) < 0 ||
psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0)) psmouse->type != psmouse_extensions(psmouse,
psmouse_max_proto, false)) {
goto out; goto out;
}
/* ok, the device type (and capabilities) match the old one, /* ok, the device type (and capabilities) match the old one,
* we can continue using it, complete intialization * we can continue using it, complete intialization
@ -1552,7 +1555,9 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
while (serio->child) { while (serio->child) {
if (++retry > 3) { if (++retry > 3) {
printk(KERN_WARNING "psmouse: failed to destroy child port, protocol change aborted.\n"); printk(KERN_WARNING
"psmouse: failed to destroy child port, "
"protocol change aborted.\n");
input_free_device(new_dev); input_free_device(new_dev);
return -EIO; return -EIO;
} }

View File

@ -47,10 +47,10 @@ struct psmouse {
unsigned char pktcnt; unsigned char pktcnt;
unsigned char pktsize; unsigned char pktsize;
unsigned char type; unsigned char type;
unsigned char acks_disable_command; bool acks_disable_command;
unsigned int model; unsigned int model;
unsigned long last; unsigned long last;
unsigned long out_of_sync; unsigned long out_of_sync_cnt;
unsigned long num_resyncs; unsigned long num_resyncs;
enum psmouse_state state; enum psmouse_state state;
char devname[64]; char devname[64];
@ -60,7 +60,7 @@ struct psmouse {
unsigned int resolution; unsigned int resolution;
unsigned int resetafter; unsigned int resetafter;
unsigned int resync_time; unsigned int resync_time;
unsigned int smartscroll; /* Logitech only */ bool smartscroll; /* Logitech only */
psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse); psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse);
void (*set_rate)(struct psmouse *psmouse, unsigned int rate); void (*set_rate)(struct psmouse *psmouse, unsigned int rate);
@ -108,7 +108,7 @@ struct psmouse_attribute {
ssize_t (*show)(struct psmouse *psmouse, void *data, char *buf); ssize_t (*show)(struct psmouse *psmouse, void *data, char *buf);
ssize_t (*set)(struct psmouse *psmouse, void *data, ssize_t (*set)(struct psmouse *psmouse, void *data,
const char *buf, size_t count); const char *buf, size_t count);
int protect; bool protect;
}; };
#define to_psmouse_attr(a) container_of((a), struct psmouse_attribute, dattr) #define to_psmouse_attr(a) container_of((a), struct psmouse_attribute, dattr)
@ -139,14 +139,14 @@ static struct psmouse_attribute psmouse_attr_##_name = { \
__PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect) __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, _set, _protect)
#define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \ #define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \
__PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, 1) __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, true)
#define PSMOUSE_DEFINE_RO_ATTR(_name, _mode, _data, _show) \ #define PSMOUSE_DEFINE_RO_ATTR(_name, _mode, _data, _show) \
static ssize_t _show(struct psmouse *, void *, char *); \ static ssize_t _show(struct psmouse *, void *, char *); \
__PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, NULL, 1) __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, _show, NULL, true)
#define PSMOUSE_DEFINE_WO_ATTR(_name, _mode, _data, _set) \ #define PSMOUSE_DEFINE_WO_ATTR(_name, _mode, _data, _set) \
static ssize_t _set(struct psmouse *, void *, const char *, size_t); \ static ssize_t _set(struct psmouse *, void *, const char *, size_t); \
__PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, NULL, _set, 1) __PSMOUSE_DEFINE_ATTR_VAR(_name, _mode, _data, NULL, _set, true)
#endif /* _PSMOUSE_H */ #endif /* _PSMOUSE_H */

View File

@ -756,7 +756,7 @@ static int fsp_activate_protocol(struct psmouse *psmouse)
return 0; return 0;
} }
int fsp_detect(struct psmouse *psmouse, int set_properties) int fsp_detect(struct psmouse *psmouse, bool set_properties)
{ {
int id; int id;

View File

@ -80,10 +80,10 @@ struct fsp_data {
}; };
#ifdef CONFIG_MOUSE_PS2_SENTELIC #ifdef CONFIG_MOUSE_PS2_SENTELIC
extern int fsp_detect(struct psmouse *psmouse, int set_properties); extern int fsp_detect(struct psmouse *psmouse, bool set_properties);
extern int fsp_init(struct psmouse *psmouse); extern int fsp_init(struct psmouse *psmouse);
#else #else
inline int fsp_detect(struct psmouse *psmouse, int set_properties) inline int fsp_detect(struct psmouse *psmouse, bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }

View File

@ -60,7 +60,7 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
return 0; return 0;
} }
int synaptics_detect(struct psmouse *psmouse, int set_properties) int synaptics_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4]; unsigned char param[4];
@ -556,38 +556,38 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
{ {
int i; int i;
set_bit(EV_ABS, dev->evbit); __set_bit(EV_ABS, dev->evbit);
input_set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); input_set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0);
input_set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); input_set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0);
input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
set_bit(ABS_TOOL_WIDTH, dev->absbit); __set_bit(ABS_TOOL_WIDTH, dev->absbit);
set_bit(EV_KEY, dev->evbit); __set_bit(EV_KEY, dev->evbit);
set_bit(BTN_TOUCH, dev->keybit); __set_bit(BTN_TOUCH, dev->keybit);
set_bit(BTN_TOOL_FINGER, dev->keybit); __set_bit(BTN_TOOL_FINGER, dev->keybit);
set_bit(BTN_LEFT, dev->keybit); __set_bit(BTN_LEFT, dev->keybit);
set_bit(BTN_RIGHT, dev->keybit); __set_bit(BTN_RIGHT, dev->keybit);
if (SYN_CAP_MULTIFINGER(priv->capabilities)) { if (SYN_CAP_MULTIFINGER(priv->capabilities)) {
set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
} }
if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
set_bit(BTN_MIDDLE, dev->keybit); __set_bit(BTN_MIDDLE, dev->keybit);
if (SYN_CAP_FOUR_BUTTON(priv->capabilities) || if (SYN_CAP_FOUR_BUTTON(priv->capabilities) ||
SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) {
set_bit(BTN_FORWARD, dev->keybit); __set_bit(BTN_FORWARD, dev->keybit);
set_bit(BTN_BACK, dev->keybit); __set_bit(BTN_BACK, dev->keybit);
} }
for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
set_bit(BTN_0 + i, dev->keybit); __set_bit(BTN_0 + i, dev->keybit);
clear_bit(EV_REL, dev->evbit); __clear_bit(EV_REL, dev->evbit);
clear_bit(REL_X, dev->relbit); __clear_bit(REL_X, dev->relbit);
clear_bit(REL_Y, dev->relbit); __clear_bit(REL_Y, dev->relbit);
dev->absres[ABS_X] = priv->x_res; dev->absres[ABS_X] = priv->x_res;
dev->absres[ABS_Y] = priv->y_res; dev->absres[ABS_Y] = priv->y_res;

View File

@ -105,7 +105,7 @@ struct synaptics_data {
int scroll; int scroll;
}; };
int synaptics_detect(struct psmouse *psmouse, int set_properties); int synaptics_detect(struct psmouse *psmouse, bool set_properties);
int synaptics_init(struct psmouse *psmouse); int synaptics_init(struct psmouse *psmouse);
void synaptics_reset(struct psmouse *psmouse); void synaptics_reset(struct psmouse *psmouse);

View File

@ -67,7 +67,7 @@ static psmouse_ret_t touchkit_ps2_process_byte(struct psmouse *psmouse)
return PSMOUSE_FULL_PACKET; return PSMOUSE_FULL_PACKET;
} }
int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties) int touchkit_ps2_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct input_dev *dev = psmouse->dev; struct input_dev *dev = psmouse->dev;
unsigned char param[3]; unsigned char param[3];
@ -86,7 +86,7 @@ int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties)
if (set_properties) { if (set_properties) {
dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
set_bit(BTN_TOUCH, dev->keybit); __set_bit(BTN_TOUCH, dev->keybit);
input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0);
input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0);

View File

@ -13,10 +13,10 @@
#define _TOUCHKIT_PS2_H #define _TOUCHKIT_PS2_H
#ifdef CONFIG_MOUSE_PS2_TOUCHKIT #ifdef CONFIG_MOUSE_PS2_TOUCHKIT
int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties); int touchkit_ps2_detect(struct psmouse *psmouse, bool set_properties);
#else #else
static inline int touchkit_ps2_detect(struct psmouse *psmouse, static inline int touchkit_ps2_detect(struct psmouse *psmouse,
int set_properties) bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }

View File

@ -282,7 +282,7 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
return 0; return 0;
} }
int trackpoint_detect(struct psmouse *psmouse, int set_properties) int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
{ {
struct trackpoint_data *priv; struct trackpoint_data *priv;
struct ps2dev *ps2dev = &psmouse->ps2dev; struct ps2dev *ps2dev = &psmouse->ps2dev;

View File

@ -143,9 +143,9 @@ struct trackpoint_data
}; };
#ifdef CONFIG_MOUSE_PS2_TRACKPOINT #ifdef CONFIG_MOUSE_PS2_TRACKPOINT
int trackpoint_detect(struct psmouse *psmouse, int set_properties); int trackpoint_detect(struct psmouse *psmouse, bool set_properties);
#else #else
inline int trackpoint_detect(struct psmouse *psmouse, int set_properties) inline int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
{ {
return -ENOSYS; return -ENOSYS;
} }