diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-04-24 11:55:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:20:43 -0400 |
commit | eb6c8558f7658b7f31ee022c7bea1d840eda33dc (patch) | |
tree | cd04ace1cfe7c03329d0e610b296c3d4250544f2 /drivers/media/video | |
parent | 594bb46dbc63934bc65fa95743f83204bd26a641 (diff) |
V4L/DVB (11608): soc-camera: host-driver cleanup
Embed struct soc_camera_host in platform-specific per host instance objects
instead of allocating them statically in drivers, use platform_[gs]et_drvdata
consistently, use resource_size().
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/mx1_camera.c | 21 | ||||
-rw-r--r-- | drivers/media/video/mx3_camera.c | 2 | ||||
-rw-r--r-- | drivers/media/video/pxa_camera.c | 29 | ||||
-rw-r--r-- | drivers/media/video/sh_mobile_ceu_camera.c | 6 |
4 files changed, 26 insertions, 32 deletions
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 86fab56c5a20..48dd984dadff 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -102,6 +102,7 @@ struct mx1_buffer { | |||
102 | * Interface. If anyone ever builds hardware to enable more than | 102 | * Interface. If anyone ever builds hardware to enable more than |
103 | * one camera, they will have to modify this driver too */ | 103 | * one camera, they will have to modify this driver too */ |
104 | struct mx1_camera_dev { | 104 | struct mx1_camera_dev { |
105 | struct soc_camera_host soc_host; | ||
105 | struct soc_camera_device *icd; | 106 | struct soc_camera_device *icd; |
106 | struct mx1_camera_pdata *pdata; | 107 | struct mx1_camera_pdata *pdata; |
107 | struct mx1_buffer *active; | 108 | struct mx1_buffer *active; |
@@ -633,12 +634,6 @@ static struct soc_camera_host_ops mx1_soc_camera_host_ops = { | |||
633 | .querycap = mx1_camera_querycap, | 634 | .querycap = mx1_camera_querycap, |
634 | }; | 635 | }; |
635 | 636 | ||
636 | /* Should be allocated dynamically too, but we have only one. */ | ||
637 | static struct soc_camera_host mx1_soc_camera_host = { | ||
638 | .drv_name = DRIVER_NAME, | ||
639 | .ops = &mx1_soc_camera_host_ops, | ||
640 | }; | ||
641 | |||
642 | static struct fiq_handler fh = { | 637 | static struct fiq_handler fh = { |
643 | .name = "csi_sof" | 638 | .name = "csi_sof" |
644 | }; | 639 | }; |
@@ -673,7 +668,7 @@ static int __init mx1_camera_probe(struct platform_device *pdev) | |||
673 | goto exit_put_clk; | 668 | goto exit_put_clk; |
674 | } | 669 | } |
675 | 670 | ||
676 | dev_set_drvdata(&pdev->dev, pcdev); | 671 | platform_set_drvdata(pdev, pcdev); |
677 | pcdev->res = res; | 672 | pcdev->res = res; |
678 | pcdev->clk = clk; | 673 | pcdev->clk = clk; |
679 | 674 | ||
@@ -746,10 +741,12 @@ static int __init mx1_camera_probe(struct platform_device *pdev) | |||
746 | mxc_set_irq_fiq(irq, 1); | 741 | mxc_set_irq_fiq(irq, 1); |
747 | enable_fiq(irq); | 742 | enable_fiq(irq); |
748 | 743 | ||
749 | mx1_soc_camera_host.priv = pcdev; | 744 | pcdev->soc_host.drv_name = DRIVER_NAME; |
750 | mx1_soc_camera_host.dev.parent = &pdev->dev; | 745 | pcdev->soc_host.ops = &mx1_soc_camera_host_ops; |
751 | mx1_soc_camera_host.nr = pdev->id; | 746 | pcdev->soc_host.priv = pcdev; |
752 | err = soc_camera_host_register(&mx1_soc_camera_host); | 747 | pcdev->soc_host.dev.parent = &pdev->dev; |
748 | pcdev->soc_host.nr = pdev->id; | ||
749 | err = soc_camera_host_register(&pcdev->soc_host); | ||
753 | if (err) | 750 | if (err) |
754 | goto exit_free_irq; | 751 | goto exit_free_irq; |
755 | 752 | ||
@@ -787,7 +784,7 @@ static int __exit mx1_camera_remove(struct platform_device *pdev) | |||
787 | 784 | ||
788 | clk_put(pcdev->clk); | 785 | clk_put(pcdev->clk); |
789 | 786 | ||
790 | soc_camera_host_unregister(&mx1_soc_camera_host); | 787 | soc_camera_host_unregister(&pcdev->soc_host); |
791 | 788 | ||
792 | iounmap(pcdev->base); | 789 | iounmap(pcdev->base); |
793 | 790 | ||
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 2d0781118eb0..3d187f966d61 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -1102,7 +1102,7 @@ static int mx3_camera_probe(struct platform_device *pdev) | |||
1102 | goto eclkget; | 1102 | goto eclkget; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | dev_set_drvdata(&pdev->dev, mx3_cam); | 1105 | platform_set_drvdata(pdev, mx3_cam); |
1106 | 1106 | ||
1107 | mx3_cam->pdata = pdev->dev.platform_data; | 1107 | mx3_cam->pdata = pdev->dev.platform_data; |
1108 | mx3_cam->platform_flags = mx3_cam->pdata->flags; | 1108 | mx3_cam->platform_flags = mx3_cam->pdata->flags; |
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index c639845460ff..ad0d58c01bb9 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -202,6 +202,7 @@ struct pxa_buffer { | |||
202 | }; | 202 | }; |
203 | 203 | ||
204 | struct pxa_camera_dev { | 204 | struct pxa_camera_dev { |
205 | struct soc_camera_host soc_host; | ||
205 | struct device *dev; | 206 | struct device *dev; |
206 | /* PXA27x is only supposed to handle one camera on its Quick Capture | 207 | /* PXA27x is only supposed to handle one camera on its Quick Capture |
207 | * interface. If anyone ever builds hardware to enable more than | 208 | * interface. If anyone ever builds hardware to enable more than |
@@ -1552,12 +1553,6 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = { | |||
1552 | .set_bus_param = pxa_camera_set_bus_param, | 1553 | .set_bus_param = pxa_camera_set_bus_param, |
1553 | }; | 1554 | }; |
1554 | 1555 | ||
1555 | /* Should be allocated dynamically too, but we have only one. */ | ||
1556 | static struct soc_camera_host pxa_soc_camera_host = { | ||
1557 | .drv_name = PXA_CAM_DRV_NAME, | ||
1558 | .ops = &pxa_soc_camera_host_ops, | ||
1559 | }; | ||
1560 | |||
1561 | static int pxa_camera_probe(struct platform_device *pdev) | 1556 | static int pxa_camera_probe(struct platform_device *pdev) |
1562 | { | 1557 | { |
1563 | struct pxa_camera_dev *pcdev; | 1558 | struct pxa_camera_dev *pcdev; |
@@ -1586,7 +1581,7 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
1586 | goto exit_kfree; | 1581 | goto exit_kfree; |
1587 | } | 1582 | } |
1588 | 1583 | ||
1589 | dev_set_drvdata(&pdev->dev, pcdev); | 1584 | platform_set_drvdata(pdev, pcdev); |
1590 | pcdev->res = res; | 1585 | pcdev->res = res; |
1591 | 1586 | ||
1592 | pcdev->pdata = pdev->dev.platform_data; | 1587 | pcdev->pdata = pdev->dev.platform_data; |
@@ -1616,13 +1611,13 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
1616 | /* | 1611 | /* |
1617 | * Request the regions. | 1612 | * Request the regions. |
1618 | */ | 1613 | */ |
1619 | if (!request_mem_region(res->start, res->end - res->start + 1, | 1614 | if (!request_mem_region(res->start, resource_size(res), |
1620 | PXA_CAM_DRV_NAME)) { | 1615 | PXA_CAM_DRV_NAME)) { |
1621 | err = -EBUSY; | 1616 | err = -EBUSY; |
1622 | goto exit_clk; | 1617 | goto exit_clk; |
1623 | } | 1618 | } |
1624 | 1619 | ||
1625 | base = ioremap(res->start, res->end - res->start + 1); | 1620 | base = ioremap(res->start, resource_size(res)); |
1626 | if (!base) { | 1621 | if (!base) { |
1627 | err = -ENOMEM; | 1622 | err = -ENOMEM; |
1628 | goto exit_release; | 1623 | goto exit_release; |
@@ -1670,10 +1665,12 @@ static int pxa_camera_probe(struct platform_device *pdev) | |||
1670 | goto exit_free_dma; | 1665 | goto exit_free_dma; |
1671 | } | 1666 | } |
1672 | 1667 | ||
1673 | pxa_soc_camera_host.priv = pcdev; | 1668 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; |
1674 | pxa_soc_camera_host.dev.parent = &pdev->dev; | 1669 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; |
1675 | pxa_soc_camera_host.nr = pdev->id; | 1670 | pcdev->soc_host.priv = pcdev; |
1676 | err = soc_camera_host_register(&pxa_soc_camera_host); | 1671 | pcdev->soc_host.dev.parent = &pdev->dev; |
1672 | pcdev->soc_host.nr = pdev->id; | ||
1673 | err = soc_camera_host_register(&pcdev->soc_host); | ||
1677 | if (err) | 1674 | if (err) |
1678 | goto exit_free_irq; | 1675 | goto exit_free_irq; |
1679 | 1676 | ||
@@ -1690,7 +1687,7 @@ exit_free_dma_y: | |||
1690 | exit_iounmap: | 1687 | exit_iounmap: |
1691 | iounmap(base); | 1688 | iounmap(base); |
1692 | exit_release: | 1689 | exit_release: |
1693 | release_mem_region(res->start, res->end - res->start + 1); | 1690 | release_mem_region(res->start, resource_size(res)); |
1694 | exit_clk: | 1691 | exit_clk: |
1695 | clk_put(pcdev->clk); | 1692 | clk_put(pcdev->clk); |
1696 | exit_kfree: | 1693 | exit_kfree: |
@@ -1711,12 +1708,12 @@ static int __devexit pxa_camera_remove(struct platform_device *pdev) | |||
1711 | pxa_free_dma(pcdev->dma_chans[2]); | 1708 | pxa_free_dma(pcdev->dma_chans[2]); |
1712 | free_irq(pcdev->irq, pcdev); | 1709 | free_irq(pcdev->irq, pcdev); |
1713 | 1710 | ||
1714 | soc_camera_host_unregister(&pxa_soc_camera_host); | 1711 | soc_camera_host_unregister(&pcdev->soc_host); |
1715 | 1712 | ||
1716 | iounmap(pcdev->base); | 1713 | iounmap(pcdev->base); |
1717 | 1714 | ||
1718 | res = pcdev->res; | 1715 | res = pcdev->res; |
1719 | release_mem_region(res->start, res->end - res->start + 1); | 1716 | release_mem_region(res->start, resource_size(res)); |
1720 | 1717 | ||
1721 | kfree(pcdev); | 1718 | kfree(pcdev); |
1722 | 1719 | ||
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index b5e37a530c62..8e4a8fca976c 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -840,7 +840,7 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) | |||
840 | goto exit_kfree; | 840 | goto exit_kfree; |
841 | } | 841 | } |
842 | 842 | ||
843 | base = ioremap_nocache(res->start, res->end - res->start + 1); | 843 | base = ioremap_nocache(res->start, resource_size(res)); |
844 | if (!base) { | 844 | if (!base) { |
845 | err = -ENXIO; | 845 | err = -ENXIO; |
846 | dev_err(&pdev->dev, "Unable to ioremap CEU registers.\n"); | 846 | dev_err(&pdev->dev, "Unable to ioremap CEU registers.\n"); |
@@ -856,7 +856,7 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) | |||
856 | if (res) { | 856 | if (res) { |
857 | err = dma_declare_coherent_memory(&pdev->dev, res->start, | 857 | err = dma_declare_coherent_memory(&pdev->dev, res->start, |
858 | res->start, | 858 | res->start, |
859 | (res->end - res->start) + 1, | 859 | resource_size(res), |
860 | DMA_MEMORY_MAP | | 860 | DMA_MEMORY_MAP | |
861 | DMA_MEMORY_EXCLUSIVE); | 861 | DMA_MEMORY_EXCLUSIVE); |
862 | if (!err) { | 862 | if (!err) { |
@@ -865,7 +865,7 @@ static int sh_mobile_ceu_probe(struct platform_device *pdev) | |||
865 | goto exit_iounmap; | 865 | goto exit_iounmap; |
866 | } | 866 | } |
867 | 867 | ||
868 | pcdev->video_limit = (res->end - res->start) + 1; | 868 | pcdev->video_limit = resource_size(res); |
869 | } | 869 | } |
870 | 870 | ||
871 | /* request irq */ | 871 | /* request irq */ |