Re: [PATCH] Input: add mmio xi driver

From: Andrew Morton
Date: Thu Oct 02 2008 - 02:14:23 EST


> On Thu, 25 Sep 2008 16:22:37 -0700 Greg KH <gregkh@xxxxxxx> wrote:
>
> From: Greg Kroah-Hartman <gregkh@xxxxxxx>

Is this true?

> This patch adds the Mimio Xi interactive whiteboard driver to the tree.
>
> It was originally written by mwilder@xxxxxxxxxxx, but cleaned up and
> forward ported by me to the latest kernel version.

Oh. Tricky.

>
> ...
>
> +#define isvalidtxsize(n) ((n) > 0 && (n) <= MIMIO_MAXPAYLOAD)

grumble.

- should be written in C

- buggy when passed expresion-with-side-effects.

>
> ...
>
> +static DECLARE_MUTEX(disconnect_sem);

ooh, a semaphore - I remember them.

checkpatch used to warn about newly-added semaphores but a) it broke and
b) this patch doesn't seem to have met checkpatch.

>
> ...
>
> +static int mimio_greet(struct mimio *mimio)
> +{
> + const struct grtpkt {
> + int nbytes;
> + unsigned delay;
> + char data[8];
> + } grtpkts[] = {
> + { 3, 0, { 0x11, 0x55, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 } },
> + { 5, 0, { 0x53, 0x55, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00 } },
> + { 5, 0, { 0x43, 0x55, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00 } },
> + { 5, 0, { 0x33, 0x55, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00 } },
> + { 5, 0, { 0x13, 0x00, 0x5e, 0x02, 0x4f, 0x00, 0x00, 0x00 } },
> + { 5, 0, { 0x13, 0x00, 0x04, 0x03, 0x14, 0x00, 0x00, 0x00 } },
> + { 5, 2, { 0x13, 0x00, 0x00, 0x04, 0x17, 0x00, 0x00, 0x00 } },
> + { 5, 0, { 0x13, 0x00, 0x0d, 0x08, 0x16, 0x00, 0x00, 0x00 } },
> + { 5, 0, { 0x13, 0x00, 0x4d, 0x01, 0x5f, 0x00, 0x00, 0x00 } },
> + { 3, 0, { 0xf1, 0x55, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00 } },
> + { 7, 2, { 0x52, 0x55, 0x00, 0x07, 0x31, 0x55, 0x64, 0x00 } },
> + { 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
> + };

I believe that gcc does the right thing here, but an explict `static' would set
minds at ease.


--
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/