All of lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: about the array to cache registers
@ 2009-07-24  7:06 Joonyoung Shim
  2009-07-24  9:18 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Joonyoung Shim @ 2009-07-24  7:06 UTC (permalink / raw)
  To: alsa-devel; +Cc: kyungmin.park, broonie

Hi,

Many ASoC codec drivers have an array to cache registers.
The array is not used any longer after memcpy to codec->reg_cache.
I think that memcpy is unnecessary, and it a waste of the memory.

How about continue using the array instead of memcpy?

For example, i modified such following patch in wm8731.c


diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 1560028..43f8de3 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -36,7 +36,6 @@ struct snd_soc_codec_device soc_codec_dev_wm8731;
 /* codec private data */
 struct wm8731_priv {
 	struct snd_soc_codec codec;
-	u16 reg_cache[WM8731_CACHEREGNUM];
 	unsigned int sysclk;
 };
 
@@ -50,7 +49,7 @@ static int wm8731_spi_write(struct spi_device *spi, const char *data, int len);
  * using 2 wire for device control, so we cache them instead.
  * There is no point in caching the reset register
  */
-static const u16 wm8731_reg[WM8731_CACHEREGNUM] = {
+static u16 wm8731_reg[WM8731_CACHEREGNUM] = {
     0x0097, 0x0097, 0x0079, 0x0079,
     0x000a, 0x0008, 0x009f, 0x000a,
     0x0000, 0x0000
@@ -586,9 +585,7 @@ static int wm8731_register(struct wm8731_priv *wm8731)
 	codec->dai = &wm8731_dai;
 	codec->num_dai = 1;
 	codec->reg_cache_size = WM8731_CACHEREGNUM;
-	codec->reg_cache = &wm8731->reg_cache;
-
-	memcpy(codec->reg_cache, wm8731_reg, sizeof(wm8731_reg));
+	codec->reg_cache = &wm8731_reg;
 
 	ret = wm8731_reset(codec);
 	if (ret < 0) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-24  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-24  7:06 ASoC: about the array to cache registers Joonyoung Shim
2009-07-24  9:18 ` Mark Brown
2009-07-24  9:43   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.