On Wed, 2010-12-22 at 11:07 +0000, Mark Brown wrote:
On Wed, Dec 22, 2010 at 10:54:39AM +0000, Liam Girdwood wrote:
On Wed, 2010-12-22 at 10:26 +0000, Dimitris Papastamos wrote:
On Tue, 2010-12-21 at 20:38 +0000, Liam Girdwood wrote:
On Tue, 2010-12-21 at 17:16 +0000, Dimitris Papastamos wrote:
+static int wm8995_volatile(unsigned int reg) +{
- if (reg >= WM8995_MAX_REGISTER + 1)
return 1;
return -EINVAL here.
The logic behind this is that out of bounds registers are considered volatile.
It does look a little odd since out of bounds generally means invalid.
Most of the drivers that use this idiom use a constant like MAX_CACHED_REGISTER or similar which makes it clearer that there are more registers beyond the end of the register map. The normal use is to allow access to partially documented diagnostic registers or to support register banks that are partially owned by something else (devices with an embedded DSP being the most obvious example).
Yes that makes sense. I've changed the function to use WM8995_MAX_CACHED_REGISTER instead.
Thanks, Dimitris