aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap
diff options
context:
space:
mode:
authorSebastian Reichel <sre@kernel.org>2014-04-28 10:07:21 -0400
committerMark Brown <broonie@linaro.org>2014-04-29 18:22:15 -0400
commita7d52028551b8be6eaeac93ade8fccba9783c682 (patch)
treea5978cc3a171be664b9a48caa44c2172ae9551f1 /sound/soc/omap
parentbeab3da1558a0b091fa9a6fd52755503f9c03eaf (diff)
ASoC: omap: rx51: Use devm_snd_soc_register_card
This patch converts the rx51 ASoC module to use devm_snd_soc_register_card. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/rx51.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 55713d08348d..bbe3a66e9102 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -363,10 +363,9 @@ static struct snd_soc_card rx51_sound_card = {
363 .num_dapm_routes = ARRAY_SIZE(audio_map), 363 .num_dapm_routes = ARRAY_SIZE(audio_map),
364}; 364};
365 365
366static struct platform_device *rx51_snd_device; 366static int rx51_soc_probe(struct platform_device *pdev)
367
368static int __init rx51_soc_init(void)
369{ 367{
368 struct snd_soc_card *card = &rx51_sound_card;
370 int err; 369 int err;
371 370
372 if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900")) 371 if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900"))
@@ -381,22 +380,16 @@ static int __init rx51_soc_init(void)
381 if (err) 380 if (err)
382 goto err_gpio_eci_sw; 381 goto err_gpio_eci_sw;
383 382
384 rx51_snd_device = platform_device_alloc("soc-audio", -1); 383 card->dev = &pdev->dev;
385 if (!rx51_snd_device) {
386 err = -ENOMEM;
387 goto err1;
388 }
389
390 platform_set_drvdata(rx51_snd_device, &rx51_sound_card);
391 384
392 err = platform_device_add(rx51_snd_device); 385 err = devm_snd_soc_register_card(card->dev, card);
393 if (err) 386 if (err) {
394 goto err2; 387 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", err);
388 goto err_snd;
389 }
395 390
396 return 0; 391 return 0;
397err2: 392err_snd:
398 platform_device_put(rx51_snd_device);
399err1:
400 gpio_free(RX51_ECI_SW_GPIO); 393 gpio_free(RX51_ECI_SW_GPIO);
401err_gpio_eci_sw: 394err_gpio_eci_sw:
402 gpio_free(RX51_TVOUT_SEL_GPIO); 395 gpio_free(RX51_TVOUT_SEL_GPIO);
@@ -405,18 +398,27 @@ err_gpio_tvout_sel:
405 return err; 398 return err;
406} 399}
407 400
408static void __exit rx51_soc_exit(void) 401static int rx51_soc_remove(struct platform_device *pdev)
409{ 402{
410 snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), 403 snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios),
411 rx51_av_jack_gpios); 404 rx51_av_jack_gpios);
412 405
413 platform_device_unregister(rx51_snd_device);
414 gpio_free(RX51_ECI_SW_GPIO); 406 gpio_free(RX51_ECI_SW_GPIO);
415 gpio_free(RX51_TVOUT_SEL_GPIO); 407 gpio_free(RX51_TVOUT_SEL_GPIO);
408
409 return 0;
416} 410}
417 411
418module_init(rx51_soc_init); 412static struct platform_driver rx51_soc_driver = {
419module_exit(rx51_soc_exit); 413 .driver = {
414 .name = "rx51-audio",
415 .owner = THIS_MODULE,
416 },
417 .probe = rx51_soc_probe,
418 .remove = rx51_soc_remove,
419};
420
421module_platform_driver(rx51_soc_driver);
420 422
421MODULE_AUTHOR("Nokia Corporation"); 423MODULE_AUTHOR("Nokia Corporation");
422MODULE_DESCRIPTION("ALSA SoC Nokia RX-51"); 424MODULE_DESCRIPTION("ALSA SoC Nokia RX-51");