Is it safe to use these Linux function (test_bit(), set_bit(), clear_bit()) in character device driver for 2.6.10 ppc kernel.

Grant Likely grant.likely at
Fri Oct 5 02:42:33 EST 2007

On 10/4/07, Misbah khan <misbah_khan at> wrote:
> Hi ...
> I did followed you and it worked as well. I really Thank you for it.
> At one Place i am doing memcpy() of floating point data to the memory mapped
> registers, what could be the substitute of it like "memcpy_toio() " which is
> suggested in the Book. I am working BE architecture.
> I would really appreaciate if you would let me know the defineation of these
> wrapper functions (in_be32,out_be32(),ioread32(),iowrite32(),etc) so that i
> could have the clear idea of the reason for not directly dreferencing the
> Pointer.

You don't want to directly dereference pointers to device registers
because you don't want the processor or compiler to reorder your
register accesses.  The in/out_* wrappers keeps the compiler from
reordering things, and the wrappers contain the 'sync' instruction
which prevents the processor from reordering operations at runtime.

Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at
(403) 399-0195

More information about the Linuxppc-embedded mailing list