From patchwork Wed Sep 7 13:48:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 1127522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p87GW2cA019540 for ; Wed, 7 Sep 2011 16:32:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752233Ab1IGQax (ORCPT ); Wed, 7 Sep 2011 12:30:53 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:49345 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752194Ab1IGQaw (ORCPT ); Wed, 7 Sep 2011 12:30:52 -0400 Received: from axis700.grange (dslb-178-006-246-092.pools.arcor-ip.net [178.6.246.92]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MLC4r-1R11V80u0X-0005cN; Wed, 07 Sep 2011 15:48:07 +0200 Received: by axis700.grange (Postfix, from userid 1000) id E387C18B03C; Wed, 7 Sep 2011 15:48:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id E148B18B03B; Wed, 7 Sep 2011 15:48:05 +0200 (CEST) Date: Wed, 7 Sep 2011 15:48:05 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Linux Media Mailing List cc: Bastian Hecht Subject: [PATCH] V4L: sh-mobile-ceu-camera: fix mixed CSI2 & parallel camera case Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:TcG0PCliDFky+umF12G1bQDGtmjeU5jwSJM1BI2IGvG 8hnHN6M1LMkr8eLC/u4bSKEDcKE0WFNkpmNkhNZPiK607fdtrK BaPlvyl3+qjuJ17prmWSyvSy2VeQkIApTNIiMFFG7TP6l1E9uZ pjHLA19NOqBf9CcfohXah+Lx6+93gxl6T+kEvKg/Y7gJmtGI2/ cdygqJJX18597sw7A2SHGxHxyW73GpQGe5QVCCS8LW4ePcognH ISi2cB9FvCiqc6MqeA99LbeeifIhgamBvI7q/VPRuYTh7vZYN7 u2BWMrbSL7Lkj9GcTFVzXcuBSpdXsB0pG6ho2I3H66gul1RjkL dCiV6h0dpUSvtO0lH0MVVddTzWnLEnpKTIUhUzZ7kiwZbBpFTg M+VtkCuU0Rgig== 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 (demeter2.kernel.org [140.211.167.43]); Wed, 07 Sep 2011 16:32:03 +0000 (UTC) The current sh_mobile_ceu_camera driver can cause an Oops, if a CSI2 and a parallel camera are registered on the same CEU. Fix it by making CSI2 association with a camera more targeted. Reported-by: Bastian Hecht Signed-off-by: Guennadi Liakhovetski --- drivers/media/video/sh_mobile_ceu_camera.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index dedc981..8b344d4 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c @@ -717,10 +717,13 @@ static void capture_restore(struct sh_mobile_ceu_dev *pcdev, u32 capsr) static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev, struct soc_camera_device *icd) { - if (!pcdev->csi2_pdev) - return soc_camera_to_subdev(icd); + if (pcdev->csi2_pdev) { + struct v4l2_subdev *csi2_sd = find_csi2(pcdev); + if (csi2_sd && csi2_sd->grp_id == (u32)icd) + return csi2_sd; + } - return find_csi2(pcdev); + return soc_camera_to_subdev(icd); } #define CEU_BUS_FLAGS (V4L2_MBUS_MASTER | \