diff options
Diffstat (limited to 'sound/soc/codecs/ssm2602.c')
-rw-r--r-- | sound/soc/codecs/ssm2602.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 3cb3271c5fe2..333dd98af39c 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/pm.h> | 33 | #include <linux/pm.h> |
34 | #include <linux/i2c.h> | 34 | #include <linux/i2c.h> |
35 | #include <linux/spi/spi.h> | 35 | #include <linux/spi/spi.h> |
36 | #include <linux/platform_device.h> | ||
37 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
38 | #include <sound/core.h> | 37 | #include <sound/core.h> |
39 | #include <sound/pcm.h> | 38 | #include <sound/pcm.h> |
@@ -498,7 +497,7 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec, | |||
498 | #define SSM2602_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ | 497 | #define SSM2602_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
499 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) | 498 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) |
500 | 499 | ||
501 | static struct snd_soc_dai_ops ssm2602_dai_ops = { | 500 | static const struct snd_soc_dai_ops ssm2602_dai_ops = { |
502 | .startup = ssm2602_startup, | 501 | .startup = ssm2602_startup, |
503 | .hw_params = ssm2602_hw_params, | 502 | .hw_params = ssm2602_hw_params, |
504 | .shutdown = ssm2602_shutdown, | 503 | .shutdown = ssm2602_shutdown, |
@@ -524,7 +523,7 @@ static struct snd_soc_dai_driver ssm2602_dai = { | |||
524 | .ops = &ssm2602_dai_ops, | 523 | .ops = &ssm2602_dai_ops, |
525 | }; | 524 | }; |
526 | 525 | ||
527 | static int ssm2602_suspend(struct snd_soc_codec *codec, pm_message_t state) | 526 | static int ssm2602_suspend(struct snd_soc_codec *codec) |
528 | { | 527 | { |
529 | ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF); | 528 | ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF); |
530 | return 0; | 529 | return 0; |
@@ -653,7 +652,8 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi) | |||
653 | struct ssm2602_priv *ssm2602; | 652 | struct ssm2602_priv *ssm2602; |
654 | int ret; | 653 | int ret; |
655 | 654 | ||
656 | ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); | 655 | ssm2602 = devm_kzalloc(&spi->dev, sizeof(struct ssm2602_priv), |
656 | GFP_KERNEL); | ||
657 | if (ssm2602 == NULL) | 657 | if (ssm2602 == NULL) |
658 | return -ENOMEM; | 658 | return -ENOMEM; |
659 | 659 | ||
@@ -663,15 +663,12 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi) | |||
663 | 663 | ||
664 | ret = snd_soc_register_codec(&spi->dev, | 664 | ret = snd_soc_register_codec(&spi->dev, |
665 | &soc_codec_dev_ssm2602, &ssm2602_dai, 1); | 665 | &soc_codec_dev_ssm2602, &ssm2602_dai, 1); |
666 | if (ret < 0) | ||
667 | kfree(ssm2602); | ||
668 | return ret; | 666 | return ret; |
669 | } | 667 | } |
670 | 668 | ||
671 | static int __devexit ssm2602_spi_remove(struct spi_device *spi) | 669 | static int __devexit ssm2602_spi_remove(struct spi_device *spi) |
672 | { | 670 | { |
673 | snd_soc_unregister_codec(&spi->dev); | 671 | snd_soc_unregister_codec(&spi->dev); |
674 | kfree(spi_get_drvdata(spi)); | ||
675 | return 0; | 672 | return 0; |
676 | } | 673 | } |
677 | 674 | ||
@@ -698,7 +695,8 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c, | |||
698 | struct ssm2602_priv *ssm2602; | 695 | struct ssm2602_priv *ssm2602; |
699 | int ret; | 696 | int ret; |
700 | 697 | ||
701 | ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); | 698 | ssm2602 = devm_kzalloc(&i2c->dev, sizeof(struct ssm2602_priv), |
699 | GFP_KERNEL); | ||
702 | if (ssm2602 == NULL) | 700 | if (ssm2602 == NULL) |
703 | return -ENOMEM; | 701 | return -ENOMEM; |
704 | 702 | ||
@@ -708,15 +706,12 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c, | |||
708 | 706 | ||
709 | ret = snd_soc_register_codec(&i2c->dev, | 707 | ret = snd_soc_register_codec(&i2c->dev, |
710 | &soc_codec_dev_ssm2602, &ssm2602_dai, 1); | 708 | &soc_codec_dev_ssm2602, &ssm2602_dai, 1); |
711 | if (ret < 0) | ||
712 | kfree(ssm2602); | ||
713 | return ret; | 709 | return ret; |
714 | } | 710 | } |
715 | 711 | ||
716 | static int __devexit ssm2602_i2c_remove(struct i2c_client *client) | 712 | static int __devexit ssm2602_i2c_remove(struct i2c_client *client) |
717 | { | 713 | { |
718 | snd_soc_unregister_codec(&client->dev); | 714 | snd_soc_unregister_codec(&client->dev); |
719 | kfree(i2c_get_clientdata(client)); | ||
720 | return 0; | 715 | return 0; |
721 | } | 716 | } |
722 | 717 | ||