aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ak4104.c
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2012-11-21 23:08:36 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-11-23 10:09:07 -0500
commita273cd13a5b168ceed5c0a0e07bda530479d7f47 (patch)
tree3602e773f8e20eab1fb0b7b8f9ffe324c297bed5 /sound/soc/codecs/ak4104.c
parent385a4c2e286571ba824ee5312f506f198866c3b5 (diff)
ASoC: ak4104: Convert to use devm_regmap_init_spi()
Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/ak4104.c')
-rw-r--r--sound/soc/codecs/ak4104.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index eec086b226f7..4b11b82b2273 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -222,7 +222,7 @@ static int ak4104_spi_probe(struct spi_device *spi)
222 if (ak4104 == NULL) 222 if (ak4104 == NULL)
223 return -ENOMEM; 223 return -ENOMEM;
224 224
225 ak4104->regmap = regmap_init_spi(spi, &ak4104_regmap); 225 ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap);
226 if (IS_ERR(ak4104->regmap)) { 226 if (IS_ERR(ak4104->regmap)) {
227 ret = PTR_ERR(ak4104->regmap); 227 ret = PTR_ERR(ak4104->regmap);
228 return ret; 228 return ret;
@@ -247,30 +247,19 @@ static int ak4104_spi_probe(struct spi_device *spi)
247 * the device, but there is no hardware ID register. */ 247 * the device, but there is no hardware ID register. */
248 ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val); 248 ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val);
249 if (ret != 0) 249 if (ret != 0)
250 goto err; 250 return ret;
251 if (val != AK4104_RESERVED_VAL) { 251 if (val != AK4104_RESERVED_VAL)
252 ret = -ENODEV; 252 return -ENODEV;
253 goto err;
254 }
255 253
256 spi_set_drvdata(spi, ak4104); 254 spi_set_drvdata(spi, ak4104);
257 255
258 ret = snd_soc_register_codec(&spi->dev, 256 ret = snd_soc_register_codec(&spi->dev,
259 &soc_codec_device_ak4104, &ak4104_dai, 1); 257 &soc_codec_device_ak4104, &ak4104_dai, 1);
260 if (ret != 0)
261 goto err;
262
263 return 0;
264
265err:
266 regmap_exit(ak4104->regmap);
267 return ret; 258 return ret;
268} 259}
269 260
270static int __devexit ak4104_spi_remove(struct spi_device *spi) 261static int __devexit ak4104_spi_remove(struct spi_device *spi)
271{ 262{
272 struct ak4104_private *ak4101 = spi_get_drvdata(spi);
273 regmap_exit(ak4101->regmap);
274 snd_soc_unregister_codec(&spi->dev); 263 snd_soc_unregister_codec(&spi->dev);
275 return 0; 264 return 0;
276} 265}