ASoC: Remove 'reg_size' field from snd_soc_codec struct
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 31 Aug 2013 18:31:14 +0000 (20:31 +0200)
committerMark Brown <broonie@linaro.org>
Mon, 16 Sep 2013 23:37:03 +0000 (00:37 +0100)
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>
include/sound/soc.h
sound/soc/soc-cache.c
sound/soc/soc-core.c

index 62f320f56644abb87422bc5002e61211f1454257..577212629d0f4d84c7dfff157fe824c597784928 100644 (file)
@@ -662,7 +662,6 @@ struct snd_soc_codec {
        struct list_head card_list;
        int num_dai;
        enum snd_soc_compress_type compress_type;
-       size_t reg_size;        /* reg_cache_size * reg_word_size */
        int (*volatile_register)(struct snd_soc_codec *, unsigned int);
        int (*readable_register)(struct snd_soc_codec *, unsigned int);
        int (*writable_register)(struct snd_soc_codec *, unsigned int);
index a7f83c0c62cec55de9e3cae440a0d3ce053499e0..9542c83d229568e8d43a316ef6c68b13544b24a2 100644 (file)
@@ -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;
 
index bbe833ab657e1d14a11388ee578626115a629985..af9648426f4f226d7ce08d52f97a595a73c94ddc 100644 (file)
@@ -4159,7 +4159,6 @@ int snd_soc_register_codec(struct device *dev,
                           struct snd_soc_dai_driver *dai_drv,
                           int num_dai)
 {
-       size_t reg_size;
        struct snd_soc_codec *codec;
        int ret, i;
 
@@ -4197,12 +4196,6 @@ int snd_soc_register_codec(struct device *dev,
        codec->num_dai = num_dai;
        mutex_init(&codec->mutex);
 
-       /* allocate CODEC register cache */
-       if (codec_drv->reg_cache_size && codec_drv->reg_word_size) {
-               reg_size = codec_drv->reg_cache_size * codec_drv->reg_word_size;
-               codec->reg_size = reg_size;
-       }
-
        for (i = 0; i < num_dai; i++) {
                fixup_codec_formats(&dai_drv[i].playback);
                fixup_codec_formats(&dai_drv[i].capture);
This page took 0.028452 seconds and 5 git commands to generate.