aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2014-07-06 12:14:50 -0400
committerMark Brown <broonie@linaro.org>2014-07-07 06:50:52 -0400
commite9d42d15275496a213709bbef5ba7b2f88263867 (patch)
tree7b05cae3575a5741f2f0e6c7b833544bdb187086
parent7171511eaec5bf23fb06078f59784a3a0626b38f (diff)
spi/spi-sh: Use devm_ioremap
This patch introduces the use of devm_ioremap and removes the iounmaps in the probe and remove functions. Also, the labels are renamed to preserve ordering. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/spi/spi-sh.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c
index 03edf5ed0e9f..8e171a76049f 100644
--- a/drivers/spi/spi-sh.c
+++ b/drivers/spi/spi-sh.c
@@ -432,7 +432,6 @@ static int spi_sh_remove(struct platform_device *pdev)
432 spi_unregister_master(ss->master); 432 spi_unregister_master(ss->master);
433 destroy_workqueue(ss->workqueue); 433 destroy_workqueue(ss->workqueue);
434 free_irq(ss->irq, ss); 434 free_irq(ss->irq, ss);
435 iounmap(ss->addr);
436 435
437 return 0; 436 return 0;
438} 437}
@@ -480,7 +479,7 @@ static int spi_sh_probe(struct platform_device *pdev)
480 } 479 }
481 ss->irq = irq; 480 ss->irq = irq;
482 ss->master = master; 481 ss->master = master;
483 ss->addr = ioremap(res->start, resource_size(res)); 482 ss->addr = devm_ioremap(&pdev->dev, res->start, resource_size(res));
484 if (ss->addr == NULL) { 483 if (ss->addr == NULL) {
485 dev_err(&pdev->dev, "ioremap error.\n"); 484 dev_err(&pdev->dev, "ioremap error.\n");
486 ret = -ENOMEM; 485 ret = -ENOMEM;
@@ -495,13 +494,13 @@ static int spi_sh_probe(struct platform_device *pdev)
495 if (ss->workqueue == NULL) { 494 if (ss->workqueue == NULL) {
496 dev_err(&pdev->dev, "create workqueue error\n"); 495 dev_err(&pdev->dev, "create workqueue error\n");
497 ret = -EBUSY; 496 ret = -EBUSY;
498 goto error2; 497 goto error1;
499 } 498 }
500 499
501 ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss); 500 ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss);
502 if (ret < 0) { 501 if (ret < 0) {
503 dev_err(&pdev->dev, "request_irq error\n"); 502 dev_err(&pdev->dev, "request_irq error\n");
504 goto error3; 503 goto error2;
505 } 504 }
506 505
507 master->num_chipselect = 2; 506 master->num_chipselect = 2;
@@ -513,17 +512,15 @@ static int spi_sh_probe(struct platform_device *pdev)
513 ret = spi_register_master(master); 512 ret = spi_register_master(master);
514 if (ret < 0) { 513 if (ret < 0) {
515 printk(KERN_ERR "spi_register_master error.\n"); 514 printk(KERN_ERR "spi_register_master error.\n");
516 goto error4; 515 goto error3;
517 } 516 }
518 517
519 return 0; 518 return 0;
520 519
521 error4:
522 free_irq(irq, ss);
523 error3: 520 error3:
524 destroy_workqueue(ss->workqueue); 521 free_irq(irq, ss);
525 error2: 522 error2:
526 iounmap(ss->addr); 523 destroy_workqueue(ss->workqueue);
527 error1: 524 error1:
528 spi_master_put(master); 525 spi_master_put(master);
529 526