Re: [patch] spinlocks: remove 'volatile'

Linus Torvalds
2006-07-06T21:08:08Z

On Thu, 6 Jul 2006, Jan Engelhardt wrote:
> >
> > You need to exclude "asm volatile", which is a completely different thing.
>
> 10077.

Yeah, way too many.

That said, at least _some_ of them are:

- casts to volatile inside arch-specific code serquences (ie the _good_
kind of volatile - associated with _code_ rather than data).

See for example include/asm-i386/io.h for 100% valid examples of this
kind of usage.

- function argument values for functions that need to be able to take an
arbitrary pointer ("const volatile void *" is the most permissive
argument type - anything else the compiler can complain about you
dropping qualifiers)

See include/asm-i386/bitops.h for examples of this kind of volatile.

So I'd expect that maybe one percent of them are actually valid ;)

And I suspect that a huge majority of the truly crapola ones are in
drivers. Oh, well..

Linus