media: video: mx2_camera: Remove ifdef's

Message ID 1329416739-23566-1-git-send-email-fabio.estevam@freescale.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Fabio Estevam Feb. 16, 2012, 6:25 p.m. UTC
  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.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/media/video/mx2_camera.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
  

Comments

Baruch Siach Feb. 16, 2012, 6:33 p.m. UTC | #1
Hi Fabio,

On Thu, Feb 16, 2012 at 04:25:39PM -0200, Fabio Estevam wrote:
> 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.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Acked-by: Baruch Siach <baruch@tkos.co.il>

baruch
  
Guennadi Liakhovetski Feb. 16, 2012, 7:06 p.m. UTC | #2
Hi

On Thu, 16 Feb 2012, Baruch Siach wrote:

> Hi Fabio,
> 
> On Thu, Feb 16, 2012 at 04:25:39PM -0200, Fabio Estevam wrote:
> > 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.
> > 
> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Acked-by: Baruch Siach <baruch@tkos.co.il>

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/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Sascha Hauer Feb. 17, 2012, 9:05 a.m. UTC | #3
On Thu, Feb 16, 2012 at 04:25:39PM -0200, Fabio Estevam wrote:
> 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

> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/media/video/mx2_camera.c |   22 +++-------------------
>  1 files changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> index 04aab0c..afb4619 100644
> --- a/drivers/media/video/mx2_camera.c
> +++ b/drivers/media/video/mx2_camera.c
> @@ -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);
> -- 
> 1.7.1
> 
> 
>
  
Sascha Hauer Feb. 17, 2012, 9:11 a.m. UTC | #4
Hi Guennadi,

On Thu, Feb 16, 2012 at 08:06:16PM +0100, Guennadi Liakhovetski wrote:
> Hi
> 
> On Thu, 16 Feb 2012, Baruch Siach wrote:
> 
> > Hi Fabio,
> > 
> > On Thu, Feb 16, 2012 at 04:25:39PM -0200, Fabio Estevam wrote:
> > > 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.
> > > 
> > > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> > 
> > Acked-by: Baruch Siach <baruch@tkos.co.il>
> 
> 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
  

Patch

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 04aab0c..afb4619 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -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);