aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
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
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')
-rw-r--r--drivers/video/omap2/dss/dispc.c16
-rw-r--r--drivers/video/omap2/dss/dsi.c28
-rw-r--r--drivers/video/omap2/dss/dss.c9
-rw-r--r--drivers/video/omap2/dss/rfbi.c5
-rw-r--r--drivers/video/omap2/dss/venc.c8
5 files changed, 23 insertions, 43 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index a5ec7f37c18..6fa866a83f1 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3322,7 +3322,8 @@ static int omap_dispchw_probe(struct platform_device *pdev)
3322 r = -EINVAL; 3322 r = -EINVAL;
3323 goto err_ioremap; 3323 goto err_ioremap;
3324 } 3324 }
3325 dispc.base = ioremap(dispc_mem->start, resource_size(dispc_mem)); 3325 dispc.base = devm_ioremap(&pdev->dev, dispc_mem->start,
3326 resource_size(dispc_mem));
3326 if (!dispc.base) { 3327 if (!dispc.base) {
3327 DSSERR("can't ioremap DISPC\n"); 3328 DSSERR("can't ioremap DISPC\n");
3328 r = -ENOMEM; 3329 r = -ENOMEM;
@@ -3332,14 +3333,14 @@ static int omap_dispchw_probe(struct platform_device *pdev)
3332 if (dispc.irq < 0) { 3333 if (dispc.irq < 0) {
3333 DSSERR("platform_get_irq failed\n"); 3334 DSSERR("platform_get_irq failed\n");
3334 r = -ENODEV; 3335 r = -ENODEV;
3335 goto err_irq; 3336 goto err_ioremap;
3336 } 3337 }
3337 3338
3338 r = request_irq(dispc.irq, omap_dispc_irq_handler, IRQF_SHARED, 3339 r = devm_request_irq(&pdev->dev, dispc.irq, omap_dispc_irq_handler,
3339 "OMAP DISPC", dispc.pdev); 3340 IRQF_SHARED, "OMAP DISPC", dispc.pdev);
3340 if (r < 0) { 3341 if (r < 0) {
3341 DSSERR("request_irq failed\n"); 3342 DSSERR("request_irq failed\n");
3342 goto err_irq; 3343 goto err_ioremap;
3343 } 3344 }
3344 3345
3345 pm_runtime_enable(&pdev->dev); 3346 pm_runtime_enable(&pdev->dev);
@@ -3362,9 +3363,6 @@ static int omap_dispchw_probe(struct platform_device *pdev)
3362 3363
3363err_runtime_get: 3364err_runtime_get:
3364 pm_runtime_disable(&pdev->dev); 3365 pm_runtime_disable(&pdev->dev);
3365 free_irq(dispc.irq, dispc.pdev);
3366err_irq:
3367 iounmap(dispc.base);
3368err_ioremap: 3366err_ioremap:
3369 clk_put(dispc.dss_clk); 3367 clk_put(dispc.dss_clk);
3370err_get_clk: 3368err_get_clk:
@@ -3377,8 +3375,6 @@ static int omap_dispchw_remove(struct platform_device *pdev)
3377 3375
3378 clk_put(dispc.dss_clk); 3376 clk_put(dispc.dss_clk);
3379 3377
3380 free_irq(dispc.irq, dispc.pdev);
3381 iounmap(dispc.base);
3382 return 0; 3378 return 0;
3383} 3379}
3384 3380
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index d4d676c82c1..52b93597730 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
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 17033457ee8..e75f837c766 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -751,7 +751,8 @@ static int omap_dsshw_probe(struct platform_device *pdev)
751 r = -EINVAL; 751 r = -EINVAL;
752 goto err_ioremap; 752 goto err_ioremap;
753 } 753 }
754 dss.base = ioremap(dss_mem->start, resource_size(dss_mem)); 754 dss.base = devm_ioremap(&pdev->dev, dss_mem->start,
755 resource_size(dss_mem));
755 if (!dss.base) { 756 if (!dss.base) {
756 DSSERR("can't ioremap DSS\n"); 757 DSSERR("can't ioremap DSS\n");
757 r = -ENOMEM; 758 r = -ENOMEM;
@@ -760,7 +761,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
760 761
761 r = dss_get_clocks(); 762 r = dss_get_clocks();
762 if (r) 763 if (r)
763 goto err_clocks; 764 goto err_ioremap;
764 765
765 pm_runtime_enable(&pdev->dev); 766 pm_runtime_enable(&pdev->dev);
766 767
@@ -808,8 +809,6 @@ err_dpi:
808err_runtime_get: 809err_runtime_get:
809 pm_runtime_disable(&pdev->dev); 810 pm_runtime_disable(&pdev->dev);
810 dss_put_clocks(); 811 dss_put_clocks();
811err_clocks:
812 iounmap(dss.base);
813err_ioremap: 812err_ioremap:
814 return r; 813 return r;
815} 814}
@@ -819,8 +818,6 @@ static int omap_dsshw_remove(struct platform_device *pdev)
819 dpi_exit(); 818 dpi_exit();
820 sdi_exit(); 819 sdi_exit();
821 820
822 iounmap(dss.base);
823
824 pm_runtime_disable(&pdev->dev); 821 pm_runtime_disable(&pdev->dev);
825 822
826 dss_put_clocks(); 823 dss_put_clocks();
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 814bb9500dc..159e914063c 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -925,7 +925,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
925 r = -EINVAL; 925 r = -EINVAL;
926 goto err_ioremap; 926 goto err_ioremap;
927 } 927 }
928 rfbi.base = ioremap(rfbi_mem->start, resource_size(rfbi_mem)); 928 rfbi.base = devm_ioremap(&pdev->dev, rfbi_mem->start,
929 resource_size(rfbi_mem));
929 if (!rfbi.base) { 930 if (!rfbi.base) {
930 DSSERR("can't ioremap RFBI\n"); 931 DSSERR("can't ioremap RFBI\n");
931 r = -ENOMEM; 932 r = -ENOMEM;
@@ -963,7 +964,6 @@ err_get_ick:
963 rfbi_runtime_put(); 964 rfbi_runtime_put();
964err_get_rfbi: 965err_get_rfbi:
965 pm_runtime_disable(&pdev->dev); 966 pm_runtime_disable(&pdev->dev);
966 iounmap(rfbi.base);
967err_ioremap: 967err_ioremap:
968 return r; 968 return r;
969} 969}
@@ -971,7 +971,6 @@ err_ioremap:
971static int omap_rfbihw_remove(struct platform_device *pdev) 971static int omap_rfbihw_remove(struct platform_device *pdev)
972{ 972{
973 pm_runtime_disable(&pdev->dev); 973 pm_runtime_disable(&pdev->dev);
974 iounmap(rfbi.base);
975 return 0; 974 return 0;
976} 975}
977 976
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 82865bec945..4172232cdec 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -798,7 +798,8 @@ static int omap_venchw_probe(struct platform_device *pdev)
798 r = -EINVAL; 798 r = -EINVAL;
799 goto err_ioremap; 799 goto err_ioremap;
800 } 800 }
801 venc.base = ioremap(venc_mem->start, resource_size(venc_mem)); 801 venc.base = devm_ioremap(&pdev->dev, venc_mem->start,
802 resource_size(venc_mem));
802 if (!venc.base) { 803 if (!venc.base) {
803 DSSERR("can't ioremap VENC\n"); 804 DSSERR("can't ioremap VENC\n");
804 r = -ENOMEM; 805 r = -ENOMEM;
@@ -807,7 +808,7 @@ static int omap_venchw_probe(struct platform_device *pdev)
807 808
808 r = venc_get_clocks(pdev); 809 r = venc_get_clocks(pdev);
809 if (r) 810 if (r)
810 goto err_get_clk; 811 goto err_ioremap;
811 812
812 pm_runtime_enable(&pdev->dev); 813 pm_runtime_enable(&pdev->dev);
813 814
@@ -825,8 +826,6 @@ static int omap_venchw_probe(struct platform_device *pdev)
825err_get_venc: 826err_get_venc:
826 pm_runtime_disable(&pdev->dev); 827 pm_runtime_disable(&pdev->dev);
827 venc_put_clocks(); 828 venc_put_clocks();
828err_get_clk:
829 iounmap(venc.base);
830err_ioremap: 829err_ioremap:
831 return r; 830 return r;
832} 831}
@@ -842,7 +841,6 @@ static int omap_venchw_remove(struct platform_device *pdev)
842 pm_runtime_disable(&pdev->dev); 841 pm_runtime_disable(&pdev->dev);
843 venc_put_clocks(); 842 venc_put_clocks();
844 843
845 iounmap(venc.base);
846 return 0; 844 return 0;
847} 845}
848 846