Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp763931rdb; Sat, 6 Jan 2024 08:04:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoRLp0viApMapnwuJWU/mBm+PPlJI4Vevw67u5rdYa8iyLMAtqskc0lYCYRTWEVwx4CCYf X-Received: by 2002:a05:6402:2684:b0:557:4a49:26b0 with SMTP id w4-20020a056402268400b005574a4926b0mr1430009edd.20.1704557046016; Sat, 06 Jan 2024 08:04:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704557046; cv=none; d=google.com; s=arc-20160816; b=IE8pjwtKsYTSYKwiAXKhzbmA8DIfZhtXUxh73H/uSeV5kgIKuxSTPAaWRQAK6BkJsT Gglo9ox9WfcRArTpGFo7KhH3LCqYmh7NrGEoipEcG2QCkeP0urgOG4/p9fD2MoJrhBx4 UOUsVG28Q633hQBPpYi25X0PZLvjGb03LzDr5fpct1HlBJSO8t38ErPvh2lWaPef9yVz 5Li8SpZGJbxOfXD5iUpqP8XBCQb/WlFsgeRLe1jndcKsHhyQ6ZQGqhlRP1zwnuSvTrYq +Ig30f1vJ4w5s87fm6CHTXErbCmKGrpl8e3LfsfJorUN9Rl2jQgz8Ki6ttLUIsvNtFxF ZkUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=saddK8UboEB9RTR/bulv1poL50JAThyWaQ0wPv4ss98=; fh=9IRI59iCI58IZxOvQ4Ey/yXQqZDHRz9ZR5rbMI4NWbE=; b=AvmE/jaPWHm3M0x4Zy0Z3pK5fW2maArprAaQExyXRGnkMTnTYEtJ3xPLIZEc2N0ZEY pLYG+avtboNdOdQieDPV8M/V0WCVpKrA/8VdqcN+sP/78z40QUe0450Qwh/hDLpzGAYy dJsSjaBeUZCBPLtZ8GeQE89mCeaESsXIxozTE2WAKO2GCy+bnQuJq4cF9MrSxoe2mX/H hDCk+CdZuWqNTIm6zJByC9K4b5LOdzmsUMh7M5QIVMD9o0D2/rGCTp45gwDJ6KcUJbRR jZAMHIo8XEL0gHeDOCfRwrLZOomHhaufj+EONymrB6eNcOZzZ3VtYCmZBaC8xGO2hbWW CliA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=capnab7f; spf=pass (google.com: domain of linux-kernel+bounces-18639-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18639-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 12-20020a50874c000000b005573c6979a6si1185650edv.403.2024.01.06.08.04.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 08:04:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18639-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=capnab7f; spf=pass (google.com: domain of linux-kernel+bounces-18639-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18639-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 975C21F227E3 for ; Sat, 6 Jan 2024 16:04:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3CDB883A; Sat, 6 Jan 2024 16:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="capnab7f" X-Original-To: linux-kernel@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AB59847E; Sat, 6 Jan 2024 16:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pyrite.hamster-moth.ts.net (unknown [IPv6:2001:268:c203:a8ee:6c57:4243:1eb3:6cb]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3EC3812E4; Sat, 6 Jan 2024 17:01:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1704556908; bh=w0dY0ZRRHmHra5ns6Sz/IckO8op3Fv35gY8Zs1hyhnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=capnab7fVTt9nYEfnRN2uOag2Ij86t0wZDeJ1rY9kwKEtEB9iMKbGQMg+cnCvlvxQ DHmBe9ZytFct9JWvXC6wSTJjZqewmy0FMXliG4MGdiBFtr91H+jIr56dMkzlEhZ6zm W3qYO+SQl8h4WHWKQAKmmAjw3WYxenK9ZCNHU4Ho= From: Paul Elder To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org Cc: kieran.bingham@ideasonboard.com, tomi.valkeinen@ideasonboard.com, umang.jain@ideasonboard.com, aford173@gmail.com, Laurent Pinchart , Paul Elder , Alexander Stein , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 01/10] media: rkisp1: Add and use rkisp1_has_feature() macro Date: Sun, 7 Jan 2024 01:02:12 +0900 Message-Id: <20240106160221.4183409-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240106160221.4183409-1-paul.elder@ideasonboard.com> References: <20240106160221.4183409-1-paul.elder@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Laurent Pinchart Simplify feature tests with a macro that shortens lines. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham Signed-off-by: Paul Elder Tested-by: Alexander Stein Tested-by: Adam Ford --- .../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 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); -- 2.39.2