From patchwork Mon Jun 6 17:02:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 852742 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p56H2rru003250 for ; Mon, 6 Jun 2011 17:02:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753289Ab1FFRCv (ORCPT ); Mon, 6 Jun 2011 13:02:51 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:61254 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889Ab1FFRCv (ORCPT ); Mon, 6 Jun 2011 13:02:51 -0400 Received: from axis700.grange (dslb-178-006-245-001.pools.arcor-ip.net [178.6.245.1]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MCdN8-1QLPzP1Te6-009Rfl; Mon, 06 Jun 2011 19:02:49 +0200 Received: by axis700.grange (Postfix, from userid 1000) id EF6D3189B78; Mon, 6 Jun 2011 19:02:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id E69A3189B77; Mon, 6 Jun 2011 19:02:48 +0200 (CEST) Date: Mon, 6 Jun 2011 19:02:48 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Linux Media Mailing List cc: Robert Jarzmik Subject: [PATCH] V4L: pxa_camera: remove redundant calculations Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:ssyVRhN9dHExZBmaD0m+8pYea8xTGx5i1RLUztj+JMP sZEm59e0tkGB3Acc0tE67Tks7fFiS2nAw1XZ9CCDTXMNGFljbO nkpfkB3+rKkuTRaDCZ5Ip7oVchlmD71+zK9hnRHnvNCxtYkfU6 c2yAYAVbu9TdtVvWeOG2eGS9gYbAk1jm/n65h8qS7Sd6B0HfDa seZP7z+RXzpoNtki0ihst3aOLac3dt45UAchMrhhZU= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 06 Jun 2011 17:02:53 +0000 (UTC) soc_camera core now performs the standard .bytesperline and .sizeimage calculations internally, no need to duplicate in drivers. Signed-off-by: Guennadi Liakhovetski --- 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)