Re: unsigned long ioremap()?

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Thu May 03 2001 - 02:18:32 EST


"David S. Miller" wrote:
> There is a school of thought which believes that:
>
> struct xdev_regs {
> u32 reg1;
> u32 reg2;
> };
>
> val = readl(&regs->reg2);
>
> is cleaner than:
>
> #define REG1 0x00
> #define REG2 0x04
>
> val = readl(regs + REG2);
>
> I'm personally ambivalent and believe that both cases should be allowed.

Agreed... Tangent a bit, I wanted to plug using macros which IMHO make
code even more readable:

        val = RTL_R32(REG2);
        RTL_W32(REG2, val);

Since these are driver-private, if you are only dealing with one chip
you could even shorten things to "R32" and "W32", if that doesn't offend
any sensibilities :)

-- 
Jeff Garzik      | Game called on account of naked chick
Building 1024    |
MandrakeSoft     |
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 07 2001 - 21:00:15 EST