Skip to content

Commit

Permalink
Input: psmouse - use boolean type
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Dmitry Torokhov committed Sep 11, 2009
1 parent f811341 commit b7802c5
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 125 deletions.
20 changes: 12 additions & 8 deletions drivers/input/mouse/alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
* 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;
int cmd = enable ? PSMOUSE_CMD_SETSCALE21 : PSMOUSE_CMD_SETSCALE11;
Expand Down Expand Up @@ -367,16 +367,16 @@ static int alps_poll(struct psmouse *psmouse)
{
struct alps_data *priv = psmouse->private;
unsigned char buf[6];
int poll_failed;
bool poll_failed;

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

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

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)
return -1;
Expand All @@ -401,10 +401,12 @@ static int alps_hw_init(struct psmouse *psmouse, int *version)
if (!priv->i)
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;
}

if (alps_tap_mode(psmouse, 1)) {
if (alps_tap_mode(psmouse, true)) {
printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
return -1;
}
Expand All @@ -414,8 +416,10 @@ static int alps_hw_init(struct psmouse *psmouse, int *version)
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;
}

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

int alps_detect(struct psmouse *psmouse, int set_properties)
int alps_detect(struct psmouse *psmouse, bool set_properties)
{
int version;
const struct alps_model_info *model;
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/mouse/alps.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ struct alps_data {
};

#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);
#else
inline int alps_detect(struct psmouse *psmouse, int set_properties)
inline int alps_detect(struct psmouse *psmouse, bool set_properties)
{
return -ENOSYS;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static struct attribute_group elantech_attr_group = {
/*
* 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;
unsigned char param[3];
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/mouse/elantech.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ struct elantech_data {
};

#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);
#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;
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/input/mouse/hgpk.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data,
}

__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,
void *data, char *buf)
Expand Down Expand Up @@ -396,7 +396,7 @@ static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data,
}

__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)
{
Expand Down Expand Up @@ -489,7 +489,7 @@ int hgpk_init(struct psmouse *psmouse)

psmouse->private = priv;
priv->psmouse = psmouse;
priv->powered = 1;
priv->powered = true;
INIT_DELAYED_WORK(&priv->recalib_wq, hgpk_recalib_work);

err = psmouse_reset(psmouse);
Expand Down Expand Up @@ -532,7 +532,7 @@ static enum hgpk_model_t hgpk_get_model(struct psmouse *psmouse)
return param[2];
}

int hgpk_detect(struct psmouse *psmouse, int set_properties)
int hgpk_detect(struct psmouse *psmouse, bool set_properties)
{
int version;

Expand Down
6 changes: 3 additions & 3 deletions drivers/input/mouse/hgpk.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum hgpk_model_t {

struct hgpk_data {
struct psmouse *psmouse;
int powered;
bool powered;
int count, x_tally, y_tally; /* hardware workaround stuff */
unsigned long recalib_window;
struct delayed_work recalib_wq;
Expand All @@ -33,10 +33,10 @@ struct hgpk_data {
dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg)

#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);
#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;
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/input/mouse/lifebook.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ static int lifebook_set_serio_phys(const struct dmi_system_id *d)
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)
{
lifebook_use_6byte_proto = 1;
lifebook_use_6byte_proto = true;
return 0;
}

Expand Down Expand Up @@ -125,7 +125,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
struct input_dev *dev1 = psmouse->dev;
struct input_dev *dev2 = priv ? priv->dev2 : NULL;
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 (psmouse->pktcnt != 3)
Expand Down Expand Up @@ -242,7 +242,7 @@ static void lifebook_disconnect(struct psmouse *psmouse)
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))
return -1;
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/mouse/lifebook.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#define _LIFEBOOK_H

#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);
#else
inline int lifebook_detect(struct psmouse *psmouse, int set_properties)
inline int lifebook_detect(struct psmouse *psmouse, bool set_properties)
{
return -ENOSYS;
}
Expand Down
41 changes: 20 additions & 21 deletions drivers/input/mouse/logips2pp.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,11 @@ static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned cha
* 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;
unsigned char param[4];

if (smartscroll > 1)
smartscroll = 1;

ps2pp_cmd(psmouse, param, 0x32);

param[0] = 0;
Expand All @@ -149,12 +146,14 @@ static void ps2pp_set_smartscroll(struct psmouse *psmouse, unsigned int smartscr
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;

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

static void ps2pp_set_model_properties(struct psmouse *psmouse,
const struct ps2pp_info *model_info,
int using_ps2pp)
bool using_ps2pp)
{
struct input_dev *input_dev = psmouse->dev;

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)
set_bit(BTN_EXTRA, input_dev->keybit);
__set_bit(BTN_EXTRA, input_dev->keybit);

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) {
set_bit(BTN_FORWARD, input_dev->keybit);
set_bit(BTN_BACK, input_dev->keybit);
__set_bit(BTN_FORWARD, input_dev->keybit);
__set_bit(BTN_BACK, input_dev->keybit);
}

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)
set_bit(REL_HWHEEL, input_dev->relbit);
__set_bit(REL_HWHEEL, input_dev->relbit);

switch (model_info->kind) {
case PS2PP_KIND_WHEEL:
Expand Down Expand Up @@ -321,13 +320,13 @@ static void ps2pp_set_model_properties(struct psmouse *psmouse,
* 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;
unsigned char param[4];
unsigned char model, buttons;
const struct ps2pp_info *model_info;
int use_ps2pp = 0;
bool use_ps2pp = false;
int error;

param[0] = 0;
Expand Down Expand Up @@ -364,7 +363,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
param[0] = 0;
if (!ps2_command(ps2dev, param, 0x13d1) &&
param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) {
use_ps2pp = 1;
use_ps2pp = true;
}

} else {
Expand All @@ -376,8 +375,8 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
if ((param[0] & 0x78) == 0x48 &&
(param[1] & 0xf3) == 0xc2 &&
(param[2] & 0x03) == ((param[1] >> 2) & 3)) {
ps2pp_set_smartscroll(psmouse, psmouse->smartscroll);
use_ps2pp = 1;
ps2pp_set_smartscroll(psmouse, false);
use_ps2pp = true;
}
}
}
Expand Down Expand Up @@ -406,7 +405,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
}

if (buttons < 3)
clear_bit(BTN_MIDDLE, psmouse->dev->keybit);
__clear_bit(BTN_MIDDLE, psmouse->dev->keybit);

if (model_info)
ps2pp_set_model_properties(psmouse, model_info, use_ps2pp);
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/mouse/logips2pp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#define _LOGIPS2PP_H

#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
int ps2pp_init(struct psmouse *psmouse, int set_properties);
int ps2pp_init(struct psmouse *psmouse, bool set_properties);
#else
inline int ps2pp_init(struct psmouse *psmouse, int set_properties)
inline int ps2pp_init(struct psmouse *psmouse, bool set_properties)
{
return -ENOSYS;
}
Expand Down
Loading

0 comments on commit b7802c5

Please sign in to comment.