From patchwork Fri Feb 16 09:54:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 202053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp410168dyb; Fri, 16 Feb 2024 02:05:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV24nfs0onUWsRlztr6QVYJCeeCT1h7S37Wu59+as3N7cyVa+HrxGeCGY4BnafY/Y4nSBXMJL91NC0+VL6ufE8/w4m49g== X-Google-Smtp-Source: AGHT+IESv8sV4Daha0Vzw+Zm2SNo9fbDhYyxt06tBrYZUNOOzIuLPlqBV0hMx65wLjslcHHS2gwn X-Received: by 2002:a17:90a:fe0f:b0:297:ca7:fd10 with SMTP id ck15-20020a17090afe0f00b002970ca7fd10mr4523437pjb.1.1708077941523; Fri, 16 Feb 2024 02:05:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708077941; cv=pass; d=google.com; s=arc-20160816; b=gdNHMmMKfFYX+3883FhEXVK5mMZcb3tBzoqjSCAb1Ait8uS9xo1FPeUPZIPWdKc9ca PyzZIH3jBngb7/N+rxYHuOl8MMp912ESOjeDgViGd7bna8ucTkx2EjCM9uskkiZYnq+s ODI1Jj7H5s2+8Uz+aign8HfcTmq+iEDDH0PKCkYNdtrHFlxERjsPViTl4F7kLbrz98tt qHXUXSHBUbl0hDX/x0YERxi2Cks9B6MU5rFjXH/HxawEaoHw3v4BcsYxyObqgNq6+tD0 OQOomjd4v/x5r/yKQZMdFr/iAMIGYeZLxBEHiqmx4WRCsLAFznAwhtEvGu545S6EpT++ i4xw== ARC-Message-Signature: i=2; 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=WXz6iUF2jHf63LjivXtryS8cb7HXbPx8u1h6xbHMFPtKf2s6Cu5wNOOTmzH9cGeC7d hAlv81t7AipLfuzZUn6IJCVkXMLr0XacUmvqT3dqYz4GAicocvfUxe7UgpFS8ZYnRdjf 45Pz5JSnxDphMrWohzaj/8gHO3ouOt0uh94ss4cdAdQTwRoLfjkx7zw26OejUyN2areH qKXZa4lx9Bei7SNWHt14tyLNSP+6bdNB9q05ChnVKw1FwdzVKY1YZsveopfupRhLQvWo P0vqklxbNbzprV4SOE6BVmsqCEDObBZMUjKfvlvoGt9x45sVOGX7oOTnnb/ewnE62bnJ Zc5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=cw3veZ5u; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-68384-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68384-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id sg4-20020a17090b520400b00298fdc123bbsi2911538pjb.140.2024.02.16.02.05.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 02:05:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68384-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=cw3veZ5u; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-68384-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68384-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E26142878E5 for ; Fri, 16 Feb 2024 09:57:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBE1F1CAAB; Fri, 16 Feb 2024 09:55:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cw3veZ5u" 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 A3CEC1C697; Fri, 16 Feb 2024 09:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708077324; cv=none; b=BMSz4/fqJZCOoyHhbjCwKY85Z7x4H8rIX/ghI2Jtm4VPB6YhcWgYLML8/fSNV437zn8VN6jSph78w5LODFXofpkjSFiVBNyMDIxuaOiM+SAQisld7sb5Lv8SEun2186nZsO9gKocNW0T2OC2durKWidp9sTRMCl0AYTKyUw02+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708077324; c=relaxed/simple; bh=mnfiq9V4ke1JzZzn2ucgUeU305wKiCXWHBl8l5EJxXU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hG7sBE3xAesZ6S4X6D0WRQ8WSJz/FUKqGmyV28iZ2YpNmLICjagHgv4phbv+HAyEKjo8r8uEmuLT9Mn4jhddLjg1L0IRzWqX9WJwxIHkQ7HPksHC0nB9qDvXveHFz0Jj4nRSaeb+KTglAuSqjjN+AG8z7TZOXD3AVuG7sMVQu1w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=cw3veZ5u; arc=none smtp.client-ip=213.167.242.64 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 C150E13AC; Fri, 16 Feb 2024 10:55:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1708077316; bh=mnfiq9V4ke1JzZzn2ucgUeU305wKiCXWHBl8l5EJxXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cw3veZ5uwOqVSLVfBfqFWSE6VK66pHgIq658yJUAQIt5pGMI6gCJJuazZlmaIUAsY bQSOPkQNN4JnWgmJAFFiWzn0cSyeoLmfIP7xntBHEKmreCVst/TiL+MuI318Mfn5aJ bsKV43e2WaHSbtib2iVYiJO90sCe+5u3QzG+k+Lc= 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 v12 01/12] media: rkisp1: Add and use rkisp1_has_feature() macro Date: Fri, 16 Feb 2024 18:54:47 +0900 Message-Id: <20240216095458.2919694-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240216095458.2919694-1-paul.elder@ideasonboard.com> References: <20240216095458.2919694-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: 1791049535634113302 X-GMAIL-MSGID: 1791049535634113302 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);