Re: New resources - pls, explain :-(

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Sun, 15 Aug 1999 09:08:37 +0200 (MEST)


Linus Torvalds wrote:
> If you just say that "__writel()" does the native byte order, then you can
> do cpu_to_be32() and get exactly the semantics that you seem to want. I
> don't understand WHY you'd want them, but I can just tell you to do
>
> __writel(cpu_to_be32(x),y)
>
> and it will be equivalent to your __writel_be(). I don't see why anybody
> would ever use the above, as the only arguments for the _be version so far
> have really been arguments for _native_ byte order on BE machines, but
> that's all the more reason to not do something silly like export hundreds
> of slightly different and useless versions of IO access.

Let me add that if the device that you're writing a driver for really
needs this, you can do a

#define my_device_writel(x,y) __writel(cpu_to_be32(x),y)

at the top of the driver.

I usually start out by doing that. And instead of giving along the IO
address, I give it the board-control-structure and the register
offset. So I usually end up with:

#define my_device_writel(x, bp, r) __writel((x), bp->base + r)

Convincing Linus that he's wrong (he's not) requires that you put an
identical define like that at the top of every driver that need
it. After a while just give him the patch that removes it from those
drivers and puts it in a central header file.

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
------ Microsoft SELLS you Windows, Linux GIVES you the whole house ------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/