From patchwork Sun Feb 18 20:43:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 13562036 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 4B96D6D1AB for ; Sun, 18 Feb 2024 20:43:49 +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=1708289032; cv=none; b=kaXT3oBI4iub8scn9fULMXuMyKtt4ATJpshpM+3GlyKUAa9UjzxodrmpN3CHku2xH8EgQ9p3xKvL2XxdrkxCiAol/++zE65d04+eAyffvH6k+VGU67Ir9tK/S/KkCHPncwLUyiDGHQg42+OLBVVqtnY45PJKJiFOPOECA4l1pSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708289032; c=relaxed/simple; bh=nYwlcrqQfizYjqofWOElZLJpuZsgQNEg9TxVtChzC84=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z/EZpcd+Xp3o7AwfyczQ5hIupmALrWEkj/5Dz+HFbFlvheRyPhMnCmfaJqNBVYCXq0G4lQF1v5F7NXpgIxNVtpeGm9hnX2qMcvpZk1GiKgfbS6sALKg5XxeEYbwZwR04ITK4gmWhyhxZZNSsa1JDJ5bou4bmGWbQX2RGnabsd3I= 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=fu2xM6Cy; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fu2xM6Cy" Received: from pendragon.ideasonboard.com (89-27-53-110.bb.dnainternet.fi [89.27.53.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E65D975; Sun, 18 Feb 2024 21:43:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1708289022; bh=nYwlcrqQfizYjqofWOElZLJpuZsgQNEg9TxVtChzC84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fu2xM6CyaS1KYp4LLjOu5uCnScyZ6TEBbMR3k1zg5a/pVluYLMdg1Jl/fgmaKI3jS XgK8trIaEPMTncLvQzSQ6FaoVPIJKyNoSOFrXggCFd2C8F3es/Q+FyEjyAEJQa5guu XfrT558yrLooHYqgVLhUL+nGCHmzOECBtyNilIFc= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Adam Ford , Alexander Stein , Dafna Hirschfeld , Heiko Stuebner , Helen Koike , Kieran Bingham , Paul Elder , Tomi Valkeinen , linux-rockchip@lists.infradead.org Subject: [PATCH v13 01/12] media: rkisp1: Add and use rkisp1_has_feature() macro Date: Sun, 18 Feb 2024 22:43:39 +0200 Message-ID: <20240218204350.10916-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218204350.10916-1-laurent.pinchart@ideasonboard.com> References: <20240218204350.10916-1-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 4b6b28c05b89..35efdabf9db1 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 f96f821a7b50..8c1040ca02a3 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; @@ -339,7 +339,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, @@ -391,7 +391,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); @@ -424,7 +424,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; @@ -628,7 +628,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); @@ -649,7 +649,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);