From 48dcf1d82fd8158ac8a9b843abb4965c69a19781 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Fri, 3 May 2013 14:39:21 +0530 Subject: ASoC: mid-x86: Remove redundant platform_set_drvdata() Commit 0998d06310 (device-core: Ensure drvdata = NULL when no driver is bound) removes the need to set driver data field to NULL. Signed-off-by: Sachin Kamat Signed-off-by: Mark Brown --- sound/soc/mid-x86/mfld_machine.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index 4139116c33b..78d58251989 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -425,7 +425,6 @@ static int snd_mfld_mc_remove(struct platform_device *pdev) free_irq(platform_get_irq(pdev, 0), mc_drv_ctx); snd_soc_unregister_card(&snd_soc_card_mfld); kfree(mc_drv_ctx); - platform_set_drvdata(pdev, NULL); return 0; } -- cgit v1.2.3-18-g5258 From de693006c9c813171e8d3124ee6afe4318cb9915 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Tue, 25 Jun 2013 10:16:56 +0800 Subject: ASoC: mid-x86: Convert to use devm_* APIs devm_* APIs are device managed and make code simpler. Signed-off-by: Wei Yongjun Signed-off-by: Mark Brown --- sound/soc/mid-x86/mfld_machine.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index 78d58251989..aec29a80535 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -371,7 +371,7 @@ static int snd_mfld_mc_probe(struct platform_device *pdev) /* audio interrupt base of SRAM location where * interrupts are stored by System FW */ - mc_drv_ctx = kzalloc(sizeof(*mc_drv_ctx), GFP_ATOMIC); + mc_drv_ctx = devm_kzalloc(&pdev->dev, sizeof(*mc_drv_ctx), GFP_ATOMIC); if (!mc_drv_ctx) { pr_err("allocation failed\n"); return -ENOMEM; @@ -381,40 +381,33 @@ static int snd_mfld_mc_probe(struct platform_device *pdev) pdev, IORESOURCE_MEM, "IRQ_BASE"); if (!irq_mem) { pr_err("no mem resource given\n"); - ret_val = -ENODEV; - goto unalloc; + return -ENODEV; } - mc_drv_ctx->int_base = ioremap_nocache(irq_mem->start, - resource_size(irq_mem)); + mc_drv_ctx->int_base = devm_ioremap_nocache(&pdev->dev, irq_mem->start, + resource_size(irq_mem)); if (!mc_drv_ctx->int_base) { pr_err("Mapping of cache failed\n"); - ret_val = -ENOMEM; - goto unalloc; + return -ENOMEM; } /* register for interrupt */ - ret_val = request_threaded_irq(irq, snd_mfld_jack_intr_handler, + ret_val = devm_request_threaded_irq(&pdev->dev, irq, + snd_mfld_jack_intr_handler, snd_mfld_jack_detection, IRQF_SHARED, pdev->dev.driver->name, mc_drv_ctx); if (ret_val) { pr_err("cannot register IRQ\n"); - goto unalloc; + return ret_val; } /* register the soc card */ snd_soc_card_mfld.dev = &pdev->dev; ret_val = snd_soc_register_card(&snd_soc_card_mfld); if (ret_val) { pr_debug("snd_soc_register_card failed %d\n", ret_val); - goto freeirq; + return ret_val; } platform_set_drvdata(pdev, mc_drv_ctx); pr_debug("successfully exited probe\n"); - return ret_val; - -freeirq: - free_irq(irq, mc_drv_ctx); -unalloc: - kfree(mc_drv_ctx); - return ret_val; + return 0; } static int snd_mfld_mc_remove(struct platform_device *pdev) @@ -422,9 +415,7 @@ static int snd_mfld_mc_remove(struct platform_device *pdev) struct mfld_mc_private *mc_drv_ctx = platform_get_drvdata(pdev); pr_debug("snd_mfld_mc_remove called\n"); - free_irq(platform_get_irq(pdev, 0), mc_drv_ctx); snd_soc_unregister_card(&snd_soc_card_mfld); - kfree(mc_drv_ctx); return 0; } -- cgit v1.2.3-18-g5258 From 6c50e9147ff03996417e24a11e31831d245b52f0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 28 Jun 2013 10:57:26 +0100 Subject: ASoC: mfld: Remove unused variable Reported-by: Fengguang Wu Signed-off-by: Mark Brown --- sound/soc/mid-x86/mfld_machine.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index aec29a80535..ee363845759 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -412,8 +412,6 @@ static int snd_mfld_mc_probe(struct platform_device *pdev) static int snd_mfld_mc_remove(struct platform_device *pdev) { - struct mfld_mc_private *mc_drv_ctx = platform_get_drvdata(pdev); - pr_debug("snd_mfld_mc_remove called\n"); snd_soc_unregister_card(&snd_soc_card_mfld); return 0; -- cgit v1.2.3-18-g5258