From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Dafna Hirschfeld <dafna@fastmail.com>
Cc: Paul Elder <paul.elder@ideasonboard.com>,
linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Heiko Stuebner <heiko@sntech.de>,
Helen Koike <helen.koike@collabora.com>,
linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: Re: [PATCH v3 03/14] media: rkisp1: Add and use rkisp1_has_feature() macro
Date: Sat, 19 Nov 2022 19:18:56 +0200 [thread overview]
Message-ID: <Y3kQAC0g+9Tz/2tc@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20221119110322.4drj7qqtp46vjcnn@guri>
Hi Dafna,
On Sat, Nov 19, 2022 at 01:03:22PM +0200, Dafna Hirschfeld wrote:
> On 18.11.2022 18:39, Paul Elder wrote:
> > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > Simplify feature tests with a macro that shortens lines.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > ---
> > .../media/platform/rockchip/rkisp1/rkisp1-common.h | 3 +++
> > .../media/platform/rockchip/rkisp1/rkisp1-dev.c | 14 +++++++-------
> > 2 files changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> > index a1293c45aae1..fc33c185b99f 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> > @@ -111,6 +111,9 @@ enum rkisp1_feature {
> > RKISP1_FEATURE_MIPI_CSI2 = BIT(0),
> > };
> >
> > +#define rkisp1_has_feature(rkisp1, feature) \
> > + ((rkisp1)->info->features & RKISP1_FEATURE_##feature)
>
> maybe instead of that string concatination you can remove the
> 'RKISP1_FEATURE' prefix from the enum
We could, but I'm worried this would create short names subject to
namespace clashes (such as "MIPI_CSI2" for instance).
> > +
> > /*
> > * struct rkisp1_info - Model-specific ISP Information
> > *
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > index f2475c6235ea..e348d8c86861 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> > @@ -206,7 +206,7 @@ static int rkisp1_subdev_notifier_register(struct rkisp1_device *rkisp1)
> > switch (reg) {
> > case 0:
> > /* MIPI CSI-2 port */
> > - if (!(rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)) {
> > + if (!rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
> > dev_err(rkisp1->dev,
> > "internal CSI must be available for port 0\n");
> > ret = -EINVAL;
> > @@ -338,7 +338,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
> > unsigned int i;
> > int ret;
> >
> > - if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {
> > + if (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
> > /* Link the CSI receiver to the ISP. */
> > ret = media_create_pad_link(&rkisp1->csi.sd.entity,
> > RKISP1_CSI_PAD_SRC,
> > @@ -390,7 +390,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
> >
> > static void rkisp1_entities_unregister(struct rkisp1_device *rkisp1)
> > {
> > - if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)
> > + if (rkisp1_has_feature(rkisp1, MIPI_CSI2))
> > rkisp1_csi_unregister(rkisp1);
> > rkisp1_params_unregister(rkisp1);
> > rkisp1_stats_unregister(rkisp1);
> > @@ -423,7 +423,7 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
> > if (ret)
> > goto error;
> >
> > - if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {
> > + if (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
> > ret = rkisp1_csi_register(rkisp1);
> > if (ret)
> > goto error;
> > @@ -590,7 +590,7 @@ static int rkisp1_probe(struct platform_device *pdev)
> > goto err_unreg_v4l2_dev;
> > }
> >
> > - if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2) {
> > + if (rkisp1_has_feature(rkisp1, MIPI_CSI2)) {
> > ret = rkisp1_csi_init(rkisp1);
> > if (ret)
> > goto err_unreg_media_dev;
> > @@ -611,7 +611,7 @@ static int rkisp1_probe(struct platform_device *pdev)
> > err_unreg_entities:
> > rkisp1_entities_unregister(rkisp1);
> > err_cleanup_csi:
> > - if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)
> > + if (rkisp1_has_feature(rkisp1, MIPI_CSI2))
> > rkisp1_csi_cleanup(rkisp1);
> > err_unreg_media_dev:
> > media_device_unregister(&rkisp1->media_dev);
> > @@ -630,7 +630,7 @@ static int rkisp1_remove(struct platform_device *pdev)
> > v4l2_async_nf_cleanup(&rkisp1->notifier);
> >
> > rkisp1_entities_unregister(rkisp1);
> > - if (rkisp1->info->features & RKISP1_FEATURE_MIPI_CSI2)
> > + if (rkisp1_has_feature(rkisp1, MIPI_CSI2))
> > rkisp1_csi_cleanup(rkisp1);
> > rkisp1_debug_cleanup(rkisp1);
> >
--
Regards,
Laurent Pinchart
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2022-11-19 17:19 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 9:39 [PATCH v3 00/14] media: rkisp1: Add support for i.MX8MP Paul Elder
2022-11-18 9:39 ` [PATCH v3 01/14] dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible Paul Elder
2022-11-18 13:02 ` Krzysztof Kozlowski
2022-11-19 6:31 ` Paul Elder
2022-11-18 9:39 ` [PATCH v3 02/14] dt-bindings: media: rkisp1: Add i.MX8MP ISP example Paul Elder
2022-11-18 13:06 ` Krzysztof Kozlowski
2022-11-19 6:55 ` Paul Elder
2022-11-20 10:36 ` Krzysztof Kozlowski
2022-11-21 5:09 ` Paul Elder
2022-11-21 8:04 ` Krzysztof Kozlowski
2022-11-21 10:38 ` Laurent Pinchart
2022-11-21 11:16 ` Krzysztof Kozlowski
2022-11-21 13:50 ` Laurent Pinchart
2022-11-21 16:37 ` Krzysztof Kozlowski
2022-11-21 16:39 ` Krzysztof Kozlowski
2022-11-21 16:48 ` Laurent Pinchart
2022-11-19 16:59 ` Laurent Pinchart
2022-11-20 10:34 ` Krzysztof Kozlowski
2022-11-18 13:31 ` Rob Herring
2022-11-19 6:33 ` Paul Elder
2022-11-18 9:39 ` [PATCH v3 03/14] media: rkisp1: Add and use rkisp1_has_feature() macro Paul Elder
2022-11-19 11:03 ` Dafna Hirschfeld
2022-11-19 17:18 ` Laurent Pinchart [this message]
2022-11-18 9:39 ` [PATCH v3 04/14] media: rkisp1: Add match data for i.MX8MP ISP Paul Elder
2023-10-18 17:41 ` Adam Ford
2022-11-18 9:39 ` [PATCH v3 05/14] media: rkisp1: Configure gasket on i.MX8MP Paul Elder
2022-11-18 9:39 ` [PATCH v3 06/14] media: rkisp1: Add and set registers for crop for i.MX8MP Paul Elder
2022-11-18 9:39 ` [PATCH v3 07/14] media: rkisp1: Add and set registers for output size config on i.MX8MP Paul Elder
2022-11-18 9:39 ` [PATCH v3 08/14] media: rkisp1: Add i.MX8MP-specific registers for MI and resizer Paul Elder
2022-11-18 9:39 ` [PATCH v3 09/14] media: rkisp1: Shift DMA buffer addresses on i.MX8MP Paul Elder
2022-11-18 9:39 ` [PATCH v3 10/14] media: rkisp1: Add register definitions for the test pattern generator Paul Elder
2022-11-18 9:39 ` [PATCH v3 11/14] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP Paul Elder
2022-11-18 9:39 ` [PATCH v3 12/14] media: rkisp1: Support devices without self path Paul Elder
2022-11-18 9:39 ` [PATCH v3 13/14] media: rkisp1: Add YC swap capability Paul Elder
2022-11-18 9:39 ` [PATCH v3 14/14] media: rkisp1: Add UYVY as an output format Paul Elder
[not found] ` <CAHCN7x+9E8qcBVOQZKTKagDkvkKVnqDtjvpNX-iNFYwCLRoYug@mail.gmail.com>
2023-02-15 23:55 ` [PATCH v3 00/14] media: rkisp1: Add support for i.MX8MP Laurent Pinchart
2023-02-18 16:14 ` Adam Ford
2023-02-23 10:58 ` Jacopo Mondi
2023-02-22 23:39 ` Adam Ford
2023-02-23 13:57 ` Jacopo Mondi
2023-02-23 14:26 ` Laurent Pinchart
2023-02-23 16:10 ` Adam Ford
2023-02-23 16:25 ` Laurent Pinchart
2023-02-24 18:24 ` Nicolas Dufresne
2023-02-24 18:46 ` Adam Ford
2023-03-21 14:43 ` Tommaso Merciai
2023-07-18 8:31 ` Hans Verkuil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y3kQAC0g+9Tz/2tc@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=dafna@fastmail.com \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=helen.koike@collabora.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=paul.elder@ideasonboard.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox