public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] V4L: pxa_camera: remove redundant calculations
@ 2011-06-06 17:02 Guennadi Liakhovetski
  2011-06-06 20:44 ` Robert Jarzmik
  0 siblings, 1 reply; 3+ messages in thread
From: Guennadi Liakhovetski @ 2011-06-06 17:02 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Robert Jarzmik

soc_camera core now performs the standard .bytesperline and .sizeimage
calculations internally, no need to duplicate in drivers.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/media/video/pxa_camera.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index b42bfa5..9968a6f 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -1499,16 +1499,10 @@ static int pxa_camera_try_fmt(struct soc_camera_device *icd,
 			      &pix->height, 32, 2048, 0,
 			      pixfmt == V4L2_PIX_FMT_YUV422P ? 4 : 0);
 
-	pix->bytesperline = soc_mbus_bytes_per_line(pix->width,
-						    xlate->host_fmt);
-	if (pix->bytesperline < 0)
-		return pix->bytesperline;
-	pix->sizeimage = pix->height * pix->bytesperline;
-
 	/* limit to sensor capabilities */
 	mf.width	= pix->width;
 	mf.height	= pix->height;
-	mf.field	= pix->field;
+	mf.field	= V4L2_FIELD_NONE;
 	mf.colorspace	= pix->colorspace;
 	mf.code		= xlate->code;
 
@@ -1596,8 +1590,12 @@ static int pxa_camera_suspend(struct soc_camera_device *icd, pm_message_t state)
 	pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3);
 	pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4);
 
-	if ((pcdev->icd) && (pcdev->icd->ops->suspend))
-		ret = pcdev->icd->ops->suspend(pcdev->icd, state);
+	if (pcdev->icd) {
+		struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+		ret = v4l2_subdev_call(sd, core, s_power, 0);
+		if (ret == -ENOIOCTLCMD)
+			ret = 0;
+	}
 
 	return ret;
 }
@@ -1618,8 +1616,12 @@ static int pxa_camera_resume(struct soc_camera_device *icd)
 	__raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR3);
 	__raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR4);
 
-	if ((pcdev->icd) && (pcdev->icd->ops->resume))
-		ret = pcdev->icd->ops->resume(pcdev->icd);
+	if (pcdev->icd) {
+		struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
+		ret = v4l2_subdev_call(sd, core, s_power, 1);
+		if (ret == -ENOIOCTLCMD)
+			ret = 0;
+	}
 
 	/* Restart frame capture if active buffer exists */
 	if (!ret && pcdev->active)
-- 
1.7.2.5


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

* Re: [PATCH] V4L: pxa_camera: remove redundant calculations
  2011-06-06 17:02 [PATCH] V4L: pxa_camera: remove redundant calculations Guennadi Liakhovetski
@ 2011-06-06 20:44 ` Robert Jarzmik
  2011-06-06 20:52   ` Guennadi Liakhovetski
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Jarzmik @ 2011-06-06 20:44 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: Linux Media Mailing List

On 06/06/2011 07:02 PM, Guennadi Liakhovetski wrote:
> soc_camera core now performs the standard .bytesperline and .sizeimage
> calculations internally, no need to duplicate in drivers.
Haven't I noticed that this patch is twofold :
  - the calculation duplication
  - the suspend/resume change from old suspend/resume to new v4l2_subdev 
power function

Shouldn't this patch have either the commit message amended, or even 
better be split into 2 distinct patches ?

Apart from that, the patch looks ok to me.

--
Robert

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

* Re: [PATCH] V4L: pxa_camera: remove redundant calculations
  2011-06-06 20:44 ` Robert Jarzmik
@ 2011-06-06 20:52   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2011-06-06 20:52 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: Linux Media Mailing List

On Mon, 6 Jun 2011, Robert Jarzmik wrote:

> On 06/06/2011 07:02 PM, Guennadi Liakhovetski wrote:
> > soc_camera core now performs the standard .bytesperline and .sizeimage
> > calculations internally, no need to duplicate in drivers.
> Haven't I noticed that this patch is twofold :
>  - the calculation duplication
>  - the suspend/resume change from old suspend/resume to new v4l2_subdev power
> function
> 
> Shouldn't this patch have either the commit message amended, or even better be
> split into 2 distinct patches ?

Oops, yes, indeed, will split, thanks for catching!

> Apart from that, the patch looks ok to me.

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

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

end of thread, other threads:[~2011-06-06 20:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06 17:02 [PATCH] V4L: pxa_camera: remove redundant calculations Guennadi Liakhovetski
2011-06-06 20:44 ` Robert Jarzmik
2011-06-06 20:52   ` Guennadi Liakhovetski

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