diff options
Diffstat (limited to 'sound/soc/codecs/da7210.c')
-rw-r--r-- | sound/soc/codecs/da7210.c | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index af5db7080519..9c1231456502 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c | |||
@@ -1218,8 +1218,8 @@ static const struct regmap_config da7210_regmap_config_i2c = { | |||
1218 | .cache_type = REGCACHE_RBTREE, | 1218 | .cache_type = REGCACHE_RBTREE, |
1219 | }; | 1219 | }; |
1220 | 1220 | ||
1221 | static int __devinit da7210_i2c_probe(struct i2c_client *i2c, | 1221 | static int da7210_i2c_probe(struct i2c_client *i2c, |
1222 | const struct i2c_device_id *id) | 1222 | const struct i2c_device_id *id) |
1223 | { | 1223 | { |
1224 | struct da7210_priv *da7210; | 1224 | struct da7210_priv *da7210; |
1225 | int ret; | 1225 | int ret; |
@@ -1231,7 +1231,7 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c, | |||
1231 | 1231 | ||
1232 | i2c_set_clientdata(i2c, da7210); | 1232 | i2c_set_clientdata(i2c, da7210); |
1233 | 1233 | ||
1234 | da7210->regmap = regmap_init_i2c(i2c, &da7210_regmap_config_i2c); | 1234 | da7210->regmap = devm_regmap_init_i2c(i2c, &da7210_regmap_config_i2c); |
1235 | if (IS_ERR(da7210->regmap)) { | 1235 | if (IS_ERR(da7210->regmap)) { |
1236 | ret = PTR_ERR(da7210->regmap); | 1236 | ret = PTR_ERR(da7210->regmap); |
1237 | dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); | 1237 | dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); |
@@ -1245,24 +1245,15 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c, | |||
1245 | 1245 | ||
1246 | ret = snd_soc_register_codec(&i2c->dev, | 1246 | ret = snd_soc_register_codec(&i2c->dev, |
1247 | &soc_codec_dev_da7210, &da7210_dai, 1); | 1247 | &soc_codec_dev_da7210, &da7210_dai, 1); |
1248 | if (ret < 0) { | 1248 | if (ret < 0) |
1249 | dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); | 1249 | dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); |
1250 | goto err_regmap; | ||
1251 | } | ||
1252 | return ret; | ||
1253 | |||
1254 | err_regmap: | ||
1255 | regmap_exit(da7210->regmap); | ||
1256 | 1250 | ||
1257 | return ret; | 1251 | return ret; |
1258 | } | 1252 | } |
1259 | 1253 | ||
1260 | static int __devexit da7210_i2c_remove(struct i2c_client *client) | 1254 | static int da7210_i2c_remove(struct i2c_client *client) |
1261 | { | 1255 | { |
1262 | struct da7210_priv *da7210 = i2c_get_clientdata(client); | ||
1263 | |||
1264 | snd_soc_unregister_codec(&client->dev); | 1256 | snd_soc_unregister_codec(&client->dev); |
1265 | regmap_exit(da7210->regmap); | ||
1266 | return 0; | 1257 | return 0; |
1267 | } | 1258 | } |
1268 | 1259 | ||
@@ -1279,7 +1270,7 @@ static struct i2c_driver da7210_i2c_driver = { | |||
1279 | .owner = THIS_MODULE, | 1270 | .owner = THIS_MODULE, |
1280 | }, | 1271 | }, |
1281 | .probe = da7210_i2c_probe, | 1272 | .probe = da7210_i2c_probe, |
1282 | .remove = __devexit_p(da7210_i2c_remove), | 1273 | .remove = da7210_i2c_remove, |
1283 | .id_table = da7210_i2c_id, | 1274 | .id_table = da7210_i2c_id, |
1284 | }; | 1275 | }; |
1285 | #endif | 1276 | #endif |
@@ -1323,7 +1314,7 @@ static const struct regmap_config da7210_regmap_config_spi = { | |||
1323 | .cache_type = REGCACHE_RBTREE, | 1314 | .cache_type = REGCACHE_RBTREE, |
1324 | }; | 1315 | }; |
1325 | 1316 | ||
1326 | static int __devinit da7210_spi_probe(struct spi_device *spi) | 1317 | static int da7210_spi_probe(struct spi_device *spi) |
1327 | { | 1318 | { |
1328 | struct da7210_priv *da7210; | 1319 | struct da7210_priv *da7210; |
1329 | int ret; | 1320 | int ret; |
@@ -1346,24 +1337,15 @@ static int __devinit da7210_spi_probe(struct spi_device *spi) | |||
1346 | if (ret != 0) | 1337 | if (ret != 0) |
1347 | dev_warn(&spi->dev, "Failed to apply regmap patch: %d\n", ret); | 1338 | dev_warn(&spi->dev, "Failed to apply regmap patch: %d\n", ret); |
1348 | 1339 | ||
1349 | ret = snd_soc_register_codec(&spi->dev, | 1340 | ret = snd_soc_register_codec(&spi->dev, |
1350 | &soc_codec_dev_da7210, &da7210_dai, 1); | 1341 | &soc_codec_dev_da7210, &da7210_dai, 1); |
1351 | if (ret < 0) | ||
1352 | goto err_regmap; | ||
1353 | |||
1354 | return ret; | ||
1355 | |||
1356 | err_regmap: | ||
1357 | regmap_exit(da7210->regmap); | ||
1358 | 1342 | ||
1359 | return ret; | 1343 | return ret; |
1360 | } | 1344 | } |
1361 | 1345 | ||
1362 | static int __devexit da7210_spi_remove(struct spi_device *spi) | 1346 | static int da7210_spi_remove(struct spi_device *spi) |
1363 | { | 1347 | { |
1364 | struct da7210_priv *da7210 = spi_get_drvdata(spi); | ||
1365 | snd_soc_unregister_codec(&spi->dev); | 1348 | snd_soc_unregister_codec(&spi->dev); |
1366 | regmap_exit(da7210->regmap); | ||
1367 | return 0; | 1349 | return 0; |
1368 | } | 1350 | } |
1369 | 1351 | ||
@@ -1373,7 +1355,7 @@ static struct spi_driver da7210_spi_driver = { | |||
1373 | .owner = THIS_MODULE, | 1355 | .owner = THIS_MODULE, |
1374 | }, | 1356 | }, |
1375 | .probe = da7210_spi_probe, | 1357 | .probe = da7210_spi_probe, |
1376 | .remove = __devexit_p(da7210_spi_remove) | 1358 | .remove = da7210_spi_remove |
1377 | }; | 1359 | }; |
1378 | #endif | 1360 | #endif |
1379 | 1361 | ||