{"id":16697,"url":"https://patchwork.libcamera.org/api/patches/16697/?format=json","web_url":"https://patchwork.libcamera.org/patch/16697/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220719221751.4159-1-laurent.pinchart@ideasonboard.com>","date":"2022-07-19T22:17:51","name":"[libcamera-devel] media: rkisp1: Add and use rkisp1_has_feature() macro","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"2ac47ff749c7c8f9034ab9d238e2b7ece8db7cb6","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16697/mbox/","series":[{"id":3305,"url":"https://patchwork.libcamera.org/api/series/3305/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3305","date":"2022-07-19T22:17:51","name":"[libcamera-devel] media: rkisp1: Add and use rkisp1_has_feature() macro","version":1,"mbox":"https://patchwork.libcamera.org/series/3305/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16697/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16697/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 3EF31BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Jul 2022 22:18:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9E71063312;\n\tWed, 20 Jul 2022 00:18:34 +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 DDA976048A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jul 2022 00:18:32 +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 0577B6DB;\n\tWed, 20 Jul 2022 00:18:31 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658269114;\n\tbh=1UQ2DWYkdJuPG1ovOYdbfxwr0S6/nQLbSjuND1B7970=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=Xm0aLTi40fo99SdS1DKJgJ7VKEGoiwcPBXLXh0tB4sb/JlhVY8SByFd3qqgdIV1JQ\n\tr91/2zlEdrEFdzE9ojYF4LPLw6frlDPzfl+C3y5cII/NHgpTADf/kO+GDr9x99/b6K\n\tRU1wSYz75KZ8kpCzf7cigaiyGw9i1l9r4tVz1T6GFX6J1P0q5urqC+mlTrEYhUMjnp\n\tlCodNwNSdMitiVZbTC8ZhAYr5dMcerMOiYoentbE0VfBTSz6qGhk8uZW18nhlWINHb\n\tNg/IkZ0W7dqQOLOcaOzcWtXMRmwKzY92Ntdw7NtG+anJK2CEdNPOvySckvde/3qWOh\n\t/iFU+SOeAorRw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658269112;\n\tbh=1UQ2DWYkdJuPG1ovOYdbfxwr0S6/nQLbSjuND1B7970=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=upD7Y032thaNCk/kk3HC3TyI20LPGsKFQiUGFpgIsAnE/llYS7TqZCF7q9/bnG33o\n\tWB6IoBqdi+PoIv98tneDTMbJts8yQhwv/fyida+qT8b2zvpm+Gm6Q3Cf4fpJZVmlCa\n\tdsmAxNK6F+VJXrSB4jW/CzmNvotmrpW9vAnui/D4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"upD7Y032\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 20 Jul 2022 01:17:51 +0300","Message-Id":"<20220719221751.4159-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] media: rkisp1: Add and use\n\trkisp1_has_feature() macro","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":"linux-rockchip@lists.infradead.org, Dafna Hirschfeld <dafna@fastmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Simplify feature tests with a macro that shortens lines.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../media/platform/rockchip/rkisp1/rkisp1-common.h |  3 +++\n .../media/platform/rockchip/rkisp1/rkisp1-dev.c    | 14 +++++++-------\n 2 files changed, 10 insertions(+), 7 deletions(-)","diff":"diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\nindex 8056997d5c29..0aae802464ac 100644\n--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n@@ -111,6 +111,9 @@ enum rkisp1_feature {\n \tRKISP1_FEATURE_MIPI_CSI2 = BIT(0),\n };\n \n+#define rkisp1_has_feature(rkisp1, feature) \\\n+\t((rkisp1)->info->features & RKISP1_FEATURE_##feature)\n+\n /*\n  * struct rkisp1_info - Model-specific ISP Information\n  *\ndiff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c\nindex f2475c6235ea..e348d8c86861 100644\n--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c\n+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c\n@@ -206,7 +206,7 @@ static int rkisp1_subdev_notifier_register(struct rkisp1_device *rkisp1)\n \t\tswitch (reg) {\n \t\tcase 0:\n \t\t\t/* MIPI CSI-2 port */\n-\t\t\tif (!(rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)) {\n+\t\t\tif (!rkisp1_has_feature(rkisp1, MIPI_CSI2)) {\n \t\t\t\tdev_err(rkisp1->dev,\n \t\t\t\t\t\"internal CSI must be available for port 0\\n\");\n \t\t\t\tret = -EINVAL;\n@@ -338,7 +338,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)\n \tunsigned int i;\n \tint ret;\n \n-\tif (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {\n+\tif (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {\n \t\t/* Link the CSI receiver to the ISP. */\n \t\tret = media_create_pad_link(&rkisp1->csi.sd.entity,\n \t\t\t\t\t    RKISP1_CSI_PAD_SRC,\n@@ -390,7 +390,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)\n \n static void rkisp1_entities_unregister(struct rkisp1_device *rkisp1)\n {\n-\tif (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)\n+\tif (rkisp1_has_feature(rkisp1, MIPI_CSI2))\n \t\trkisp1_csi_unregister(rkisp1);\n \trkisp1_params_unregister(rkisp1);\n \trkisp1_stats_unregister(rkisp1);\n@@ -423,7 +423,7 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)\n \tif (ret)\n \t\tgoto error;\n \n-\tif (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {\n+\tif (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {\n \t\tret = rkisp1_csi_register(rkisp1);\n \t\tif (ret)\n \t\t\tgoto error;\n@@ -590,7 +590,7 @@ static int rkisp1_probe(struct platform_device *pdev)\n \t\tgoto err_unreg_v4l2_dev;\n \t}\n \n-\tif (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {\n+\tif (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {\n \t\tret = rkisp1_csi_init(rkisp1);\n \t\tif (ret)\n \t\t\tgoto err_unreg_media_dev;\n@@ -611,7 +611,7 @@ static int rkisp1_probe(struct platform_device *pdev)\n err_unreg_entities:\n \trkisp1_entities_unregister(rkisp1);\n err_cleanup_csi:\n-\tif (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)\n+\tif (rkisp1_has_feature(rkisp1, MIPI_CSI2))\n \t\trkisp1_csi_cleanup(rkisp1);\n err_unreg_media_dev:\n \tmedia_device_unregister(&rkisp1->media_dev);\n@@ -630,7 +630,7 @@ static int rkisp1_remove(struct platform_device *pdev)\n \tv4l2_async_nf_cleanup(&rkisp1->notifier);\n \n \trkisp1_entities_unregister(rkisp1);\n-\tif (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)\n+\tif (rkisp1_has_feature(rkisp1, MIPI_CSI2))\n \t\trkisp1_csi_cleanup(rkisp1);\n \trkisp1_debug_cleanup(rkisp1);\n \n","prefixes":["libcamera-devel"]}