Commit a273cd13 authored by Tushar Behera's avatar Tushar Behera Committed by Mark Brown

ASoC: ak4104: Convert to use devm_regmap_init_spi()

Signed-off-by: default avatarTushar Behera <tushar.behera@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 385a4c2e
...@@ -222,7 +222,7 @@ static int ak4104_spi_probe(struct spi_device *spi) ...@@ -222,7 +222,7 @@ static int ak4104_spi_probe(struct spi_device *spi)
if (ak4104 == NULL) if (ak4104 == NULL)
return -ENOMEM; return -ENOMEM;
ak4104->regmap = regmap_init_spi(spi, &ak4104_regmap); ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap);
if (IS_ERR(ak4104->regmap)) { if (IS_ERR(ak4104->regmap)) {
ret = PTR_ERR(ak4104->regmap); ret = PTR_ERR(ak4104->regmap);
return ret; return ret;
...@@ -247,30 +247,19 @@ static int ak4104_spi_probe(struct spi_device *spi) ...@@ -247,30 +247,19 @@ static int ak4104_spi_probe(struct spi_device *spi)
* the device, but there is no hardware ID register. */ * the device, but there is no hardware ID register. */
ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val); ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val);
if (ret != 0) if (ret != 0)
goto err; return ret;
if (val != AK4104_RESERVED_VAL) { if (val != AK4104_RESERVED_VAL)
ret = -ENODEV; return -ENODEV;
goto err;
}
spi_set_drvdata(spi, ak4104); spi_set_drvdata(spi, ak4104);
ret = snd_soc_register_codec(&spi->dev, ret = snd_soc_register_codec(&spi->dev,
&soc_codec_device_ak4104, &ak4104_dai, 1); &soc_codec_device_ak4104, &ak4104_dai, 1);
if (ret != 0)
goto err;
return 0;
err:
regmap_exit(ak4104->regmap);
return ret; return ret;
} }
static int __devexit ak4104_spi_remove(struct spi_device *spi) static int __devexit ak4104_spi_remove(struct spi_device *spi)
{ {
struct ak4104_private *ak4101 = spi_get_drvdata(spi);
regmap_exit(ak4101->regmap);
snd_soc_unregister_codec(&spi->dev); snd_soc_unregister_codec(&spi->dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment