mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
media: rkisp1: Add and use rkisp1_has_feature() macro
Simplify feature tests with a macro that shortens lines. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> Tested-by: Adam Ford <aford173@gmail.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
This commit is contained in:
parent
e0b8eb0f6d
commit
900f667676
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user