aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8978.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8978.c')
-rw-r--r--sound/soc/codecs/wm8978.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 8c1dac946f62..f347af3a67c2 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -1035,8 +1035,8 @@ static const struct regmap_config wm8978_regmap_config = {
1035 .num_reg_defaults = ARRAY_SIZE(wm8978_reg_defaults), 1035 .num_reg_defaults = ARRAY_SIZE(wm8978_reg_defaults),
1036}; 1036};
1037 1037
1038static __devinit int wm8978_i2c_probe(struct i2c_client *i2c, 1038static int wm8978_i2c_probe(struct i2c_client *i2c,
1039 const struct i2c_device_id *id) 1039 const struct i2c_device_id *id)
1040{ 1040{
1041 struct wm8978_priv *wm8978; 1041 struct wm8978_priv *wm8978;
1042 int ret; 1042 int ret;
@@ -1046,7 +1046,7 @@ static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,
1046 if (wm8978 == NULL) 1046 if (wm8978 == NULL)
1047 return -ENOMEM; 1047 return -ENOMEM;
1048 1048
1049 wm8978->regmap = regmap_init_i2c(i2c, &wm8978_regmap_config); 1049 wm8978->regmap = devm_regmap_init_i2c(i2c, &wm8978_regmap_config);
1050 if (IS_ERR(wm8978->regmap)) { 1050 if (IS_ERR(wm8978->regmap)) {
1051 ret = PTR_ERR(wm8978->regmap); 1051 ret = PTR_ERR(wm8978->regmap);
1052 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); 1052 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -1059,29 +1059,22 @@ static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,
1059 ret = regmap_write(wm8978->regmap, WM8978_RESET, 0); 1059 ret = regmap_write(wm8978->regmap, WM8978_RESET, 0);
1060 if (ret != 0) { 1060 if (ret != 0) {
1061 dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret); 1061 dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret);
1062 goto err; 1062 return ret;
1063 } 1063 }
1064 1064
1065 ret = snd_soc_register_codec(&i2c->dev, 1065 ret = snd_soc_register_codec(&i2c->dev,
1066 &soc_codec_dev_wm8978, &wm8978_dai, 1); 1066 &soc_codec_dev_wm8978, &wm8978_dai, 1);
1067 if (ret != 0) { 1067 if (ret != 0) {
1068 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); 1068 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
1069 goto err; 1069 return ret;
1070 } 1070 }
1071 1071
1072 return 0; 1072 return 0;
1073
1074err:
1075 regmap_exit(wm8978->regmap);
1076 return ret;
1077} 1073}
1078 1074
1079static __devexit int wm8978_i2c_remove(struct i2c_client *client) 1075static int wm8978_i2c_remove(struct i2c_client *client)
1080{ 1076{
1081 struct wm8978_priv *wm8978 = i2c_get_clientdata(client);
1082
1083 snd_soc_unregister_codec(&client->dev); 1077 snd_soc_unregister_codec(&client->dev);
1084 regmap_exit(wm8978->regmap);
1085 1078
1086 return 0; 1079 return 0;
1087} 1080}
@@ -1098,7 +1091,7 @@ static struct i2c_driver wm8978_i2c_driver = {
1098 .owner = THIS_MODULE, 1091 .owner = THIS_MODULE,
1099 }, 1092 },
1100 .probe = wm8978_i2c_probe, 1093 .probe = wm8978_i2c_probe,
1101 .remove = __devexit_p(wm8978_i2c_remove), 1094 .remove = wm8978_i2c_remove,
1102 .id_table = wm8978_i2c_id, 1095 .id_table = wm8978_i2c_id,
1103}; 1096};
1104 1097