aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/intel_msic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/intel_msic.c')
-rw-r--r--drivers/mfd/intel_msic.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/mfd/intel_msic.c b/drivers/mfd/intel_msic.c
index b76657eb0c51..59df5584cb58 100644
--- a/drivers/mfd/intel_msic.c
+++ b/drivers/mfd/intel_msic.c
@@ -406,7 +406,7 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
406 return -ENXIO; 406 return -ENXIO;
407 } 407 }
408 408
409 msic = kzalloc(sizeof(*msic), GFP_KERNEL); 409 msic = devm_kzalloc(&pdev->dev, sizeof(*msic), GFP_KERNEL);
410 if (!msic) 410 if (!msic)
411 return -ENOMEM; 411 return -ENOMEM;
412 412
@@ -421,21 +421,13 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
421 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 421 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
422 if (!res) { 422 if (!res) {
423 dev_err(&pdev->dev, "failed to get SRAM iomem resource\n"); 423 dev_err(&pdev->dev, "failed to get SRAM iomem resource\n");
424 ret = -ENODEV; 424 return -ENODEV;
425 goto fail_free_msic;
426 } 425 }
427 426
428 res = request_mem_region(res->start, resource_size(res), pdev->name); 427 msic->irq_base = devm_request_and_ioremap(&pdev->dev, res);
429 if (!res) {
430 ret = -EBUSY;
431 goto fail_free_msic;
432 }
433
434 msic->irq_base = ioremap_nocache(res->start, resource_size(res));
435 if (!msic->irq_base) { 428 if (!msic->irq_base) {
436 dev_err(&pdev->dev, "failed to map SRAM memory\n"); 429 dev_err(&pdev->dev, "failed to map SRAM memory\n");
437 ret = -ENOMEM; 430 return -ENOMEM;
438 goto fail_release_region;
439 } 431 }
440 432
441 platform_set_drvdata(pdev, msic); 433 platform_set_drvdata(pdev, msic);
@@ -443,7 +435,7 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
443 ret = intel_msic_init_devices(msic); 435 ret = intel_msic_init_devices(msic);
444 if (ret) { 436 if (ret) {
445 dev_err(&pdev->dev, "failed to initialize MSIC devices\n"); 437 dev_err(&pdev->dev, "failed to initialize MSIC devices\n");
446 goto fail_unmap_mem; 438 return ret;
447 } 439 }
448 440
449 dev_info(&pdev->dev, "Intel MSIC version %c%d (vendor %#x)\n", 441 dev_info(&pdev->dev, "Intel MSIC version %c%d (vendor %#x)\n",
@@ -451,27 +443,14 @@ static int __devinit intel_msic_probe(struct platform_device *pdev)
451 msic->vendor); 443 msic->vendor);
452 444
453 return 0; 445 return 0;
454
455fail_unmap_mem:
456 iounmap(msic->irq_base);
457fail_release_region:
458 release_mem_region(res->start, resource_size(res));
459fail_free_msic:
460 kfree(msic);
461
462 return ret;
463} 446}
464 447
465static int __devexit intel_msic_remove(struct platform_device *pdev) 448static int __devexit intel_msic_remove(struct platform_device *pdev)
466{ 449{
467 struct intel_msic *msic = platform_get_drvdata(pdev); 450 struct intel_msic *msic = platform_get_drvdata(pdev);
468 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
469 451
470 intel_msic_remove_devices(msic); 452 intel_msic_remove_devices(msic);
471 platform_set_drvdata(pdev, NULL); 453 platform_set_drvdata(pdev, NULL);
472 iounmap(msic->irq_base);
473 release_mem_region(res->start, resource_size(res));
474 kfree(msic);
475 454
476 return 0; 455 return 0;
477} 456}