From patchwork Sat Jan 6 16:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 185647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp174514dyq; Sat, 6 Jan 2024 08:04:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGK34Opnp6av/ns6xqNkroKErQz+fmCFgwh4EeUIFXO0WrEw+K9sUBniiwwAZ6cDWCk1UIf X-Received: by 2002:a05:620a:f:b0:783:d45:7dc1 with SMTP id j15-20020a05620a000f00b007830d457dc1mr1309650qki.136.1704557054230; Sat, 06 Jan 2024 08:04:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704557054; cv=none; d=google.com; s=arc-20160816; b=vTSEhyuGSVPPDAwXBsrdk9SiSYBZD19FOs2JOLTICveH8vWXK3Y/9/Fgv7bxHl0jl/ BOzTwyT+8Cz9DTzkuydOfT/qLAXDQulWU6UV6CnCwprqpmgutjPuhHLyKM4/hVz9nzDS W33QRei1lnKxOu3JNnI/t0CupoNiM5uIvYWMzov4uW4+iSZEkJUk+jqklNohhCpPzFfD G3HdC79qEbi9CZlRWq7fc5w+uVgWWjoq4hRDSWKhv41SU51bQyVNZPQIANB97Qnu55Rw B+ThpvdQ0MoYvtKkzFS7zEgwjuG+DrvYhGSlAUJRAXWEjD48ZiyegUZyItX2+Fb8CALG 7ofQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18639-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bj9-20020a05620a190900b0078307df7c59si4255908qkb.257.2024.01.06.08.04.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 08:04:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18639-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18639-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0ACFE1C216A3 for ; Sat, 6 Jan 2024 16:04:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 823F3C135; Sat, 6 Jan 2024 16:02:57 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787357617918173047 X-GMAIL-MSGID: 1787357617918173047 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 +++ .../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);