Skip to contentSkip to conversation

media: video: mx2_camera: Remove ifdef's

PATCH In review Fabio Estevam 4 participants 5 messages Feb 16, 2012 – Feb 17, 2012 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: video: mx2_camera: Remove ifdef's

As we are able to build a same kernel that supports both mx27 and mx25, we should remove the ifdef's for CONFIG_MACH_MX27 in the mx2_camera driver.

---
 drivers/media/video/mx2_camera.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
drivers/media/video/mx2_camera.c +3 -19
index 04aab0c..afb4619 100644
@@ -38,9 +38,7 @@
 #include <linux/videodev2.h>
 
 #include <mach/mx2_cam.h>
-#ifdef CONFIG_MACH_MX27
 #include <mach/dma-mx1-mx2.h>
-#endif
 #include <mach/hardware.h>
 
 #include <asm/dma.h>
@@ -402,7 +400,6 @@ static void mx2_camera_remove_device(struct soc_camera_device *icd)
 	pcdev->icd = NULL;
 }
 
-#ifdef CONFIG_MACH_MX27
 static void mx27_camera_dma_enable(struct mx2_camera_dev *pcdev)
 {
 	u32 tmp;
@@ -419,6 +416,9 @@ static irqreturn_t mx27_camera_irq(int irq_csi, void *data)
 	struct mx2_camera_dev *pcdev = data;
 	u32 status = readl(pcdev->base_csi + CSISR);
 
+	if(!cpu_is_mx27())
+		return IRQ_NONE;
+
 	if (status & CSISR_SOF_INT && pcdev->active) {
 		u32 tmp;
 
@@ -431,12 +431,6 @@ static irqreturn_t mx27_camera_irq(int irq_csi, void *data)
 
 	return IRQ_HANDLED;
 }
-#else
-static irqreturn_t mx27_camera_irq(int irq_csi, void *data)
-{
-	return IRQ_NONE;
-}
-#endif /* CONFIG_MACH_MX27 */
 
 static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
 		int state)
@@ -619,7 +613,6 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq,
 
 	if (mx27_camera_emma(pcdev)) {
 		goto out;
-#ifdef CONFIG_MACH_MX27
 	} else if (cpu_is_mx27()) {
 		int ret;
 
@@ -637,7 +630,6 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq,
 			vb->state = VIDEOBUF_ACTIVE;
 			pcdev->active = buf;
 		}
-#endif
 	} else { /* cpu_is_mx25() */
 		u32 csicr3, dma_inten = 0;
 
@@ -1201,7 +1193,6 @@ static int mx2_camera_reqbufs(struct soc_camera_device *icd,
 	return 0;
 }
 
-#ifdef CONFIG_MACH_MX27
 static void mx27_camera_frame_done(struct mx2_camera_dev *pcdev, int state)
 {
 	struct videobuf_buffer *vb;
@@ -1310,7 +1301,6 @@ err_out:
 
 	return err;
 }
-#endif /* CONFIG_MACH_MX27 */
 
 static unsigned int mx2_camera_poll(struct file *file, poll_table *pt)
 {
@@ -1558,13 +1548,11 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
 			clk_get_rate(pcdev->clk_csi));
 
 	/* Initialize DMA */
-#ifdef CONFIG_MACH_MX27
 	if (cpu_is_mx27()) {
 		err = mx27_camera_dma_init(pdev, pcdev);
 		if (err)
 			goto exit_clk_put;
 	}
-#endif /* CONFIG_MACH_MX27 */
 
 	pcdev->res_csi = res_csi;
 	pcdev->pdata = pdev->dev.platform_data;
@@ -1657,12 +1645,10 @@ exit_iounmap:
 exit_release:
 	release_mem_region(res_csi->start, resource_size(res_csi));
 exit_dma_free:
-#ifdef CONFIG_MACH_MX27
 	if (cpu_is_mx27())
 		imx_dma_free(pcdev->dma);
 exit_clk_put:
 	clk_put(pcdev->clk_csi);
-#endif /* CONFIG_MACH_MX27 */
 exit_kfree:
 	kfree(pcdev);
 exit:
@@ -1677,10 +1663,8 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev)
 	struct resource *res;
 
 	clk_put(pcdev->clk_csi);
-#ifdef CONFIG_MACH_MX27
 	if (cpu_is_mx27())
 		imx_dma_free(pcdev->dma);
-#endif /* CONFIG_MACH_MX27 */
 	free_irq(pcdev->irq_csi, pcdev);
 	if (mx27_camera_emma(pcdev))
 		free_irq(pcdev->irq_emma, pcdev);
Signature · 1 line
1.7.1
#2 lore raw
In reply to Baruch Siach

Hi

Quoted 9 lines · Baruch Siach

Hi Fabio,

Quoted 4 lines · Fabio Estevam

As we are able to build a same kernel that supports both mx27 and mx25, we should remove the ifdef's for CONFIG_MACH_MX27 in the mx2_camera driver.

I'm still hoping to merge this

http://patchwork.linuxtv.org/patch/298/

patch, after it is suitably updated... Sascha, any progress?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Acked-by on v1 1/1
#1 lore raw
In reply to Fabio Estevam

Hi Fabio,

Quoted 4 lines · Fabio Estevam

As we are able to build a same kernel that supports both mx27 and mx25, we should remove the ifdef's for CONFIG_MACH_MX27 in the mx2_camera driver.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -
#4 lore raw
In reply to Fabio Estevam
Quoted 2 lines · Fabio Estevam

As we are able to build a same kernel that supports both mx27 and mx25, we should remove the ifdef's for CONFIG_MACH_MX27 in the mx2_camera driver.

It's not that simple. Yes, we are able to build a kernel for both i.MX25 and i.MX27 and this patch will work when both architectures are compiled in, but it will break if we try to build it for only i.MX25.

Sascha

Quoted 126 lines
---
 drivers/media/video/mx2_camera.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
drivers/media/video/mx2_camera.c +3 -19
index 04aab0c..afb4619 100644
@@ -38,9 +38,7 @@
 #include <linux/videodev2.h>
 
 #include <mach/mx2_cam.h>
-#ifdef CONFIG_MACH_MX27
 #include <mach/dma-mx1-mx2.h>
-#endif
 #include <mach/hardware.h>
 
 #include <asm/dma.h>
@@ -402,7 +400,6 @@ static void mx2_camera_remove_device(struct soc_camera_device *icd)
 	pcdev->icd = NULL;
 }
 
-#ifdef CONFIG_MACH_MX27
 static void mx27_camera_dma_enable(struct mx2_camera_dev *pcdev)
 {
 	u32 tmp;
@@ -419,6 +416,9 @@ static irqreturn_t mx27_camera_irq(int irq_csi, void *data)
 	struct mx2_camera_dev *pcdev = data;
 	u32 status = readl(pcdev->base_csi + CSISR);
 
+	if(!cpu_is_mx27())
+		return IRQ_NONE;
+
 	if (status & CSISR_SOF_INT && pcdev->active) {
 		u32 tmp;
 
@@ -431,12 +431,6 @@ static irqreturn_t mx27_camera_irq(int irq_csi, void *data)
 
 	return IRQ_HANDLED;
 }
-#else
-static irqreturn_t mx27_camera_irq(int irq_csi, void *data)
-{
-	return IRQ_NONE;
-}
-#endif /* CONFIG_MACH_MX27 */
 
 static void mx25_camera_frame_done(struct mx2_camera_dev *pcdev, int fb,
 		int state)
@@ -619,7 +613,6 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq,
 
 	if (mx27_camera_emma(pcdev)) {
 		goto out;
-#ifdef CONFIG_MACH_MX27
 	} else if (cpu_is_mx27()) {
 		int ret;
 
@@ -637,7 +630,6 @@ static void mx2_videobuf_queue(struct videobuf_queue *vq,
 			vb->state = VIDEOBUF_ACTIVE;
 			pcdev->active = buf;
 		}
-#endif
 	} else { /* cpu_is_mx25() */
 		u32 csicr3, dma_inten = 0;
 
@@ -1201,7 +1193,6 @@ static int mx2_camera_reqbufs(struct soc_camera_device *icd,
 	return 0;
 }
 
-#ifdef CONFIG_MACH_MX27
 static void mx27_camera_frame_done(struct mx2_camera_dev *pcdev, int state)
 {
 	struct videobuf_buffer *vb;
@@ -1310,7 +1301,6 @@ err_out:
 
 	return err;
 }
-#endif /* CONFIG_MACH_MX27 */
 
 static unsigned int mx2_camera_poll(struct file *file, poll_table *pt)
 {
@@ -1558,13 +1548,11 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
 			clk_get_rate(pcdev->clk_csi));
 
 	/* Initialize DMA */
-#ifdef CONFIG_MACH_MX27
 	if (cpu_is_mx27()) {
 		err = mx27_camera_dma_init(pdev, pcdev);
 		if (err)
 			goto exit_clk_put;
 	}
-#endif /* CONFIG_MACH_MX27 */
 
 	pcdev->res_csi = res_csi;
 	pcdev->pdata = pdev->dev.platform_data;
@@ -1657,12 +1645,10 @@ exit_iounmap:
 exit_release:
 	release_mem_region(res_csi->start, resource_size(res_csi));
 exit_dma_free:
-#ifdef CONFIG_MACH_MX27
 	if (cpu_is_mx27())
 		imx_dma_free(pcdev->dma);
 exit_clk_put:
 	clk_put(pcdev->clk_csi);
-#endif /* CONFIG_MACH_MX27 */
 exit_kfree:
 	kfree(pcdev);
 exit:
@@ -1677,10 +1663,8 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev)
 	struct resource *res;
 
 	clk_put(pcdev->clk_csi);
-#ifdef CONFIG_MACH_MX27
 	if (cpu_is_mx27())
 		imx_dma_free(pcdev->dma);
-#endif /* CONFIG_MACH_MX27 */
 	free_irq(pcdev->irq_csi, pcdev);
 	if (mx27_camera_emma(pcdev))
 		free_irq(pcdev->irq_emma, pcdev);
Signature · 1 line
1.7.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#3 lore raw
In reply to Guennadi Liakhovetski

Hi Guennadi,

Quoted 12 lines · Guennadi Liakhovetski

Hi

Quoted 8 lines · Baruch Siach

Hi Fabio,

Quoted 4 lines · Fabio Estevam

As we are able to build a same kernel that supports both mx27 and mx25, we should remove the ifdef's for CONFIG_MACH_MX27 in the mx2_camera driver.

Quoted 7 lines
Quoted 1 line

I'm still hoping to merge this

http://patchwork.linuxtv.org/patch/298/

patch, after it is suitably updated... Sascha, any progress?

Just sent an updated series. Let me know if I have to rebase it onto another branch. I tried to do this change mechanically which means that there might be further cleanups possible after my series, but I don't want to break a driver which I currently can't test.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |