From: Axel Lin Date: Wed, 28 Dec 2011 12:32:42 +0000 (+0800) Subject: ASoC: Convert kirkwood-openrd to use snd_soc_register_card() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6d6761aa9b36e2da18669b9948ee6849064a84e9;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ASoC: Convert kirkwood-openrd to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c index 01f8c8992880..7e99c3f340fc 100644 --- a/arch/arm/mach-kirkwood/openrd-setup.c +++ b/arch/arm/mach-kirkwood/openrd-setup.c @@ -83,6 +83,11 @@ static struct i2c_board_info i2c_board_info[] __initdata = { }, }; +static struct platform_device openrd_client_audio_device = { + .name = "openrd-client-audio", + .id = -1, +}; + static int __initdata uart1; static int __init sd_uart_selection(char *str) @@ -172,6 +177,7 @@ static void __init openrd_init(void) kirkwood_i2c_init(); if (machine_is_openrd_client() || machine_is_openrd_ultimate()) { + platform_device_register(&openrd_client_audio_device); i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info)); kirkwood_audio_init(); diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c index 55d2ed3df30d..80bd59c33be4 100644 --- a/sound/soc/kirkwood/kirkwood-openrd.c +++ b/sound/soc/kirkwood/kirkwood-openrd.c @@ -71,41 +71,41 @@ static struct snd_soc_card openrd_client = { .num_links = ARRAY_SIZE(openrd_client_dai), }; -static struct platform_device *openrd_client_snd_device; - -static int __init openrd_client_init(void) +static int __devinit openrd_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &openrd_client; int ret; - if (!machine_is_openrd_client() && !machine_is_openrd_ultimate()) - return 0; - - openrd_client_snd_device = platform_device_alloc("soc-audio", -1); - if (!openrd_client_snd_device) - return -ENOMEM; - - platform_set_drvdata(openrd_client_snd_device, - &openrd_client); - - ret = platform_device_add(openrd_client_snd_device); - if (ret) { - printk(KERN_ERR "%s: platform_device_add failed\n", __func__); - platform_device_put(openrd_client_snd_device); - } + card->dev = &pdev->dev; + ret = snd_soc_register_card(card); + if (ret) + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } -static void __exit openrd_client_exit(void) +static int __devexit openrd_remove(struct platform_device *pdev) { - platform_device_unregister(openrd_client_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + return 0; } -module_init(openrd_client_init); -module_exit(openrd_client_exit); +static struct platform_driver openrd_driver = { + .driver = { + .name = "openrd-client-audio", + .owner = THIS_MODULE, + }, + .probe = openrd_probe, + .remove = __devexit_p(openrd_remove), +}; + +module_platform_driver(openrd_driver); /* Module information */ MODULE_AUTHOR("Arnaud Patard "); MODULE_DESCRIPTION("ALSA SoC OpenRD Client"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:soc-audio"); +MODULE_ALIAS("platform:openrd-client-audio");