ASoC: alc5632: Convert to devm_regmap_init_i2c()
authorAxel Lin <axel.lin@gmail.com>
Tue, 8 May 2012 15:44:55 +0000 (23:44 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 8 May 2012 17:46:31 +0000 (18:46 +0100)
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/alc5632.c

index b29a53be75a74c7587f47900f40a734d12ed5043..7dd02420b36d3976f21b86ac8e50f0af0372a36f 100644 (file)
@@ -1130,7 +1130,7 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client,
 
        i2c_set_clientdata(client, alc5632);
 
-       alc5632->regmap = regmap_init_i2c(client, &alc5632_regmap);
+       alc5632->regmap = devm_regmap_init_i2c(client, &alc5632_regmap);
        if (IS_ERR(alc5632->regmap)) {
                ret = PTR_ERR(alc5632->regmap);
                dev_err(&client->dev, "regmap_init() failed: %d\n", ret);
@@ -1142,7 +1142,6 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client,
        if (ret1 != 0 || ret2 != 0) {
                dev_err(&client->dev,
                "Failed to read chip ID: ret1=%d, ret2=%d\n", ret1, ret2);
-               regmap_exit(alc5632->regmap);
                return -EIO;
        }
 
@@ -1151,14 +1150,12 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client,
        if ((vid1 != 0x10EC) || (vid2 != id->driver_data)) {
                dev_err(&client->dev,
                "Device is not a ALC5632: VID1=0x%x, VID2=0x%x\n", vid1, vid2);
-               regmap_exit(alc5632->regmap);
                return -EINVAL;
        }
 
        ret = alc5632_reset(alc5632->regmap);
        if (ret < 0) {
                dev_err(&client->dev, "Failed to issue reset\n");
-               regmap_exit(alc5632->regmap);
                return ret;
        }
 
@@ -1176,7 +1173,6 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client,
 
        if (ret < 0) {
                dev_err(&client->dev, "Failed to register codec: %d\n", ret);
-               regmap_exit(alc5632->regmap);
                return ret;
        }
 
@@ -1185,9 +1181,7 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client,
 
 static __devexit int alc5632_i2c_remove(struct i2c_client *client)
 {
-       struct alc5632_priv *alc5632 = i2c_get_clientdata(client);
        snd_soc_unregister_codec(&client->dev);
-       regmap_exit(alc5632->regmap);
        return 0;
 }