static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
{
unsigned char param[1];
+ int error;
+
+ error = psmouse_sliced_command(psmouse, mode);
+ if (error)
+ return error;
- if (psmouse_sliced_command(psmouse, mode))
- return -1;
param[0] = SYN_PS_SET_MODE2;
- if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE))
- return -1;
+ error = ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE);
+ if (error)
+ return error;
+
return 0;
}
{
static unsigned char param = 0xc8;
struct synaptics_data *priv = psmouse->private;
+ int error;
if (!(SYN_CAP_ADV_GESTURE(priv->info.ext_cap_0c) ||
SYN_CAP_IMAGE_SENSOR(priv->info.ext_cap_0c)))
return 0;
- if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL))
- return -1;
+ error = psmouse_sliced_command(psmouse, SYN_QUE_MODEL);
+ if (error)
+ return error;
- if (ps2_command(&psmouse->ps2dev, ¶m, PSMOUSE_CMD_SETRATE))
- return -1;
+ error = ps2_command(&psmouse->ps2dev, ¶m, PSMOUSE_CMD_SETRATE);
+ if (error)
+ return error;
/* Advanced gesture mode also sends multi finger data */
priv->info.capabilities |= BIT(1);
static int synaptics_set_mode(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
+ int error;
priv->mode = 0;
if (priv->absolute_mode)
if (SYN_CAP_EXTENDED(priv->info.capabilities))
priv->mode |= SYN_BIT_W_MODE;
- if (synaptics_mode_cmd(psmouse, priv->mode))
- return -1;
+ error = synaptics_mode_cmd(psmouse, priv->mode);
+ if (error)
+ return error;
- if (priv->absolute_mode &&
- synaptics_set_advanced_gesture_mode(psmouse)) {
- psmouse_err(psmouse, "Advanced gesture mode init failed.\n");
- return -1;
+ if (priv->absolute_mode) {
+ error = synaptics_set_advanced_gesture_mode(psmouse);
+ if (error) {
+ psmouse_err(psmouse,
+ "Advanced gesture mode init failed: %d\n",
+ error);
+ return error;
+ }
}
return 0;
static int synaptics_pt_write(struct serio *serio, unsigned char c)
{
struct psmouse *parent = serio_get_drvdata(serio->parent);
- char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */
+ u8 rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */
+ int error;
+
+ error = psmouse_sliced_command(parent, c);
+ if (error)
+ return error;
+
+ error = ps2_command(&parent->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE);
+ if (error)
+ return error;
- if (psmouse_sliced_command(parent, c))
- return -1;
- if (ps2_command(&parent->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE))
- return -1;
return 0;
}
} while (error && ++retry < 3);
if (error)
- return -1;
+ return error;
if (retry > 1)
psmouse_dbg(psmouse, "reconnected after %d tries\n", retry);
- if (synaptics_query_hardware(psmouse, &info)) {
+ error = synaptics_query_hardware(psmouse, &info);
+ if (error) {
psmouse_err(psmouse, "Unable to query device.\n");
- return -1;
+ return error;
}
- if (synaptics_set_mode(psmouse)) {
+ error = synaptics_set_mode(psmouse);
+ if (error) {
psmouse_err(psmouse, "Unable to initialize device.\n");
- return -1;
+ return error;
}
if (info.identity != priv->info.identity ||
priv->info.model_id, info.model_id,
priv->info.capabilities, info.capabilities,
priv->info.ext_cap, info.ext_cap);
- return -1;
+ return -ENXIO;
}
return 0;