aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/dsi.c
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2012-01-24 08:00:45 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-01-25 06:48:35 -0500
commit6e2a14d2c59f6208310eeb6b031e9d1c22b38c6a (patch)
tree8267f62f049f5cbd82800f9719ee550b74dc3821 /drivers/video/omap2/dss/dsi.c
parentcc1d3e032df53d83d0ca4d537d8eb67eb5b3e808 (diff)
OMAPDSS: use devm_ functions
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/dsi.c')
-rw-r--r--drivers/video/omap2/dss/dsi.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index d4d676c82c12..52b935977300 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4695,7 +4695,7 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
4695 struct resource *dsi_mem; 4695 struct resource *dsi_mem;
4696 struct dsi_data *dsi; 4696 struct dsi_data *dsi;
4697 4697
4698 dsi = kzalloc(sizeof(*dsi), GFP_KERNEL); 4698 dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL);
4699 if (!dsi) { 4699 if (!dsi) {
4700 r = -ENOMEM; 4700 r = -ENOMEM;
4701 goto err_alloc; 4701 goto err_alloc;
@@ -4724,7 +4724,7 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
4724 4724
4725 r = dsi_get_clocks(dsidev); 4725 r = dsi_get_clocks(dsidev);
4726 if (r) 4726 if (r)
4727 goto err_get_clk; 4727 goto err_alloc;
4728 4728
4729 pm_runtime_enable(&dsidev->dev); 4729 pm_runtime_enable(&dsidev->dev);
4730 4730
@@ -4742,7 +4742,8 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
4742 r = -EINVAL; 4742 r = -EINVAL;
4743 goto err_ioremap; 4743 goto err_ioremap;
4744 } 4744 }
4745 dsi->base = ioremap(dsi_mem->start, resource_size(dsi_mem)); 4745 dsi->base = devm_ioremap(&dsidev->dev, dsi_mem->start,
4746 resource_size(dsi_mem));
4746 if (!dsi->base) { 4747 if (!dsi->base) {
4747 DSSERR("can't ioremap DSI\n"); 4748 DSSERR("can't ioremap DSI\n");
4748 r = -ENOMEM; 4749 r = -ENOMEM;
@@ -4752,14 +4753,14 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
4752 if (dsi->irq < 0) { 4753 if (dsi->irq < 0) {
4753 DSSERR("platform_get_irq failed\n"); 4754 DSSERR("platform_get_irq failed\n");
4754 r = -ENODEV; 4755 r = -ENODEV;
4755 goto err_get_irq; 4756 goto err_ioremap;
4756 } 4757 }
4757 4758
4758 r = request_irq(dsi->irq, omap_dsi_irq_handler, IRQF_SHARED, 4759 r = devm_request_irq(&dsidev->dev, dsi->irq, omap_dsi_irq_handler,
4759 dev_name(&dsidev->dev), dsi->pdev); 4760 IRQF_SHARED, dev_name(&dsidev->dev), dsi->pdev);
4760 if (r < 0) { 4761 if (r < 0) {
4761 DSSERR("request_irq failed\n"); 4762 DSSERR("request_irq failed\n");
4762 goto err_get_irq; 4763 goto err_ioremap;
4763 } 4764 }
4764 4765
4765 /* DSI VCs initialization */ 4766 /* DSI VCs initialization */
@@ -4773,7 +4774,7 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
4773 4774
4774 r = dsi_runtime_get(dsidev); 4775 r = dsi_runtime_get(dsidev);
4775 if (r) 4776 if (r)
4776 goto err_get_dsi; 4777 goto err_ioremap;
4777 4778
4778 rev = dsi_read_reg(dsidev, DSI_REVISION); 4779 rev = dsi_read_reg(dsidev, DSI_REVISION);
4779 dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n", 4780 dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n",
@@ -4791,14 +4792,8 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
4791 4792
4792 return 0; 4793 return 0;
4793 4794
4794err_get_dsi:
4795 free_irq(dsi->irq, dsi->pdev);
4796err_get_irq:
4797 iounmap(dsi->base);
4798err_ioremap: 4795err_ioremap:
4799 pm_runtime_disable(&dsidev->dev); 4796 pm_runtime_disable(&dsidev->dev);
4800err_get_clk:
4801 kfree(dsi);
4802err_alloc: 4797err_alloc:
4803 return r; 4798 return r;
4804} 4799}
@@ -4823,11 +4818,6 @@ static int omap_dsihw_remove(struct platform_device *dsidev)
4823 dsi->vdds_dsi_reg = NULL; 4818 dsi->vdds_dsi_reg = NULL;
4824 } 4819 }
4825 4820
4826 free_irq(dsi->irq, dsi->pdev);
4827 iounmap(dsi->base);
4828
4829 kfree(dsi);
4830
4831 return 0; 4821 return 0;
4832} 4822}
4833 4823