lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7bdd4118-8e09-4599-b8a3-2bbc2d65031e@ideasonboard.com>
Date: Mon, 8 Jan 2024 13:18:10 +0200
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: Paul Elder <paul.elder@...asonboard.com>, linux-media@...r.kernel.org,
 linux-rockchip@...ts.infradead.org, devicetree@...r.kernel.org
Cc: kieran.bingham@...asonboard.com, umang.jain@...asonboard.com,
 aford173@...il.com, Laurent Pinchart <laurent.pinchart@...asonboard.com>,
 Alexander Stein <alexander.stein@...tq-group.com>,
 Dafna Hirschfeld <dafna@...tmail.com>,
 Mauro Carvalho Chehab <mchehab@...nel.org>, Heiko Stuebner
 <heiko@...ech.de>,
 "moderated list:ARM/Rockchip SoC support"
 <linux-arm-kernel@...ts.infradead.org>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 01/10] media: rkisp1: Add and use rkisp1_has_feature()
 macro

On 06/01/2024 18:02, Paul Elder wrote:
> From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> 
> Simplify feature tests with a macro that shortens lines.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> Reviewed-by: Paul Elder <paul.elder@...asonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@...asonboard.com>
> Signed-off-by: Paul Elder <paul.elder@...asonboard.com>
> Tested-by: Alexander Stein <alexander.stein@...tq-group.com>
> Tested-by: Adam Ford <aford173@...il.com>
> ---
>   .../media/platform/rockchip/rkisp1/rkisp1-common.h |  3 +++
>   .../media/platform/rockchip/rkisp1/rkisp1-dev.c    | 14 +++++++-------
>   2 files changed, 10 insertions(+), 7 deletions(-)

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>

  Tomi

> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> index b757f75edecf..be6cb42776b0 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> @@ -119,6 +119,9 @@ enum rkisp1_feature {
>   	RKISP1_FEATURE_MIPI_CSI2 = BIT(0),
>   };
>   
> +#define rkisp1_has_feature(rkisp1, feature) \
> +	((rkisp1)->info->features & RKISP1_FEATURE_##feature)
> +
>   /*
>    * 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 73cf08a74011..44b753026ba2 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c
> @@ -207,7 +207,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;
> @@ -361,7 +361,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,
> @@ -413,7 +413,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);
> @@ -446,7 +446,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;
> @@ -629,7 +629,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;
> @@ -650,7 +650,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);
> @@ -671,7 +671,7 @@ static void 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);
>   


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ