[{"id":23991,"web_url":"https://patchwork.libcamera.org/comment/23991/","msgid":"<20220720091536.atwmju6pfhfekwim@uno.localdomain>","date":"2022-07-20T09:15:36","subject":"Re: [libcamera-devel] [PATCH] media: rkisp1: Add and use\n\trkisp1_has_feature() macro","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Wed, Jul 20, 2022 at 01:17:51AM +0300, Laurent Pinchart via libcamera-devel wrote:\n> Simplify feature tests with a macro that shortens lines.\n>\n> Signed-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(-)\n>\n> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n> index 8056997d5c29..0aae802464ac 100644\n> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n\nWas this meant for linux-media ? :)\n\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>   *\n> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c\n> index 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> --\n> Regards,\n>\n> Laurent Pinchart\n>","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 EF647BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Jul 2022 09:15:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2390263313;\n\tWed, 20 Jul 2022 11:15:41 +0200 (CEST)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4B4EF60488\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jul 2022 11:15:39 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 50945240004;\n\tWed, 20 Jul 2022 09:15:38 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658308541;\n\tbh=SPHOlfOlhwyCvuz5GleoPckQ8oXscBJtd/odATE3InA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=vtms4L+AumEm0xnWX/oA5OcyDl5vBFdutfOnWE6Kjc3TG6U0PrlJ0AVUhG7JJCSKI\n\t/FlIKxip78d4yBJ83gs/B1tfQolaO4aME8oFPN+UbWFv1i7Xh6vQeBvfqpQ+TtP4N3\n\tzKZseTXkiLTXTt4BawDstsBEe+JKr5c3ADlQi96PfiKBXfLofTJ1ii6Hg9/fAzMrxC\n\tPyThJ508hfRCq9S7hnUCKAGJlIenKhqS+n26yQR7QPIuABobySlNgao1ajFt0H5zgq\n\tun7UxE8ZSscE+E+VK4oOUvaPcRLGLPtt5KapyWDO2AjUMHkomd/v5rmomcqH/WhUWW\n\tc0SSdMe1u22yg==","Date":"Wed, 20 Jul 2022 11:15:36 +0200","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220720091536.atwmju6pfhfekwim@uno.localdomain>","References":"<20220719221751.4159-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220719221751.4159-1-laurent.pinchart@ideasonboard.com>","Subject":"Re: [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":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"linux-rockchip@lists.infradead.org, libcamera-devel@lists.libcamera.org, \n\tDafna Hirschfeld <dafna@fastmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":23994,"web_url":"https://patchwork.libcamera.org/comment/23994/","msgid":"<YtfJh/0DWxe/98QD@pendragon.ideasonboard.com>","date":"2022-07-20T09:23:19","subject":"Re: [libcamera-devel] [PATCH] media: rkisp1: Add and use\n\trkisp1_has_feature() macro","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Wed, Jul 20, 2022 at 11:15:36AM +0200, Jacopo Mondi wrote:\n> On Wed, Jul 20, 2022 at 01:17:51AM +0300, Laurent Pinchart via libcamera-devel wrote:\n> > Simplify feature tests with a macro that shortens lines.\n> >\n> > Signed-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(-)\n> >\n> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n> > index 8056997d5c29..0aae802464ac 100644\n> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h\n> \n> Was this meant for linux-media ? :)\n\nYes, I realized just after sending, and sent another one to linux-media.\nI need to write a git-send-email wrapper that will validate recipients\nbased on the content of the patches... Sorry for the noise.\n\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> >   *\n> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c\n> > index 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> >","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 47245BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 20 Jul 2022 09:23:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B097C63313;\n\tWed, 20 Jul 2022 11:23:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 18BB960488\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 20 Jul 2022 11:23:54 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5BBD06DB;\n\tWed, 20 Jul 2022 11:23:53 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658309035;\n\tbh=RpPl9cL1oqAlCUZ6Z+EF4kC8MQCB0XzQjdVQjdAWtw8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=emTj+quKI+444riqFn65zqPp+QN6aqWi5onUQlfJUyQ1bhNM+iLBP9vS2tCV75KMN\n\tRC8VaZn5AFHGm0+zApK18XbS4Q2WdjW0myRZKtuKW+0poc4iiASoPfoij/TTShjyQC\n\tfE+bkyWP/f1hGcV3kQCJ7pr2OW6cREyVoNIYfOv/6HHrt4wFRanQGic4Zc7/nR5Dqe\n\tEDBWA3BkakUVGpsMMiP/m+5oWLx70ayBn1M/bh1jicrdDH9sYS5zeLD9GcLDrsCo8x\n\tWMaRSaO+aOBskSv0vgzRwSp8Vfb2C9DmSxS4GkTCVJEwdqtp3mYC5W5+G8ydaN2RmO\n\t5YG1cimsLaTuQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658309033;\n\tbh=RpPl9cL1oqAlCUZ6Z+EF4kC8MQCB0XzQjdVQjdAWtw8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=n0y/40ZVQcRQI3KjtLNZ/IV04ijikHJ7kd6jJ83fisCP3Qr7uOPb7HQszyMnS6Q8j\n\trdAgJ/plpQGwD+rbUNYe4++RNVngVrl1qs0duwMdmRczCodoSp2KKv3Pk6fGGFHODz\n\tIto+/3gVrDqInUBBtPBQdO/vPiP6YKnVrwmVeBfw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"n0y/40ZV\"; dkim-atps=neutral","Date":"Wed, 20 Jul 2022 12:23:19 +0300","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YtfJh/0DWxe/98QD@pendragon.ideasonboard.com>","References":"<20220719221751.4159-1-laurent.pinchart@ideasonboard.com>\n\t<20220720091536.atwmju6pfhfekwim@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220720091536.atwmju6pfhfekwim@uno.localdomain>","Subject":"Re: [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, libcamera-devel@lists.libcamera.org, \n\tDafna Hirschfeld <dafna@fastmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]