ASoC: WM8903 only supports I2C so don't ifdef it
[deliverable/linux.git] / sound / soc / codecs / wm8903.c
index 70a2268c5498c31f62cd3d30e5ed07dc2dcff29b..745681258eda5afaadf15c9aa038152debb8b20a 100644 (file)
@@ -1758,7 +1758,7 @@ static struct snd_soc_dai_driver wm8903_dai = {
        .symmetric_rates = 1,
 };
 
-static int wm8903_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int wm8903_suspend(struct snd_soc_codec *codec)
 {
        wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF);
 
@@ -1936,11 +1936,11 @@ static int wm8903_probe(struct snd_soc_codec *codec)
                bool mic_gpio = false;
 
                for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) {
-                       if (pdata->gpio_cfg[i] == WM8903_GPIO_NO_CONFIG)
+                       if (pdata->gpio_cfg[i] > 0x7fff)
                                continue;
 
                        snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i,
-                                     pdata->gpio_cfg[i] & 0xffff);
+                                     pdata->gpio_cfg[i] & 0x7fff);
 
                        val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK)
                                >> WM8903_GP1_FN_SHIFT;
@@ -2034,9 +2034,6 @@ static int wm8903_probe(struct snd_soc_codec *codec)
                            WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE,
                            WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE);
 
-       snd_soc_add_controls(codec, wm8903_snd_controls,
-                               ARRAY_SIZE(wm8903_snd_controls));
-
        wm8903_init_gpio(codec);
 
        return ret;
@@ -2066,20 +2063,22 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8903 = {
        .reg_cache_default = wm8903_reg_defaults,
        .volatile_register = wm8903_volatile_register,
        .seq_notifier = wm8903_seq_notifier,
+       .controls = wm8903_snd_controls,
+       .num_controls = ARRAY_SIZE(wm8903_snd_controls),
        .dapm_widgets = wm8903_dapm_widgets,
        .num_dapm_widgets = ARRAY_SIZE(wm8903_dapm_widgets),
        .dapm_routes = wm8903_intercon,
        .num_dapm_routes = ARRAY_SIZE(wm8903_intercon),
 };
 
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
 static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
                                      const struct i2c_device_id *id)
 {
        struct wm8903_priv *wm8903;
        int ret;
 
-       wm8903 = kzalloc(sizeof(struct wm8903_priv), GFP_KERNEL);
+       wm8903 = devm_kzalloc(&i2c->dev,  sizeof(struct wm8903_priv),
+                             GFP_KERNEL);
        if (wm8903 == NULL)
                return -ENOMEM;
 
@@ -2088,15 +2087,13 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
 
        ret = snd_soc_register_codec(&i2c->dev,
                        &soc_codec_dev_wm8903, &wm8903_dai, 1);
-       if (ret < 0)
-               kfree(wm8903);
+
        return ret;
 }
 
 static __devexit int wm8903_i2c_remove(struct i2c_client *client)
 {
        snd_soc_unregister_codec(&client->dev);
-       kfree(i2c_get_clientdata(client));
        return 0;
 }
 
@@ -2115,27 +2112,22 @@ static struct i2c_driver wm8903_i2c_driver = {
        .remove =   __devexit_p(wm8903_i2c_remove),
        .id_table = wm8903_i2c_id,
 };
-#endif
 
 static int __init wm8903_modinit(void)
 {
        int ret = 0;
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
        ret = i2c_add_driver(&wm8903_i2c_driver);
        if (ret != 0) {
                printk(KERN_ERR "Failed to register wm8903 I2C driver: %d\n",
                       ret);
        }
-#endif
        return ret;
 }
 module_init(wm8903_modinit);
 
 static void __exit wm8903_exit(void)
 {
-#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
        i2c_del_driver(&wm8903_i2c_driver);
-#endif
 }
 module_exit(wm8903_exit);
 
This page took 0.025958 seconds and 5 git commands to generate.