Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76e54338 authored by Amitoj Kaur Chawla's avatar Amitoj Kaur Chawla Committed by Greg Kroah-Hartman
Browse files

staging: media: omap1: Switch to devm_ioremap_resource



Replace calls to request_mem_region and ioremap with a direct
call to devm_ioremap_resource instead and modify error
handling.
Move the call to platform_get_resource adjacent to the call to
devm_ioremap_resource to make the connection between them more
clear.

Also remove unnecessary labels, variable initialisations and
release_mem_region iounmap from probe and remove functions.

Signed-off-by: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ba99a0f1
Loading
Loading
Loading
Loading
+6 −25
Original line number Original line Diff line number Diff line
@@ -1569,9 +1569,8 @@ static int omap1_cam_probe(struct platform_device *pdev)
	unsigned int irq;
	unsigned int irq;
	int err = 0;
	int err = 0;


	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	irq = platform_get_irq(pdev, 0);
	irq = platform_get_irq(pdev, 0);
	if (!res || (int)irq <= 0) {
	if ((int)irq <= 0) {
		err = -ENODEV;
		err = -ENODEV;
		goto exit;
		goto exit;
	}
	}
@@ -1585,7 +1584,6 @@ static int omap1_cam_probe(struct platform_device *pdev)
	if (!pcdev)
	if (!pcdev)
		return -ENOMEM;
		return -ENOMEM;


	pcdev->res = res;
	pcdev->clk = clk;
	pcdev->clk = clk;


	pcdev->pdata = pdev->dev.platform_data;
	pcdev->pdata = pdev->dev.platform_data;
@@ -1616,17 +1614,11 @@ static int omap1_cam_probe(struct platform_device *pdev)
	INIT_LIST_HEAD(&pcdev->capture);
	INIT_LIST_HEAD(&pcdev->capture);
	spin_lock_init(&pcdev->lock);
	spin_lock_init(&pcdev->lock);


	/*
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	 * Request the region.
	base = devm_ioremap_resource(&pdev->dev, res);
	 */
	if (IS_ERR(base))
	if (!request_mem_region(res->start, resource_size(res), DRIVER_NAME))
		return PTR_ERR(base);
		return -EBUSY;


	base = ioremap(res->start, resource_size(res));
	if (!base) {
		err = -ENOMEM;
		goto exit_release;
	}
	pcdev->irq = irq;
	pcdev->irq = irq;
	pcdev->base = base;
	pcdev->base = base;


@@ -1636,8 +1628,7 @@ static int omap1_cam_probe(struct platform_device *pdev)
			dma_isr, (void *)pcdev, &pcdev->dma_ch);
			dma_isr, (void *)pcdev, &pcdev->dma_ch);
	if (err < 0) {
	if (err < 0) {
		dev_err(&pdev->dev, "Can't request DMA for OMAP1 Camera\n");
		dev_err(&pdev->dev, "Can't request DMA for OMAP1 Camera\n");
		err = -EBUSY;
		return -EBUSY;
		goto exit_iounmap;
	}
	}
	dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_ch);
	dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_ch);


@@ -1673,10 +1664,6 @@ static int omap1_cam_probe(struct platform_device *pdev)
	free_irq(pcdev->irq, pcdev);
	free_irq(pcdev->irq, pcdev);
exit_free_dma:
exit_free_dma:
	omap_free_dma(pcdev->dma_ch);
	omap_free_dma(pcdev->dma_ch);
exit_iounmap:
	iounmap(base);
exit_release:
	release_mem_region(res->start, resource_size(res));
exit:
exit:
	return err;
	return err;
}
}
@@ -1686,7 +1673,6 @@ static int omap1_cam_remove(struct platform_device *pdev)
	struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
	struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
	struct omap1_cam_dev *pcdev = container_of(soc_host,
	struct omap1_cam_dev *pcdev = container_of(soc_host,
					struct omap1_cam_dev, soc_host);
					struct omap1_cam_dev, soc_host);
	struct resource *res;


	free_irq(pcdev->irq, pcdev);
	free_irq(pcdev->irq, pcdev);


@@ -1694,11 +1680,6 @@ static int omap1_cam_remove(struct platform_device *pdev)


	soc_camera_host_unregister(soc_host);
	soc_camera_host_unregister(soc_host);


	iounmap(pcdev->base);

	res = pcdev->res;
	release_mem_region(res->start, resource_size(res));

	dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n");
	dev_info(&pdev->dev, "OMAP1 Camera Interface driver unloaded\n");


	return 0;
	return 0;