Re: [PATCH 1/4] pxafb: introduce lcd_{read,write}l() to wrap the__raw_{read,write}l()

From: Andrew Morton
Date: Tue Apr 08 2008 - 04:20:58 EST


On Tue, 8 Apr 2008 12:03:16 +0800 "eric miao" <eric.y.miao@xxxxxxxxx> wrote:

> +#define lcd_readl(f, off) __raw_readl((f)->mmio_base + (off))
> +#define lcd_writel(f, off, v) __raw_writel((v), (f)->mmio_base + (off))

Please implement things like this in C. Probably inlined.

Advantages:

- C looks nicer

- For some reason people are more likely to document their C than their macros

- macros can sometimes reference their argument multiple times, causing
bugs when they are passed experssions with side-effects.

- C functions have typechecking

- C functions (whether inlined or not) count as a reference to their
argument, and can help to avoid unused-variable warnings.


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