Vojtech Pavlik writes: > On Sun, Jul 03, 2005 at 01:49:13PM +0200, Peter Osterlund wrote: > > Dmitry Torokhov writes: > > > > > It looks like logic for enabling hardware tapping in ALPS driver was > > > inverted and we enable it only if it was already enabled by BIOS or > > > firmware. > > > > It looks like alps_init() has the same bug. This patch fixes that > > function too by moving the check if the tapping mode needs to change > > into the alps_tap_mode() function, so that the test doesn't have to be > > duplicated. > > This looks good. However - what's the point in checking whether tapping > is enabled before enabling it? I don't think there is a point. IFAIK this code was added by Dmitry as part of the hardware auto-detection changes. In that version the check prevented a printk line when the touchpad was already in the correct state. That printk is deleted anyway by this patch, so the check can be removed. (Modulo weird hardware behavior, which can't be completely ruled out because the driver is based largely on reverse engineering, since no public docs are available.) Signed-off-by: Peter Osterlund Index: dmitry/drivers/input/mouse/alps.c =================================================================== --- dmitry.orig/drivers/input/mouse/alps.c 2005-07-05 17:28:47.000000000 +0200 +++ dmitry/drivers/input/mouse/alps.c 2005-07-05 19:50:53.000000000 +0200 @@ -2,7 +2,7 @@ * ALPS touchpad PS/2 mouse driver * * Copyright (c) 2003 Neil Brown - * Copyright (c) 2003 Peter Osterlund + * Copyright (c) 2003-2005 Peter Osterlund * Copyright (c) 2004 Dmitry Torokhov * Copyright (c) 2005 Vojtech Pavlik * @@ -350,7 +350,6 @@ static int alps_reconnect(struct psmouse *psmouse) { struct alps_data *priv = psmouse->private; - unsigned char param[4]; int version; psmouse_reset(psmouse); @@ -361,14 +360,13 @@ if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) return -1; - if (alps_get_status(psmouse, param)) + if (alps_tap_mode(psmouse, 1)) { + printk(KERN_WARNING "alps.c: Failed to reenable hardware tapping\n"); return -1; - - if (!(param[0] & 0x04)) - alps_tap_mode(psmouse, 1); + } if (alps_absolute_mode(psmouse)) { - printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); + printk(KERN_ERR "alps.c: Failed to reenable absolute mode\n"); return -1; } @@ -389,7 +387,6 @@ int alps_init(struct psmouse *psmouse) { struct alps_data *priv; - unsigned char param[4]; int version; psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); @@ -403,16 +400,8 @@ if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) goto init_fail; - if (alps_get_status(psmouse, param)) { - printk(KERN_ERR "alps.c: touchpad status report request failed\n"); - goto init_fail; - } - - if (param[0] & 0x04) { - printk(KERN_INFO "alps.c: Enabling hardware tapping\n"); - if (alps_tap_mode(psmouse, 1)) - printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); - } + if (alps_tap_mode(psmouse, 1)) + printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); if (alps_absolute_mode(psmouse)) { printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");