{"id":15888,"url":"https://patchwork.libcamera.org/api/1.1/patches/15888/?format=json","web_url":"https://patchwork.libcamera.org/patch/15888/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220510115147.19360-49-laurent.pinchart@ideasonboard.com>","date":"2022-05-10T11:51:45","name":"[libcamera-devel,48/50] staging: media: imx: imx7-media-csi: Inline imx7_csi_enum_pixel_formats()","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"f155a3e99b211ad14ce445710d22fa696196402e","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15888/mbox/","series":[{"id":3106,"url":"https://patchwork.libcamera.org/api/1.1/series/3106/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3106","date":"2022-05-10T11:50:57","name":"staging: media: imx: Prepare destaging of imx7-media-csi","version":1,"mbox":"https://patchwork.libcamera.org/series/3106/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15888/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15888/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 380D9C327E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 May 2022 11:52:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D2515656AB;\n\tTue, 10 May 2022 13:52:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D5DA656B4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:38 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 22FBAB9A;\n\tTue, 10 May 2022 13:52:37 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183566;\n\tbh=7n8of1MXRoPvO3JeUjedG56zxX0gutOm/D21RqQZXt4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=bKU2n3qfhSOZ5p1vnh9Bld1krjmDufCvKgEOkAMgBft+aWndMbwGCRks4dc+a9S16\n\tmTms+aDrIjsI/IvAdV2EyLR6AbOi54NRCauIkKUJ1VM2A1EsUyvwGToG/d4RTtdNC1\n\tSzN8eVELcIceUvFgu8u287MZkcCmTWBAWDnCfFSRauoa97DDVeFiP0tRYROFCQ1iBk\n\tCYGd8jxxji1sLmBnGnRZcCciwEo1hZKyeDU0d0GV65tw3TysgJksJEo808fM5e5SE4\n\tOTLyQs8RyhlbqG6jJ4bbrPhKE6OoMVdXurOmoQetS0q6XI5i/MX1NVlD0yCl9mvVTe\n\thEuac61z1d60g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183557;\n\tbh=7n8of1MXRoPvO3JeUjedG56zxX0gutOm/D21RqQZXt4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=at/UC7Gvq23CNRSgW5N5LvJFd7FiDBATlYtU5Vj5GRlCggDZSQ+OTlRVaF+0MpK1y\n\tLY1HRF27lbidJW0UrlzpTD3J1tBYweQkNVakfw68JtsT2x+MQucXF6A/giYRiklFO6\n\tkKvAH3oSve/2rEtm+P4u7lIvJNgyhuj5JSPCPtbA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"at/UC7Gv\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 10 May 2022 14:51:45 +0300","Message-Id":"<20220510115147.19360-49-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>","References":"<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 48/50] staging: media: imx:\n\timx7-media-csi: Inline imx7_csi_enum_pixel_formats()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Martin Kepplinger <martin.kepplinger@puri.sm>, kernel@pengutronix.de,\n\tDorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,\n\tAlexander Stein <alexander.stein@ew.tq-group.com>,\n\tRui Miguel Silva <rmfrfs@gmail.com>,\n\tPhilipp Zabel <p.zabel@pengutronix.de>, \n\tSteve Longerbeam <slongerbeam@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Inline the imx7_csi_enum_pixel_formats() function in its only caller.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 84 +++++++++-------------\n 1 file changed, 34 insertions(+), 50 deletions(-)","diff":"diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex 8be6f40588af..0bf69933f1bd 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -954,54 +954,6 @@ static const struct imx7_csi_pixfmt *imx7_csi_find_mbus_format(u32 code)\n \treturn NULL;\n }\n \n-/*\n- * Enumerate entries in the pixel_formats[] array that match the\n- * requested selection criteria. Return the fourcc that matches the\n- * selection criteria at the requested match index.\n- *\n- * @fourcc: The returned fourcc that matches the search criteria at\n- *          the requested match index.\n- * @index: The requested match index.\n- * @code: If non-zero, only include in the enumeration entries matching this\n- *\tmedia bus code.\n- */\n-static int imx7_csi_enum_pixel_formats(u32 *fourcc, u32 index, u32 code)\n-{\n-\tunsigned int i;\n-\n-\tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n-\t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n-\n-\t\t/*\n-\t\t * If a media bus code is specified, only consider formats that\n-\t\t * match it.\n-\t\t */\n-\t\tif (code) {\n-\t\t\tunsigned int j;\n-\n-\t\t\tif (!fmt->codes)\n-\t\t\t\tcontinue;\n-\n-\t\t\tfor (j = 0; fmt->codes[j]; j++) {\n-\t\t\t\tif (code == fmt->codes[j])\n-\t\t\t\t\tbreak;\n-\t\t\t}\n-\n-\t\t\tif (!fmt->codes[j])\n-\t\t\t\tcontinue;\n-\t\t}\n-\n-\t\tif (index == 0) {\n-\t\t\t*fourcc = fmt->fourcc;\n-\t\t\treturn 0;\n-\t\t}\n-\n-\t\tindex--;\n-\t}\n-\n-\treturn -EINVAL;\n-}\n-\n /*\n  * Enumerate entries in the pixel_formats[] array that match the\n  * requested search criteria. Return the media-bus code that matches\n@@ -1088,8 +1040,40 @@ static int imx7_csi_video_querycap(struct file *file, void *fh,\n static int imx7_csi_video_enum_fmt_vid_cap(struct file *file, void *fh,\n \t\t\t\t\t   struct v4l2_fmtdesc *f)\n {\n-\treturn imx7_csi_enum_pixel_formats(&f->pixelformat, f->index,\n-\t\t\t\t\t   f->mbus_code);\n+\tunsigned int index = f->index;\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n+\t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n+\n+\t\t/*\n+\t\t * If a media bus code is specified, only consider formats that\n+\t\t * match it.\n+\t\t */\n+\t\tif (f->mbus_code) {\n+\t\t\tunsigned int j;\n+\n+\t\t\tif (!fmt->codes)\n+\t\t\t\tcontinue;\n+\n+\t\t\tfor (j = 0; fmt->codes[j]; j++) {\n+\t\t\t\tif (f->mbus_code == fmt->codes[j])\n+\t\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tif (!fmt->codes[j])\n+\t\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (index == 0) {\n+\t\t\tf->pixelformat = fmt->fourcc;\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\tindex--;\n+\t}\n+\n+\treturn -EINVAL;\n }\n \n static int imx7_csi_video_enum_framesizes(struct file *file, void *fh,\n","prefixes":["libcamera-devel","48/50"]}