lkml.org 
[lkml]   [1999]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: howto avoid optimizing a read?
Alan Cox wrote:
> > Whats the easiest way to avoid having the read optimized away? I am
> > fairly fluent in C, but compiler optimizations are bit too much black
> > magic for me.
>
> Look up the volatile keyword in a C manual. It exists for exactly these
> sort of occasions.

The documentation says to use readb/readw/readl to read memory-mapped
devices, and they use volatile already so use them.

Don't read existing device drivers, you might learn bad habits. :-)

References: Documentation/IO-mapping.txt, <asm/io.h>

-- Jamie

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

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.015 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site