diff options
Diffstat (limited to 'sound/soc/codecs/88pm860x-codec.c')
-rw-r--r-- | sound/soc/codecs/88pm860x-codec.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 5ca122e51183..9fd3b6827bba 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -861,7 +861,7 @@ static const struct snd_soc_dapm_widget pm860x_dapm_widgets[] = { PM860X_DAPM_OUTPUT("RSYNC", pm860x_rsync_event), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route pm860x_dapm_routes[] = { /* supply */ {"Left DAC", NULL, "VCODEC"}, {"Right DAC", NULL, "VCODEC"}, @@ -1198,14 +1198,14 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, return 0; } -static struct snd_soc_dai_ops pm860x_pcm_dai_ops = { +static const struct snd_soc_dai_ops pm860x_pcm_dai_ops = { .digital_mute = pm860x_digital_mute, .hw_params = pm860x_pcm_hw_params, .set_fmt = pm860x_pcm_set_dai_fmt, .set_sysclk = pm860x_set_dai_sysclk, }; -static struct snd_soc_dai_ops pm860x_i2s_dai_ops = { +static const struct snd_soc_dai_ops pm860x_i2s_dai_ops = { .digital_mute = pm860x_digital_mute, .hw_params = pm860x_i2s_hw_params, .set_fmt = pm860x_i2s_set_dai_fmt, @@ -1361,7 +1361,6 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect); static int pm860x_probe(struct snd_soc_codec *codec) { struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = &codec->dapm; int i, ret; pm860x->codec = codec; @@ -1388,11 +1387,6 @@ static int pm860x_probe(struct snd_soc_codec *codec) goto out; } - snd_soc_add_controls(codec, pm860x_snd_controls, - ARRAY_SIZE(pm860x_snd_controls)); - snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets, - ARRAY_SIZE(pm860x_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); return 0; out: @@ -1420,6 +1414,13 @@ static struct snd_soc_codec_driver soc_codec_dev_pm860x = { .reg_cache_size = REG_CACHE_SIZE, .reg_word_size = sizeof(u8), .set_bias_level = pm860x_set_bias_level, + + .controls = pm860x_snd_controls, + .num_controls = ARRAY_SIZE(pm860x_snd_controls), + .dapm_widgets = pm860x_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(pm860x_dapm_widgets), + .dapm_routes = pm860x_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes), }; static int __devinit pm860x_codec_probe(struct platform_device *pdev) @@ -1429,7 +1430,8 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev) struct resource *res; int i, ret; - pm860x = kzalloc(sizeof(struct pm860x_priv), GFP_KERNEL); + pm860x = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_priv), + GFP_KERNEL); if (pm860x == NULL) return -ENOMEM; @@ -1458,17 +1460,13 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev) out: platform_set_drvdata(pdev, NULL); - kfree(pm860x); return -EINVAL; } static int __devexit pm860x_codec_remove(struct platform_device *pdev) { - struct pm860x_priv *pm860x = platform_get_drvdata(pdev); - snd_soc_unregister_codec(&pdev->dev); platform_set_drvdata(pdev, NULL); - kfree(pm860x); return 0; } @@ -1481,17 +1479,7 @@ static struct platform_driver pm860x_codec_driver = { .remove = __devexit_p(pm860x_codec_remove), }; -static __init int pm860x_init(void) -{ - return platform_driver_register(&pm860x_codec_driver); -} -module_init(pm860x_init); - -static __exit void pm860x_exit(void) -{ - platform_driver_unregister(&pm860x_codec_driver); -} -module_exit(pm860x_exit); +module_platform_driver(pm860x_codec_driver); MODULE_DESCRIPTION("ASoC 88PM860x driver"); MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); |