]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: io: Use dev_get_regmap() if driver doesn't provide a regmap
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 8 May 2012 16:46:36 +0000 (17:46 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 3 Jun 2012 12:06:41 +0000 (13:06 +0100)
Less error prone and one less line of code in drivers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/soc-io.c

index 4d8dc6a27d4d170f1586999a88a531fa30ea6807..44d0174b4d97d1a0e727fb3d606ea68be4e59740 100644 (file)
@@ -142,6 +142,8 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
        case SND_SOC_REGMAP:
                /* Device has made its own regmap arrangements */
                codec->using_regmap = true;
+               if (!codec->control_data)
+                       codec->control_data = dev_get_regmap(codec->dev, NULL);
 
                ret = regmap_get_val_bytes(codec->control_data);
                /* Errors are legitimate for non-integer byte multiples */