]> Pileus Git - ~andy/linux/blobdiff - sound/soc/codecs/sta32x.c
Merge branch 'topic/misc' into for-linus
[~andy/linux] / sound / soc / codecs / sta32x.c
index 3b0deafd766b35bcf2727eec27fd818d94b3f59e..7db6fa515028d566cfd75c5ee048db8b52f2ca54 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/delay.h>
 #include <linux/pm.h>
 #include <linux/i2c.h>
-#include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
@@ -265,7 +264,7 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,
        return 0;
 }
 
-int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)
+static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)
 {
        struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
        unsigned int cfud;
@@ -290,7 +289,7 @@ int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)
        return 0;
 }
 
-int sta32x_cache_sync(struct snd_soc_codec *codec)
+static int sta32x_cache_sync(struct snd_soc_codec *codec)
 {
        unsigned int mute;
        int rc;
@@ -523,6 +522,7 @@ static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
                                                rate_min = fs;
                                        if (fs > rate_max)
                                                rate_max = fs;
+                                       break;
                                }
                        }
                }
@@ -783,7 +783,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec,
        return 0;
 }
 
-static struct snd_soc_dai_ops sta32x_dai_ops = {
+static const struct snd_soc_dai_ops sta32x_dai_ops = {
        .hw_params      = sta32x_hw_params,
        .set_sysclk     = sta32x_set_dai_sysclk,
        .set_fmt        = sta32x_set_dai_fmt,
@@ -802,7 +802,7 @@ static struct snd_soc_dai_driver sta32x_dai = {
 };
 
 #ifdef CONFIG_PM
-static int sta32x_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int sta32x_suspend(struct snd_soc_codec *codec)
 {
        sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
        return 0;
@@ -969,28 +969,23 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
        struct sta32x_priv *sta32x;
        int ret;
 
-       sta32x = kzalloc(sizeof(struct sta32x_priv), GFP_KERNEL);
+       sta32x = devm_kzalloc(&i2c->dev, sizeof(struct sta32x_priv),
+                             GFP_KERNEL);
        if (!sta32x)
                return -ENOMEM;
 
        i2c_set_clientdata(i2c, sta32x);
 
        ret = snd_soc_register_codec(&i2c->dev, &sta32x_codec, &sta32x_dai, 1);
-       if (ret != 0) {
+       if (ret != 0)
                dev_err(&i2c->dev, "Failed to register codec (%d)\n", ret);
-               kfree(sta32x);
-               return ret;
-       }
 
-       return 0;
+       return ret;
 }
 
 static __devexit int sta32x_i2c_remove(struct i2c_client *client)
 {
-       struct sta32x_priv *sta32x = i2c_get_clientdata(client);
-
        snd_soc_unregister_codec(&client->dev);
-       kfree(sta32x);
        return 0;
 }