aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8940.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8940.c')
-rw-r--r--sound/soc/codecs/wm8940.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 14039ea2f3e4..d2883affea3b 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -717,7 +717,7 @@ static int wm8940_probe(struct snd_soc_codec *codec)
717 return ret; 717 return ret;
718 } 718 }
719 719
720 ret = snd_soc_add_controls(codec, wm8940_snd_controls, 720 ret = snd_soc_add_codec_controls(codec, wm8940_snd_controls,
721 ARRAY_SIZE(wm8940_snd_controls)); 721 ARRAY_SIZE(wm8940_snd_controls));
722 if (ret) 722 if (ret)
723 return ret; 723 return ret;
@@ -743,14 +743,14 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8940 = {
743 .volatile_register = wm8940_volatile_register, 743 .volatile_register = wm8940_volatile_register,
744}; 744};
745 745
746#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
747static __devinit int wm8940_i2c_probe(struct i2c_client *i2c, 746static __devinit int wm8940_i2c_probe(struct i2c_client *i2c,
748 const struct i2c_device_id *id) 747 const struct i2c_device_id *id)
749{ 748{
750 struct wm8940_priv *wm8940; 749 struct wm8940_priv *wm8940;
751 int ret; 750 int ret;
752 751
753 wm8940 = kzalloc(sizeof(struct wm8940_priv), GFP_KERNEL); 752 wm8940 = devm_kzalloc(&i2c->dev, sizeof(struct wm8940_priv),
753 GFP_KERNEL);
754 if (wm8940 == NULL) 754 if (wm8940 == NULL)
755 return -ENOMEM; 755 return -ENOMEM;
756 756
@@ -759,15 +759,14 @@ static __devinit int wm8940_i2c_probe(struct i2c_client *i2c,
759 759
760 ret = snd_soc_register_codec(&i2c->dev, 760 ret = snd_soc_register_codec(&i2c->dev,
761 &soc_codec_dev_wm8940, &wm8940_dai, 1); 761 &soc_codec_dev_wm8940, &wm8940_dai, 1);
762 if (ret < 0) 762
763 kfree(wm8940);
764 return ret; 763 return ret;
765} 764}
766 765
767static __devexit int wm8940_i2c_remove(struct i2c_client *client) 766static __devexit int wm8940_i2c_remove(struct i2c_client *client)
768{ 767{
769 snd_soc_unregister_codec(&client->dev); 768 snd_soc_unregister_codec(&client->dev);
770 kfree(i2c_get_clientdata(client)); 769
771 return 0; 770 return 0;
772} 771}
773 772
@@ -786,27 +785,22 @@ static struct i2c_driver wm8940_i2c_driver = {
786 .remove = __devexit_p(wm8940_i2c_remove), 785 .remove = __devexit_p(wm8940_i2c_remove),
787 .id_table = wm8940_i2c_id, 786 .id_table = wm8940_i2c_id,
788}; 787};
789#endif
790 788
791static int __init wm8940_modinit(void) 789static int __init wm8940_modinit(void)
792{ 790{
793 int ret = 0; 791 int ret = 0;
794#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
795 ret = i2c_add_driver(&wm8940_i2c_driver); 792 ret = i2c_add_driver(&wm8940_i2c_driver);
796 if (ret != 0) { 793 if (ret != 0) {
797 printk(KERN_ERR "Failed to register wm8940 I2C driver: %d\n", 794 printk(KERN_ERR "Failed to register wm8940 I2C driver: %d\n",
798 ret); 795 ret);
799 } 796 }
800#endif
801 return ret; 797 return ret;
802} 798}
803module_init(wm8940_modinit); 799module_init(wm8940_modinit);
804 800
805static void __exit wm8940_exit(void) 801static void __exit wm8940_exit(void)
806{ 802{
807#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
808 i2c_del_driver(&wm8940_i2c_driver); 803 i2c_del_driver(&wm8940_i2c_driver);
809#endif
810} 804}
811module_exit(wm8940_exit); 805module_exit(wm8940_exit);
812 806