[PATCH] staging: iio: light: isl29018: use regmap for register access
ldewangan at nvidia.com
Tue Apr 17 23:19:41 PDT 2012
Including Mark here for more insight/comment.
On Tuesday 17 April 2012 11:26 PM, Bryan Freed wrote:
> Hey Laxman, Jonathan.
> The regmap is pretty new to me. In looking at it, I see
> _regmap_write() will regcache_write() before attempting to write to
> the device.
> This effectively updates the cached value even when the device write
> fails, which is the opposite of the current isl29018 cache policy.
> It looks like we tried to change the policy back in August and got
> this response:
> > I did change one basic behavior that I think was also broken: cache
> > the value regardless of if the transaction completed successfully or
> > not.
> Don't do that. That means userspace will get an invalid value if it reads
> in the meantime. If you have an error on a hardware bus - tell userspace about
> it and don't 'guess' what is in the register.
> See http://driverdev.linuxdriverproject.org/pipermail/devel/2011-August/020256.html
> for details.
> The result is likely to be that after a failed write to one field of a
> register, the next successful write to another field of that register
> will update them both.
yes, the caching is done before actual transfer and it can make cache
dirty in case of transfer failure.
I am not sure what should be correct handling here: make cache dirty or
revert the value to original one?
But using the regmap will provide the common behavior across the driver
and all driver will have same behavior rather than handling on
differently across driver.
So if there is any other policy for this, it will be same for all driver.
More information about the devel