[alsa-devel] [PATCH] sound/soc: rename vol to volatile_register as appropriate

Joe Perches joe at perches.com
Wed Oct 13 17:35:07 CEST 2010


On Wed, 2010-10-13 at 16:29 +0100, Mark Brown wrote:
> On Wed, Oct 13, 2010 at 08:27:47AM -0700, Joe Perches wrote:
> > On Wed, 2010-10-13 at 16:11 +0100, Mark Brown wrote:
> > > If you check the code again you will notice that these functons are all
> > > used in ops structures which presents obvious issues when trying to
> > > replace with open coded checks.
> > > I hope their usefulness is clear given the above.
> > There is some value in using consistent
> > function styles for table driven and non-table
> > driven instances.
> I'm sorry, I don't understand what you are saying here.  What do you
> believe to be inconsistent?

I don't believe anything to be inconsistent about
the volatile uses and was agreeing with you.

Some codecs functions for volatile access use
a switch/case,

static int wm8994_volatile(unsigned int reg)
{
	if (reg >= WM8994_REG_CACHE_SIZE)
		return 1;

	switch (reg) {
	case WM8994_SOFTWARE_RESET:
	case WM8994_CHIP_REVISION:
	case WM8994_DC_SERVO_1:
	case WM8994_DC_SERVO_READBACK:
	case WM8994_RATE_STATUS:
	case WM8994_LDO_1:
	case WM8994_LDO_2:
		return 1;
	default:
		return 0;
	}
}

others use the register variable from the struct

static int wm8962_volatile_register(unsigned int reg)
{
	if (wm8962_reg_access[reg].volatile_register)
		return 1;
	else
		return 0;
}

so I'm agreeing that it's useful to keep the
same access style in multiple codecs instead
of using separate styles in each one.

It'd be even better to use a similarly consistent
function naming scheme.

cheers, Joe



More information about the Alsa-devel mailing list