From patchwork Fri Nov 18 09:39:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 22234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp90785wrr; Fri, 18 Nov 2022 01:45:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf50alWuDv3zuub4or9agiqGWToRuc80+lXOVQafhQAc3UuQMk5XziE27kNa4ABZ1BMmR66r X-Received: by 2002:a63:180a:0:b0:470:63e5:5c59 with SMTP id y10-20020a63180a000000b0047063e55c59mr5861571pgl.172.1668764699909; Fri, 18 Nov 2022 01:44:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668764699; cv=none; d=google.com; s=arc-20160816; b=z71qN2uXMFl8+PWf0s5AJG/B5rYI7VUVnhlo4Z5WpT9GswKyAavRAcf/CDd9MN9TlI cDHZfg4ek4G5a9KD8qk6ehhNmfA4O6KmRUdK7EHazC8VAUbeMbjIajukKjp3+izoAsj9 R4V1q36SV73pMJtOcbcPIxH1kPsY8AHmdjmwk3zjgdrM7Wexxeh5SniNKHFC9EOQ8yll IkYnc3Xq7pciurMQYHM3by70v3BwVrEP00MZ41omo48WbPhZFI9HeX0Hd3F3QTNJlCtD jPROMeGIFwpLTXF+R64jpozDpIIDyLzgWNejkBs0KvxLO/j2CUHp6qR2NthPUG4jAyLn tsKQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902e80600b00186e114bedfsi3899216plg.126.2022.11.18.01.44.46; Fri, 18 Nov 2022 01:44:59 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749826613943381679?= X-GMAIL-MSGID: =?utf-8?q?1749826613943381679?= 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);