Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp391758rwb; Fri, 18 Nov 2022 03:04:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ePgrne3LCuJqpAhlGtF3Z7NKi8AT/m5IwOFjWbldUo8hp8l/Hz4B+A0hNbzfmeasDjt4m X-Received: by 2002:a17:90b:ed1:b0:210:a844:217c with SMTP id gz17-20020a17090b0ed100b00210a844217cmr7493059pjb.150.1668769452675; Fri, 18 Nov 2022 03:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668769452; cv=none; d=google.com; s=arc-20160816; b=XyRmUhEK/2q7taec22dSyHK6FNYKfnRkiE8KRuBePdyvWQ0RBtdQb537IZVfDpTH+V iKQriVTJ3BGv5CrX4vB7V6ZuugV5iaVl8Tw1Pis4wvM79CeMBR/M+QW4o3+hHhhfjZRY dSUTjmS9ZycKRCtEojNCQuVAaoGfw9IPDyyKWdYC8ulINadxmhONBcluJxPFZin1HETe HdnZV3wjilvTiGnIslwI0juPCsbLczOPLilGJ2OjPyqiVaKmLatQh0pVWK4CcDfE1NJU mFMDO9MQ8JdPF6a+9b9ogut8XnB6oMYRFCJiyw0K2IhA0yH5qs6h4nVx1uJIvsG6nnn8 HS3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7g7OGlr33lPgUKZCY+qLXjEy8ltE5xf7xX45nzkquXg=; b=zXjEtuMPTLYcczADxUQyc6mc63a+ec1uBefe81zCsEYjImWc8QXGqVWak4yzvVZAjI Gz0qSbVuYlHb/WKk4IgPqcbs27FicOZinzBc/BP5QNYTAjqdeF4pGW/KcWL5kW8Vx+ex ZvcaEZ0G1L+m0S5zZJIvm08L2ZSRUaEoNmCN3oF8XMjQ3Vf8X1g5EN3rj/8n8J1/WdDk n4Ci2ci5sVuj05nfGycRHqqKvaEMEqN+et79tuAGN+qmYc5SFfI7I1EX1RHa408AZqtp 3jj4Ax1HJ9PByklbP0RGYX3BMj+dmzcu8gtj/SICuhdnXKBAzwyj+AFNy6mWxDzfXnj+ 1uSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wlgC7FOU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mi12-20020a17090b4b4c00b0021409ca96c2si3471239pjb.23.2022.11.18.03.03.49; Fri, 18 Nov 2022 03:04:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=wlgC7FOU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241865AbiKRJkI (ORCPT + 91 others); Fri, 18 Nov 2022 04:40:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241483AbiKRJj5 (ORCPT ); Fri, 18 Nov 2022 04:39:57 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47FA1F56; Fri, 18 Nov 2022 01:39:55 -0800 (PST) Received: from pyrite.tail37cf.ts.net (h175-177-042-159.catv02.itscom.jp [175.177.42.159]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 405F0CCA; Fri, 18 Nov 2022 10:39:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1668764394; bh=5t/ucmG2f3kjgz2FxveRnt1opFwQLLzUJPJbVA+q+ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wlgC7FOUDssJUGL5kIKi0W5g4fg5jtk1ezJJqkUGrVJQDkFMTwMzabBYSvot8UtRi DRGwXpez86P6PeNhHbtbkeIaXN08BxmRzCfqGirjJcS7VvcxtyzMd9d7HQk291Tzkb 5lonx3dajuiNhlXGAzCWYm7T/fkNUdb7fSzKzHPs= From: Paul Elder To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Dafna Hirschfeld , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Helen Koike , linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Paul Elder , Kieran Bingham Subject: [PATCH v3 03/14] media: rkisp1: Add and use rkisp1_has_feature() macro Date: Fri, 18 Nov 2022 18:39:20 +0900 Message-Id: <20221118093931.1284465-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221118093931.1284465-1-paul.elder@ideasonboard.com> References: <20221118093931.1284465-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../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) + /* * 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); -- 2.35.1