aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/mid-x86/mfld_machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/mid-x86/mfld_machine.c')
-rw-r--r--sound/soc/mid-x86/mfld_machine.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c
index 78d582519891..ee363845759e 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)
371 371
372 /* audio interrupt base of SRAM location where 372 /* audio interrupt base of SRAM location where
373 * interrupts are stored by System FW */ 373 * interrupts are stored by System FW */
374 mc_drv_ctx = kzalloc(sizeof(*mc_drv_ctx), GFP_ATOMIC); 374 mc_drv_ctx = devm_kzalloc(&pdev->dev, sizeof(*mc_drv_ctx), GFP_ATOMIC);
375 if (!mc_drv_ctx) { 375 if (!mc_drv_ctx) {
376 pr_err("allocation failed\n"); 376 pr_err("allocation failed\n");
377 return -ENOMEM; 377 return -ENOMEM;
@@ -381,50 +381,39 @@ static int snd_mfld_mc_probe(struct platform_device *pdev)
381 pdev, IORESOURCE_MEM, "IRQ_BASE"); 381 pdev, IORESOURCE_MEM, "IRQ_BASE");
382 if (!irq_mem) { 382 if (!irq_mem) {
383 pr_err("no mem resource given\n"); 383 pr_err("no mem resource given\n");
384 ret_val = -ENODEV; 384 return -ENODEV;
385 goto unalloc;
386 } 385 }
387 mc_drv_ctx->int_base = ioremap_nocache(irq_mem->start, 386 mc_drv_ctx->int_base = devm_ioremap_nocache(&pdev->dev, irq_mem->start,
388 resource_size(irq_mem)); 387 resource_size(irq_mem));
389 if (!mc_drv_ctx->int_base) { 388 if (!mc_drv_ctx->int_base) {
390 pr_err("Mapping of cache failed\n"); 389 pr_err("Mapping of cache failed\n");
391 ret_val = -ENOMEM; 390 return -ENOMEM;
392 goto unalloc;
393 } 391 }
394 /* register for interrupt */ 392 /* register for interrupt */
395 ret_val = request_threaded_irq(irq, snd_mfld_jack_intr_handler, 393 ret_val = devm_request_threaded_irq(&pdev->dev, irq,
394 snd_mfld_jack_intr_handler,
396 snd_mfld_jack_detection, 395 snd_mfld_jack_detection,
397 IRQF_SHARED, pdev->dev.driver->name, mc_drv_ctx); 396 IRQF_SHARED, pdev->dev.driver->name, mc_drv_ctx);
398 if (ret_val) { 397 if (ret_val) {
399 pr_err("cannot register IRQ\n"); 398 pr_err("cannot register IRQ\n");
400 goto unalloc; 399 return ret_val;
401 } 400 }
402 /* register the soc card */ 401 /* register the soc card */
403 snd_soc_card_mfld.dev = &pdev->dev; 402 snd_soc_card_mfld.dev = &pdev->dev;
404 ret_val = snd_soc_register_card(&snd_soc_card_mfld); 403 ret_val = snd_soc_register_card(&snd_soc_card_mfld);
405 if (ret_val) { 404 if (ret_val) {
406 pr_debug("snd_soc_register_card failed %d\n", ret_val); 405 pr_debug("snd_soc_register_card failed %d\n", ret_val);
407 goto freeirq; 406 return ret_val;
408 } 407 }
409 platform_set_drvdata(pdev, mc_drv_ctx); 408 platform_set_drvdata(pdev, mc_drv_ctx);
410 pr_debug("successfully exited probe\n"); 409 pr_debug("successfully exited probe\n");
411 return ret_val; 410 return 0;
412
413freeirq:
414 free_irq(irq, mc_drv_ctx);
415unalloc:
416 kfree(mc_drv_ctx);
417 return ret_val;
418} 411}
419 412
420static int snd_mfld_mc_remove(struct platform_device *pdev) 413static int snd_mfld_mc_remove(struct platform_device *pdev)
421{ 414{
422 struct mfld_mc_private *mc_drv_ctx = platform_get_drvdata(pdev);
423
424 pr_debug("snd_mfld_mc_remove called\n"); 415 pr_debug("snd_mfld_mc_remove called\n");
425 free_irq(platform_get_irq(pdev, 0), mc_drv_ctx);
426 snd_soc_unregister_card(&snd_soc_card_mfld); 416 snd_soc_unregister_card(&snd_soc_card_mfld);
427 kfree(mc_drv_ctx);
428 return 0; 417 return 0;
429} 418}
430 419