diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-06-10 14:42:56 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-06-13 09:22:57 -0400 |
commit | f0c4205b54113463ccb93c9ab064fc630c5c50bd (patch) | |
tree | e2d3367bd5853f82d63b4fa829eb40288a7cbfa6 /sound | |
parent | f192c0ab2420aa59d6fae26564b14adf97456063 (diff) |
ASoC: Factor out redundant read() functions
We've got a whole bunch of functions which just call straight through to
do_hw_read(). Simplify this situation by removing them and using hw_read()
directly.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-cache.c | 52 |
1 files changed, 8 insertions, 44 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 9a88a276a0ab..b88a61fd6de0 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -61,7 +61,7 @@ static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg, | |||
61 | return -EIO; | 61 | return -EIO; |
62 | } | 62 | } |
63 | 63 | ||
64 | static unsigned int do_hw_read(struct snd_soc_codec *codec, unsigned int reg) | 64 | static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg) |
65 | { | 65 | { |
66 | int ret; | 66 | int ret; |
67 | unsigned int val; | 67 | unsigned int val; |
@@ -82,12 +82,6 @@ static unsigned int do_hw_read(struct snd_soc_codec *codec, unsigned int reg) | |||
82 | return val; | 82 | return val; |
83 | } | 83 | } |
84 | 84 | ||
85 | static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec, | ||
86 | unsigned int reg) | ||
87 | { | ||
88 | return do_hw_read(codec, reg); | ||
89 | } | ||
90 | |||
91 | static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, | 85 | static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, |
92 | unsigned int value) | 86 | unsigned int value) |
93 | { | 87 | { |
@@ -98,12 +92,6 @@ static int snd_soc_4_12_write(struct snd_soc_codec *codec, unsigned int reg, | |||
98 | return do_hw_write(codec, reg, value, &data, 2); | 92 | return do_hw_write(codec, reg, value, &data, 2); |
99 | } | 93 | } |
100 | 94 | ||
101 | static unsigned int snd_soc_7_9_read(struct snd_soc_codec *codec, | ||
102 | unsigned int reg) | ||
103 | { | ||
104 | return do_hw_read(codec, reg); | ||
105 | } | ||
106 | |||
107 | static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, | 95 | static int snd_soc_7_9_write(struct snd_soc_codec *codec, unsigned int reg, |
108 | unsigned int value) | 96 | unsigned int value) |
109 | { | 97 | { |
@@ -126,12 +114,6 @@ static int snd_soc_8_8_write(struct snd_soc_codec *codec, unsigned int reg, | |||
126 | return do_hw_write(codec, reg, value, data, 2); | 114 | return do_hw_write(codec, reg, value, data, 2); |
127 | } | 115 | } |
128 | 116 | ||
129 | static unsigned int snd_soc_8_8_read(struct snd_soc_codec *codec, | ||
130 | unsigned int reg) | ||
131 | { | ||
132 | return do_hw_read(codec, reg); | ||
133 | } | ||
134 | |||
135 | static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, | 117 | static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, |
136 | unsigned int value) | 118 | unsigned int value) |
137 | { | 119 | { |
@@ -144,12 +126,6 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
144 | return do_hw_write(codec, reg, value, data, 3); | 126 | return do_hw_write(codec, reg, value, data, 3); |
145 | } | 127 | } |
146 | 128 | ||
147 | static unsigned int snd_soc_8_16_read(struct snd_soc_codec *codec, | ||
148 | unsigned int reg) | ||
149 | { | ||
150 | return do_hw_read(codec, reg); | ||
151 | } | ||
152 | |||
153 | #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) | 129 | #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) |
154 | static unsigned int do_i2c_read(struct snd_soc_codec *codec, | 130 | static unsigned int do_i2c_read(struct snd_soc_codec *codec, |
155 | void *reg, int reglen, | 131 | void *reg, int reglen, |
@@ -232,12 +208,6 @@ static unsigned int snd_soc_16_8_read_i2c(struct snd_soc_codec *codec, | |||
232 | #define snd_soc_16_8_read_i2c NULL | 208 | #define snd_soc_16_8_read_i2c NULL |
233 | #endif | 209 | #endif |
234 | 210 | ||
235 | static unsigned int snd_soc_16_8_read(struct snd_soc_codec *codec, | ||
236 | unsigned int reg) | ||
237 | { | ||
238 | return do_hw_read(codec, reg); | ||
239 | } | ||
240 | |||
241 | static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg, | 211 | static int snd_soc_16_8_write(struct snd_soc_codec *codec, unsigned int reg, |
242 | unsigned int value) | 212 | unsigned int value) |
243 | { | 213 | { |
@@ -267,12 +237,6 @@ static unsigned int snd_soc_16_16_read_i2c(struct snd_soc_codec *codec, | |||
267 | #define snd_soc_16_16_read_i2c NULL | 237 | #define snd_soc_16_16_read_i2c NULL |
268 | #endif | 238 | #endif |
269 | 239 | ||
270 | static unsigned int snd_soc_16_16_read(struct snd_soc_codec *codec, | ||
271 | unsigned int reg) | ||
272 | { | ||
273 | return do_hw_read(codec, reg); | ||
274 | } | ||
275 | |||
276 | static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg, | 240 | static int snd_soc_16_16_write(struct snd_soc_codec *codec, unsigned int reg, |
277 | unsigned int value) | 241 | unsigned int value) |
278 | { | 242 | { |
@@ -337,30 +301,30 @@ static struct { | |||
337 | } io_types[] = { | 301 | } io_types[] = { |
338 | { | 302 | { |
339 | .addr_bits = 4, .data_bits = 12, | 303 | .addr_bits = 4, .data_bits = 12, |
340 | .write = snd_soc_4_12_write, .read = snd_soc_4_12_read, | 304 | .write = snd_soc_4_12_write, |
341 | }, | 305 | }, |
342 | { | 306 | { |
343 | .addr_bits = 7, .data_bits = 9, | 307 | .addr_bits = 7, .data_bits = 9, |
344 | .write = snd_soc_7_9_write, .read = snd_soc_7_9_read, | 308 | .write = snd_soc_7_9_write, |
345 | }, | 309 | }, |
346 | { | 310 | { |
347 | .addr_bits = 8, .data_bits = 8, | 311 | .addr_bits = 8, .data_bits = 8, |
348 | .write = snd_soc_8_8_write, .read = snd_soc_8_8_read, | 312 | .write = snd_soc_8_8_write, |
349 | .i2c_read = snd_soc_8_8_read_i2c, | 313 | .i2c_read = snd_soc_8_8_read_i2c, |
350 | }, | 314 | }, |
351 | { | 315 | { |
352 | .addr_bits = 8, .data_bits = 16, | 316 | .addr_bits = 8, .data_bits = 16, |
353 | .write = snd_soc_8_16_write, .read = snd_soc_8_16_read, | 317 | .write = snd_soc_8_16_write, |
354 | .i2c_read = snd_soc_8_16_read_i2c, | 318 | .i2c_read = snd_soc_8_16_read_i2c, |
355 | }, | 319 | }, |
356 | { | 320 | { |
357 | .addr_bits = 16, .data_bits = 8, | 321 | .addr_bits = 16, .data_bits = 8, |
358 | .write = snd_soc_16_8_write, .read = snd_soc_16_8_read, | 322 | .write = snd_soc_16_8_write, |
359 | .i2c_read = snd_soc_16_8_read_i2c, | 323 | .i2c_read = snd_soc_16_8_read_i2c, |
360 | }, | 324 | }, |
361 | { | 325 | { |
362 | .addr_bits = 16, .data_bits = 16, | 326 | .addr_bits = 16, .data_bits = 16, |
363 | .write = snd_soc_16_16_write, .read = snd_soc_16_16_read, | 327 | .write = snd_soc_16_16_write, |
364 | .i2c_read = snd_soc_16_16_read_i2c, | 328 | .i2c_read = snd_soc_16_16_read_i2c, |
365 | }, | 329 | }, |
366 | }; | 330 | }; |
@@ -402,7 +366,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
402 | } | 366 | } |
403 | 367 | ||
404 | codec->write = io_types[i].write; | 368 | codec->write = io_types[i].write; |
405 | codec->read = io_types[i].read; | 369 | codec->read = hw_read; |
406 | codec->bulk_write_raw = snd_soc_hw_bulk_write_raw; | 370 | codec->bulk_write_raw = snd_soc_hw_bulk_write_raw; |
407 | 371 | ||
408 | switch (control) { | 372 | switch (control) { |