Re: [patch] synclink.c compiler optimiation fix

From: Christoph Hellwig
Date: Thu Sep 08 2005 - 08:52:38 EST


On Wed, Sep 07, 2005 at 12:02:23PM -0500, Paul Fulghum wrote:
> - u16 count; /* buffer size/data count */
> - u16 status; /* Control/status field */
> - u16 rcc; /* character count field */
> + volatile u16 count; /* buffer size/data count */
> + volatile u16 status; /* Control/status field */
> + volatile u16 rcc; /* character count field */

this is wrong. The structure is in ioremaped memory so you must
use reads/writes to access them instead. volatile usage in drivers
is never okay - if you are accessing I/O memory you need to use
proper acessors, if it is normal memory and you want atomic sematics
you need to use the atomic_t type and the operators defined on it.

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