summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-04-01 14:50:44 -0600
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-03 22:11:26 +0900
commit00b317a41c5428b13eb7e5b4bbc691b1aa7afa80 (patch)
tree59e8f673eb8d23cd67117c1c1c50fcddfa6af6bd
parent1b4610ebf37a05a65e9f29cdf4d87c207573104d (diff)
downloadlinux-00b317a41c5428b13eb7e5b4bbc691b1aa7afa80.tar.gz
linux-00b317a41c5428b13eb7e5b4bbc691b1aa7afa80.tar.bz2
linux-00b317a41c5428b13eb7e5b4bbc691b1aa7afa80.zip
ASoC: format_register_str: Don't clip register values
wordsize is used as the textual width of a register address. regsize is used as the textual width of a register value. The assignments to these values were swapped. In the case of WM8903, which has 8-bit register addresses and 16-bit register values, this caused the register values to be clipped to 2 digits instead of the full 4. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/soc-core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4dda58926bc5..b76b74db0968 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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;