aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pxa_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-04-24 11:55:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:20:43 -0400
commiteb6c8558f7658b7f31ee022c7bea1d840eda33dc (patch)
treecd04ace1cfe7c03329d0e610b296c3d4250544f2 /drivers/media/video/pxa_camera.c
parent594bb46dbc63934bc65fa95743f83204bd26a641 (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/pxa_camera.c')
-rw-r--r--drivers/media/video/pxa_camera.c29
1 files changed, 13 insertions, 16 deletions
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
204struct pxa_camera_dev { 204struct 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. */
1556static struct soc_camera_host pxa_soc_camera_host = {
1557 .drv_name = PXA_CAM_DRV_NAME,
1558 .ops = &pxa_soc_camera_host_ops,
1559};
1560
1561static int pxa_camera_probe(struct platform_device *pdev) 1556static 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:
1690exit_iounmap: 1687exit_iounmap:
1691 iounmap(base); 1688 iounmap(base);
1692exit_release: 1689exit_release:
1693 release_mem_region(res->start, res->end - res->start + 1); 1690 release_mem_region(res->start, resource_size(res));
1694exit_clk: 1691exit_clk:
1695 clk_put(pcdev->clk); 1692 clk_put(pcdev->clk);
1696exit_kfree: 1693exit_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