/* alps_poll() - poll the touchpad for current motion packet. Used in resync.  */
static int alps_poll(struct psmouse *psmouse)
/* alps_poll() - poll the touchpad for current motion packet. Used in resync.  */
static int alps_poll(struct psmouse *psmouse)
{
	struct alps_data *priv = psmouse->private;
	unsigned char buf[6];
	bool poll_failed;
	if (priv->i->flags & ALPS_PASS)
		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, false);
	if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0)
		return -1;
	if ((psmouse->badbyte & 0xc8) == 0x08) {
		if (ps2_command(&psmouse->ps2dev, buf, PSMOUSE_CMD_POLL | (3 << 8)))
			return -1;
	}
	memcpy(psmouse->packet, buf, sizeof(buf));
	return 0;
}