Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
[pandora-kernel.git] / sound / soc / soc-core.c
index 4dda589..d8562ce 100644 (file)
@@ -92,8 +92,8 @@ static int min_bytes_needed(unsigned long val)
 static int format_register_str(struct snd_soc_codec *codec,
                               unsigned int reg, char *buf, size_t len)
 {
-       int wordsize = codec->driver->reg_word_size * 2;
-       int regsize = min_bytes_needed(codec->driver->reg_cache_size) * 2;
+       int wordsize = min_bytes_needed(codec->driver->reg_cache_size) * 2;
+       int regsize = codec->driver->reg_word_size * 2;
        int ret;
        char tmpbuf[len + 1];
        char regbuf[regsize + 1];
@@ -132,8 +132,8 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf,
        size_t total = 0;
        loff_t p = 0;
 
-       wordsize = codec->driver->reg_word_size * 2;
-       regsize = min_bytes_needed(codec->driver->reg_cache_size) * 2;
+       wordsize = min_bytes_needed(codec->driver->reg_cache_size) * 2;
+       regsize = codec->driver->reg_word_size * 2;
 
        len = wordsize + regsize + 2 + 1;
 
@@ -629,6 +629,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
                        runtime->hw.rates |= codec_dai_drv->capture.rates;
        }
 
+       ret = -EINVAL;
        snd_pcm_limit_hw_rates(runtime);
        if (!runtime->hw.rates) {
                printk(KERN_ERR "asoc: %s <-> %s No matching rates\n",
@@ -640,7 +641,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
                        codec_dai->name, cpu_dai->name);
                goto config_err;
        }
-       if (!runtime->hw.channels_min || !runtime->hw.channels_max) {
+       if (!runtime->hw.channels_min || !runtime->hw.channels_max ||
+           runtime->hw.channels_min > runtime->hw.channels_max) {
                printk(KERN_ERR "asoc: %s <-> %s No matching channels\n",
                                codec_dai->name, cpu_dai->name);
                goto config_err;
@@ -2060,6 +2062,7 @@ const struct dev_pm_ops snd_soc_pm_ops = {
        .resume = snd_soc_resume,
        .poweroff = snd_soc_poweroff,
 };
+EXPORT_SYMBOL_GPL(snd_soc_pm_ops);
 
 /* ASoC platform driver */
 static struct platform_driver soc_driver = {