[alsa-devel] ASoC updates for 2.6.37

Takashi Iwai tiwai at suse.de
Wed Oct 6 09:10:23 CEST 2010

At Wed, 6 Oct 2010 07:34:01 +0100,
Mark Brown wrote:
> On Wed, Oct 06, 2010 at 08:24:44AM +0200, Takashi Iwai wrote:
> > BTW, looking through the changes, I wonder why only
> > snd_soc_4_12_spi_write has the byte swap at copying msg[].  Is it
> > intended or a typo?  If this is a typo, we can merge all
> > snd_soc_*_spi_write() into a single function.
> It's not a byte swap, it's mangling part of the register and value
> together.  The others are using whole numbers of bytes.

To avoid confusion, I meant the code below:

static int snd_soc_4_12_spi_write(void *control_data, const char *data,
				 int len)
	msg[0] = data[1];
	msg[1] = data[0];

The others such as snd_soc_7_9_spi_write() (which also no-byte-aligned)
are straight copy:

static int snd_soc_7_9_spi_write(void *control_data, const char *data,
				 int len)
	msg[0] = data[0];
	msg[1] = data[1];

If the above difference is intentional, it should be commented

> > And, all snd_soc_x_y_read() and snd_soc_x_y_write() are fairly
> > resemble, just data[] setup is different.  They can be merged well, I
> > suppose.
> They also differ in the type of the cache variable.  You could do
> something with macros but it'd not be terribly pleasant.

Hm, this can be tricky.  Meanwhile, we could have it always int,
instead of different types.  The amount of memory you save by
supporting different size might be more than the waste of 3 bytes for
1 byte data array.

Just my $0.02, though.


More information about the Alsa-devel mailing list