Using of cached values

Daniel Mack daniel at caiaq.de
Sat Mar 20 05:44:25 EDT 2010


On Sat, Mar 20, 2010 at 06:22:43PM +0900, Mogambo Park wrote:
>   I wants to know - How safe to read register values one time in a structure
> and use value from there, assume no write is performed on the
> register? I see many
> files in sound/soc/codec/ do that.

Why shouldn't that be safe? Do you expect your cache to get lost?

> is it becos sometime the register may return not accurate value on
> busy bus by h/w mistake?
> OR I should always read from register even if his value is not
> expected to change?

If the register content does not change, you can use a cached value.
That can be a lot faster and less power-consuming than going over the
bus and reading from the device. Depending on the bus in use and how
often you do that of course.

Daniel




More information about the linux-arm-kernel mailing list