From patchwork Thu Sep 13 21:43:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5/7] ASoC: fsl: convert pcm030-audio-fabric to a platform-driver Date: Thu, 13 Sep 2012 11:43:14 -0000 From: Eric Millbrandt X-Patchwork-Id: 183745 Message-Id: <1347572596-37540-6-git-send-email-emillbrandt@dekaresearch.com> To: Grant Likely , Liam Girdwood , Mark Brown , Anatolij Gustschin Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, Eric Millbrandt This patch converts the pcm030-audio-fabric driver to a platform-driver and adds a remove function. Signed-off-by: Eric Millbrandt diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index 1353e8f..5c8e2d6 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c @@ -48,7 +48,7 @@ static struct snd_soc_card card = { .num_links = ARRAY_SIZE(pcm030_fabric_dai), }; -static __init int pcm030_fabric_init(void) +static int __init pcm030_fabric_probe(struct platform_device *op) { struct platform_device *pdev; int rc; @@ -62,6 +62,7 @@ static __init int pcm030_fabric_init(void) return -ENODEV; } + platform_set_drvdata(op, pdev); platform_set_drvdata(pdev, &card); rc = platform_device_add(pdev); @@ -73,7 +74,32 @@ static __init int pcm030_fabric_init(void) return 0; } -module_init(pcm030_fabric_init); +static int __devexit pcm030_fabric_remove(struct platform_device *op) +{ + struct platform_device *pdev = platform_get_drvdata(op); + + platform_device_unregister(pdev); + + return 0; +} + +static struct of_device_id pcm030_audio_match[] = { + { .compatible = "phytec,pcm030-audio-fabric", }, + {} +}; +MODULE_DEVICE_TABLE(of, pcm030_audio_match); + +static struct platform_driver pcm030_fabric_driver = { + .probe = pcm030_fabric_probe, + .remove = __devexit_p(pcm030_fabric_remove), + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + .of_match_table = pcm030_audio_match, + }, +}; + +module_platform_driver(pcm030_fabric_driver); MODULE_AUTHOR("Jon Smirl ");