static int __devinit ad193x_spi_probe(struct spi_device *spi)
{
struct ad193x_priv *ad193x;
- int ret;
ad193x = devm_kzalloc(&spi->dev, sizeof(struct ad193x_priv),
GFP_KERNEL);
if (ad193x == NULL)
return -ENOMEM;
- ad193x->regmap = regmap_init_spi(spi, &ad193x_spi_regmap_config);
- if (IS_ERR(ad193x->regmap)) {
- ret = PTR_ERR(ad193x->regmap);
- goto err_out;
- }
+ ad193x->regmap = devm_regmap_init_spi(spi, &ad193x_spi_regmap_config);
+ if (IS_ERR(ad193x->regmap))
+ return PTR_ERR(ad193x->regmap);
spi_set_drvdata(spi, ad193x);
- ret = snd_soc_register_codec(&spi->dev,
- &soc_codec_dev_ad193x, &ad193x_dai, 1);
- if (ret < 0)
- goto err_regmap_exit;
-
- return 0;
-
-err_regmap_exit:
- regmap_exit(ad193x->regmap);
-err_out:
- return ret;
+ return snd_soc_register_codec(&spi->dev, &soc_codec_dev_ad193x,
+ &ad193x_dai, 1);
}
static int __devexit ad193x_spi_remove(struct spi_device *spi)
{
- struct ad193x_priv *ad193x = spi_get_drvdata(spi);
-
snd_soc_unregister_codec(&spi->dev);
- regmap_exit(ad193x->regmap);
return 0;
}
const struct i2c_device_id *id)
{
struct ad193x_priv *ad193x;
- int ret;
ad193x = devm_kzalloc(&client->dev, sizeof(struct ad193x_priv),
GFP_KERNEL);
if (ad193x == NULL)
return -ENOMEM;
- ad193x->regmap = regmap_init_i2c(client, &ad193x_i2c_regmap_config);
- if (IS_ERR(ad193x->regmap)) {
- ret = PTR_ERR(ad193x->regmap);
- goto err_out;
- }
+ ad193x->regmap = devm_regmap_init_i2c(client, &ad193x_i2c_regmap_config);
+ if (IS_ERR(ad193x->regmap))
+ return PTR_ERR(ad193x->regmap);
i2c_set_clientdata(client, ad193x);
- ret = snd_soc_register_codec(&client->dev,
- &soc_codec_dev_ad193x, &ad193x_dai, 1);
- if (ret < 0)
- goto err_regmap_exit;
-
- return 0;
-
-err_regmap_exit:
- regmap_exit(ad193x->regmap);
-err_out:
- return ret;
+ return snd_soc_register_codec(&client->dev, &soc_codec_dev_ad193x,
+ &ad193x_dai, 1);
}
static int __devexit ad193x_i2c_remove(struct i2c_client *client)
{
- struct ad193x_priv *ad193x = i2c_get_clientdata(client);
-
snd_soc_unregister_codec(&client->dev);
- regmap_exit(ad193x->regmap);
return 0;
}