summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-cache.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-08-31 20:31:14 +0200
committerMark Brown <broonie@linaro.org>2013-09-17 00:37:03 +0100
commita94ed23436fb28bdcdd66e7fcf68ca5f7967e456 (patch)
tree0584c2db7f2d1a0b8a21da7f50a95453a78708e5 /sound/soc/soc-cache.c
parentb012aa619e50d22df0835b64a5dcebc221fb8053 (diff)
downloadop-kernel-dev-a94ed23436fb28bdcdd66e7fcf68ca5f7967e456.zip
op-kernel-dev-a94ed23436fb28bdcdd66e7fcf68ca5f7967e456.tar.gz
ASoC: Remove 'reg_size' field from snd_soc_codec struct
The reg_size field is calculated in snd_soc_register_codec() and then used exactly once in snd_soc_flat_cache_init(). Since it is calculated based on other fields from the codec struct just move the calculation to snd_soc_flat_cache_init() and remove the 'reg_size' field from the codec struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r--sound/soc/soc-cache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index a7f83c0..9542c83 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -122,12 +122,15 @@ static int snd_soc_flat_cache_exit(struct snd_soc_codec *codec)
static int snd_soc_flat_cache_init(struct snd_soc_codec *codec)
{
const struct snd_soc_codec_driver *codec_drv = codec->driver;
+ size_t reg_size;
+
+ reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size;
if (codec_drv->reg_cache_default)
codec->reg_cache = kmemdup(codec_drv->reg_cache_default,
- codec->reg_size, GFP_KERNEL);
+ reg_size, GFP_KERNEL);
else
- codec->reg_cache = kzalloc(codec->reg_size, GFP_KERNEL);
+ codec->reg_cache = kzalloc(reg_size, GFP_KERNEL);
if (!codec->reg_cache)
return -ENOMEM;
OpenPOWER on IntegriCloud