wm8988.c (dd21353f35082fa77d1c8672fffebf324954eb09) | wm8988.c (82fa3670575143031517531936b1cc308d4981fa) |
---|---|
1/* 2 * wm8988.c -- WM8988 ALSA SoC audio driver 3 * 4 * Copyright 2009 Wolfson Microelectronics plc 5 * Copyright 2005 Openedhand Ltd. 6 * 7 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 8 * --- 785 unchanged lines hidden (view full) --- 794}; 795 796#if defined(CONFIG_SPI_MASTER) 797static int __devinit wm8988_spi_probe(struct spi_device *spi) 798{ 799 struct wm8988_priv *wm8988; 800 int ret; 801 | 1/* 2 * wm8988.c -- WM8988 ALSA SoC audio driver 3 * 4 * Copyright 2009 Wolfson Microelectronics plc 5 * Copyright 2005 Openedhand Ltd. 6 * 7 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 8 * --- 785 unchanged lines hidden (view full) --- 794}; 795 796#if defined(CONFIG_SPI_MASTER) 797static int __devinit wm8988_spi_probe(struct spi_device *spi) 798{ 799 struct wm8988_priv *wm8988; 800 int ret; 801 |
802 wm8988 = kzalloc(sizeof(struct wm8988_priv), GFP_KERNEL); | 802 wm8988 = devm_kzalloc(&spi->dev, sizeof(struct wm8988_priv), 803 GFP_KERNEL); |
803 if (wm8988 == NULL) 804 return -ENOMEM; 805 806 wm8988->control_type = SND_SOC_SPI; 807 spi_set_drvdata(spi, wm8988); 808 809 ret = snd_soc_register_codec(&spi->dev, 810 &soc_codec_dev_wm8988, &wm8988_dai, 1); | 804 if (wm8988 == NULL) 805 return -ENOMEM; 806 807 wm8988->control_type = SND_SOC_SPI; 808 spi_set_drvdata(spi, wm8988); 809 810 ret = snd_soc_register_codec(&spi->dev, 811 &soc_codec_dev_wm8988, &wm8988_dai, 1); |
811 if (ret < 0) 812 kfree(wm8988); | 812 |
813 return ret; 814} 815 816static int __devexit wm8988_spi_remove(struct spi_device *spi) 817{ 818 snd_soc_unregister_codec(&spi->dev); | 813 return ret; 814} 815 816static int __devexit wm8988_spi_remove(struct spi_device *spi) 817{ 818 snd_soc_unregister_codec(&spi->dev); |
819 kfree(spi_get_drvdata(spi)); | |
820 return 0; 821} 822 823static struct spi_driver wm8988_spi_driver = { 824 .driver = { 825 .name = "wm8988", 826 .owner = THIS_MODULE, 827 }, --- 4 unchanged lines hidden (view full) --- 832 833#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 834static __devinit int wm8988_i2c_probe(struct i2c_client *i2c, 835 const struct i2c_device_id *id) 836{ 837 struct wm8988_priv *wm8988; 838 int ret; 839 | 819 return 0; 820} 821 822static struct spi_driver wm8988_spi_driver = { 823 .driver = { 824 .name = "wm8988", 825 .owner = THIS_MODULE, 826 }, --- 4 unchanged lines hidden (view full) --- 831 832#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 833static __devinit int wm8988_i2c_probe(struct i2c_client *i2c, 834 const struct i2c_device_id *id) 835{ 836 struct wm8988_priv *wm8988; 837 int ret; 838 |
840 wm8988 = kzalloc(sizeof(struct wm8988_priv), GFP_KERNEL); | 839 wm8988 = devm_kzalloc(&i2c->dev, sizeof(struct wm8988_priv), 840 GFP_KERNEL); |
841 if (wm8988 == NULL) 842 return -ENOMEM; 843 844 i2c_set_clientdata(i2c, wm8988); 845 wm8988->control_type = SND_SOC_I2C; 846 847 ret = snd_soc_register_codec(&i2c->dev, 848 &soc_codec_dev_wm8988, &wm8988_dai, 1); | 841 if (wm8988 == NULL) 842 return -ENOMEM; 843 844 i2c_set_clientdata(i2c, wm8988); 845 wm8988->control_type = SND_SOC_I2C; 846 847 ret = snd_soc_register_codec(&i2c->dev, 848 &soc_codec_dev_wm8988, &wm8988_dai, 1); |
849 if (ret < 0) 850 kfree(wm8988); | |
851 return ret; 852} 853 854static __devexit int wm8988_i2c_remove(struct i2c_client *client) 855{ 856 snd_soc_unregister_codec(&client->dev); | 849 return ret; 850} 851 852static __devexit int wm8988_i2c_remove(struct i2c_client *client) 853{ 854 snd_soc_unregister_codec(&client->dev); |
857 kfree(i2c_get_clientdata(client)); | |
858 return 0; 859} 860 861static const struct i2c_device_id wm8988_i2c_id[] = { 862 { "wm8988", 0 }, 863 { } 864}; 865MODULE_DEVICE_TABLE(i2c, wm8988_i2c_id); --- 48 unchanged lines hidden --- | 855 return 0; 856} 857 858static const struct i2c_device_id wm8988_i2c_id[] = { 859 { "wm8988", 0 }, 860 { } 861}; 862MODULE_DEVICE_TABLE(i2c, wm8988_i2c_id); --- 48 unchanged lines hidden --- |