Re: [PATCH 02/12] hdaps: Use thinkpad_ec instead of direct port access

From: Pavel Machek
Date: Mon Aug 07 2006 - 10:11:56 EST


Hi!

Yes, this looks badly needed.

> As you can see from the comments at the beginning of the patch, the old
> driver got some stuff wrong about the meaning of EC readouts. This patch
> preserves the old broken behavior; it will be fixed in a later patch.
>
> Signed-off-by: Shem Multinymous <multinymous@xxxxxxxxx>

Signed-off-by: Pavel Machek <pavel@xxxxxxx>

> @@ -209,77 +131,79 @@ static int hdaps_read_pair(unsigned int
> * hdaps_device_init - initialize the accelerometer. Returns zero on success
> * and negative error code on failure. Can sleep.
> */
> +#define ABORT_INIT(msg) { printk(KERN_ERR "hdaps init: %s\n", msg); goto bad; }

No.. macro with embedded goto is *evil*.

> + if (thinkpad_ec_read_row(&args, &data))
> + ABORT_INIT("read1");
> + if (data.val[0xF]!=0x00)
> + ABORT_INIT("check1");

!=0 in if is evil...

> + mode = data.val[0x1];
> +
> + printk(KERN_DEBUG "hdaps: initial mode latch is 0x%02x\n", mode);
> + if (mode==0x00)

if !mode ?

Pavel

--
Thanks for all the (sleeping) penguins.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/