public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: video: mx2_camera: Remove ifdef's
@ 2012-02-16 18:25 Fabio Estevam
  2012-02-16 18:33 ` Baruch Siach
  2012-02-17  9:05 ` Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2012-02-16 18:25 UTC (permalink / raw)
  To: linux-media
  Cc: mchehab, g.liakhovetski, javier.martin, baruch, kernel,
	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.

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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: video: mx2_camera: Remove ifdef's
  2012-02-16 18:25 [PATCH] media: video: mx2_camera: Remove ifdef's Fabio Estevam
@ 2012-02-16 18:33 ` Baruch Siach
  2012-02-16 19:06   ` Guennadi Liakhovetski
  2012-02-17  9:05 ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2012-02-16 18:33 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: linux-media, mchehab, g.liakhovetski, javier.martin, kernel

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 

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: video: mx2_camera: Remove ifdef's
  2012-02-16 18:33 ` Baruch Siach
@ 2012-02-16 19:06   ` Guennadi Liakhovetski
  2012-02-17  9:11     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Guennadi Liakhovetski @ 2012-02-16 19:06 UTC (permalink / raw)
  To: Baruch Siach
  Cc: Fabio Estevam, Linux Media Mailing List, Mauro Carvalho Chehab,
	javier.martin, Sascha Hauer

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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: video: mx2_camera: Remove ifdef's
  2012-02-16 18:25 [PATCH] media: video: mx2_camera: Remove ifdef's Fabio Estevam
  2012-02-16 18:33 ` Baruch Siach
@ 2012-02-17  9:05 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-02-17  9:05 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: linux-media, mchehab, g.liakhovetski, javier.martin, baruch,
	kernel

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
> 
> 
> 

-- 
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 |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] media: video: mx2_camera: Remove ifdef's
  2012-02-16 19:06   ` Guennadi Liakhovetski
@ 2012-02-17  9:11     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-02-17  9:11 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Baruch Siach, Fabio Estevam, Linux Media Mailing List,
	Mauro Carvalho Chehab, javier.martin

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

-- 
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 |

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-17  9:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-16 18:25 [PATCH] media: video: mx2_camera: Remove ifdef's Fabio Estevam
2012-02-16 18:33 ` Baruch Siach
2012-02-16 19:06   ` Guennadi Liakhovetski
2012-02-17  9:11     ` Sascha Hauer
2012-02-17  9:05 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox