From patchwork Thu Jan 11 11:48:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 187318 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1387932dyi; Thu, 11 Jan 2024 03:49:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGidXqG03qt6KwcqelRYE6spYT4ejLYVDNaOWyx5PL2SQ3w+QwM6CKR7mEzSrHWMZcUf5t0 X-Received: by 2002:aa7:c58c:0:b0:557:9018:9980 with SMTP id g12-20020aa7c58c000000b0055790189980mr536470edq.52.1704973752132; Thu, 11 Jan 2024 03:49:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704973752; cv=none; d=google.com; s=arc-20160816; b=dvN4nBHZkmMkK8H5H3zzwSFuCVMZhAKg5FiNhFyBvfAU4VUYiJs/dhn0Dc2tyURtyr owcUzKLwTw7AIjMzBzO5M9knEHYqISSymEGwkSOAqTzaZv0PrdEm+jE2YP28tnYlCaVq /9E/4hBXNuJY2avOpBToCqbc0YrLJJbOvSngRaKEJCsjpNItR3TjZszDBcNwcsHDKIrj uwFGz5g5R6f2at5dn/1zwqwkjDcjk8LKzB4zgyZNyJLp1J4nBlUHPx7YsWiCKL8R1D63 +yexKMNijra7rLtmD+RjLYpVTqrdyb7yE4FyX9cbGRm8fuixvDfz7WSmlopVPVq2Fvw/ dcWg== 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=rA/IH/pxTlYXh++5uPPNiTk1OLwAJc2Cayj/iwcFguI=; fh=9IRI59iCI58IZxOvQ4Ey/yXQqZDHRz9ZR5rbMI4NWbE=; b=ZOhDmm424PwIzd3bepxCxV7egt77gMra923m6MNeg2w4oz0AfqcDA9eLYluSdgeVoK 1WPzRpaObPeTjtKC30k9yVwpCltcH2PMTy0zgfCLDJ4FSGHYSGLAS37XtKk6FbHrJs1E M6BD4mxTEYMG0p0KJsCoYzV7kAXUMPQBbahP6hyK6zGqcUU68kM/6MgUm504zHv8yD0z rpbA/xIixnQdwX992/st9890T/xlpFKhYylsQDuzs3nUVVFEvRr5fym0tra/BkfyGi6W Uww2ON0qdVABptdMrbrjpgSLHOe+YnuLTHEWVQ+F8Ja9GZrbZt3vN9TKT8TgQkEgqOLQ 8lzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=p4nwgkiy; spf=pass (google.com: domain of linux-kernel+bounces-23510-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23510-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n9-20020a056402060900b00552f7414417si452351edv.575.2024.01.11.03.49.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 03:49:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23510-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=p4nwgkiy; spf=pass (google.com: domain of linux-kernel+bounces-23510-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23510-ouuuleilei=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 BCF861F2382D for ; Thu, 11 Jan 2024 11:49:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42EB9156DA; Thu, 11 Jan 2024 11:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="p4nwgkiy" 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 D5DC115495; Thu, 11 Jan 2024 11:48:54 +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 (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CA49EC85; Thu, 11 Jan 2024 12:47:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1704973666; bh=mnfiq9V4ke1JzZzn2ucgUeU305wKiCXWHBl8l5EJxXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p4nwgkiyM3xkkviisa4IQY0nMaLohy4OHHeeXujoh2FCqhU5NEgASN6jhxe7QIP4B 11F4EQTzukyaHOoXAY/if2VgNPGoicvrnA1mDHsmYJDEhOYQLmEdeLhqv0TfYUfC85 8lAvEGOjyFurefD4TKMCYZD593B9R+XthdaqFA5k= 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 v6 01/11] media: rkisp1: Add and use rkisp1_has_feature() macro Date: Thu, 11 Jan 2024 20:48:21 +0900 Message-Id: <20240111114831.656736-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240111114831.656736-1-paul.elder@ideasonboard.com> References: <20240111114831.656736-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787794556887776288 X-GMAIL-MSGID: 1787794556887776288 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 Reviewed-by: Tomi Valkeinen --- .../media/platform/rockchip/rkisp1/rkisp1-common.h | 3 +++ drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 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..fd35fe76413a 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; @@ -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);