summaryrefslogtreecommitdiff
path: root/drivers/media/platform/mx2_emmaprp.c
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-05-02 11:18:00 +0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-23 21:57:18 +0400
commitb97a6216973e5dd34b8c02940c6dc956ea2689a1 (patch)
tree26724234a69c3294e7470b2e8ef0c6fc54931d68 /drivers/media/platform/mx2_emmaprp.c
parente933cefa0f6e9cf40c8f4ae6d4da8ebb3f765ba0 (diff)
downloadlinux-b97a6216973e5dd34b8c02940c6dc956ea2689a1.tar.xz
[media] media: mx2-emmaprp: Cleanup internal structure
There are no need to store resource struct and IRQ in the driver internal structure. This patch remove these fields and improve error handling by using proper return codes from devm_ioremap_resource() and devm_request_irq(). Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/mx2_emmaprp.c')
-rw-r--r--drivers/media/platform/mx2_emmaprp.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c
index 0b7480e82142..85ce0999a32e 100644
--- a/drivers/media/platform/mx2_emmaprp.c
+++ b/drivers/media/platform/mx2_emmaprp.c
@@ -207,10 +207,8 @@ struct emmaprp_dev {
struct mutex dev_mutex;
spinlock_t irqlock;
- int irq_emma;
void __iomem *base_emma;
struct clk *clk_emma_ahb, *clk_emma_ipg;
- struct resource *res_emma;
struct v4l2_m2m_dev *m2m_dev;
struct vb2_alloc_ctx *alloc_ctx;
@@ -901,9 +899,8 @@ static int emmaprp_probe(struct platform_device *pdev)
{
struct emmaprp_dev *pcdev;
struct video_device *vfd;
- struct resource *res_emma;
- int irq_emma;
- int ret;
+ struct resource *res;
+ int irq, ret;
pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL);
if (!pcdev)
@@ -920,12 +917,10 @@ static int emmaprp_probe(struct platform_device *pdev)
if (IS_ERR(pcdev->clk_emma_ahb))
return PTR_ERR(pcdev->clk_emma_ahb);
- irq_emma = platform_get_irq(pdev, 0);
- res_emma = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (irq_emma < 0 || res_emma == NULL) {
- dev_err(&pdev->dev, "Missing platform resources data\n");
- return -ENODEV;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ pcdev->base_emma = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(pcdev->base_emma))
+ return PTR_ERR(pcdev->base_emma);
ret = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
if (ret)
@@ -952,20 +947,11 @@ static int emmaprp_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pcdev);
- pcdev->base_emma = devm_ioremap_resource(&pdev->dev, res_emma);
- if (IS_ERR(pcdev->base_emma)) {
- ret = PTR_ERR(pcdev->base_emma);
- goto rel_vdev;
- }
-
- pcdev->irq_emma = irq_emma;
- pcdev->res_emma = res_emma;
-
- if (devm_request_irq(&pdev->dev, pcdev->irq_emma, emmaprp_irq,
- 0, MEM2MEM_NAME, pcdev) < 0) {
- ret = -ENODEV;
+ irq = platform_get_irq(pdev, 0);
+ ret = devm_request_irq(&pdev->dev, irq, emmaprp_irq, 0,
+ dev_name(&pdev->dev), pcdev);
+ if (ret)
goto rel_vdev;
- }
pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
if (IS_ERR(pcdev->alloc_ctx)) {