[media] omap3/omap4/davinci: get rid of MEDIA_ENT_T_V4L2_SUBDEV abuse
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 8 May 2015 01:12:33 +0000 (22:12 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:18:50 +0000 (12:18 -0200)
On omap3/omap4/davinci drivers, MEDIA_ENT_T_V4L2_SUBDEV macro is
abused in order to "simplify" the pad checks.

Basically, it does a logical or of this macro, in order to check
for a local index and if the entity is either a subdev or not.

As we'll get rid of MEDIA_ENT_T_V4L2_SUBDEV macro, replace it by
2 << 16 where it occurs, and add a note saying that the code
there is actually a hack.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
12 files changed:
drivers/media/platform/omap3isp/ispccdc.c
drivers/media/platform/omap3isp/ispccp2.c
drivers/media/platform/omap3isp/ispcsi2.c
drivers/media/platform/omap3isp/isppreview.c
drivers/media/platform/omap3isp/ispresizer.c
drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
drivers/staging/media/davinci_vpfe/dm365_isif.c
drivers/staging/media/davinci_vpfe/dm365_resizer.c
drivers/staging/media/davinci_vpfe/vpfe_video.c
drivers/staging/media/omap4iss/iss_csi2.c
drivers/staging/media/omap4iss/iss_ipipeif.c
drivers/staging/media/omap4iss/iss_resizer.c

index 9a811f5741fa2c2027b1dbf9c7a605e0d5d4adcc..f0e530c981888683a666d3c115d217022d8e9d92 100644 (file)
@@ -2513,9 +2513,14 @@ static int ccdc_link_setup(struct media_entity *entity,
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd);
        struct isp_device *isp = to_isp_device(ccdc);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case CCDC_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case CCDC_PAD_SINK | 2 << 16:
                /* Read from the sensor (parallel interface), CCP2, CSI2a or
                 * CSI2c.
                 */
@@ -2543,7 +2548,7 @@ static int ccdc_link_setup(struct media_entity *entity,
         * Revisit this when it will be implemented, and return -EBUSY for now.
         */
 
-       case CCDC_PAD_SOURCE_VP | MEDIA_ENT_T_V4L2_SUBDEV:
+       case CCDC_PAD_SOURCE_VP | 2 << 16:
                /* Write to preview engine, histogram and H3A. When none of
                 * those links are active, the video port can be disabled.
                 */
@@ -2556,7 +2561,7 @@ static int ccdc_link_setup(struct media_entity *entity,
                }
                break;
 
-       case CCDC_PAD_SOURCE_OF | MEDIA_ENT_T_DEVNODE:
+       case CCDC_PAD_SOURCE_OF:
                /* Write to memory */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (ccdc->output & ~CCDC_OUTPUT_MEMORY)
@@ -2567,7 +2572,7 @@ static int ccdc_link_setup(struct media_entity *entity,
                }
                break;
 
-       case CCDC_PAD_SOURCE_OF | MEDIA_ENT_T_V4L2_SUBDEV:
+       case CCDC_PAD_SOURCE_OF | 2 << 16:
                /* Write to resizer */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (ccdc->output & ~CCDC_OUTPUT_RESIZER)
index 6ec7d104ab75f578833612bed7aa2127c66f6dd1..ae3038e643ccf03b63e12fe3baf12511c5a6cfb0 100644 (file)
@@ -956,9 +956,14 @@ static int ccp2_link_setup(struct media_entity *entity,
 {
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case CCP2_PAD_SINK | MEDIA_ENT_T_DEVNODE:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case CCP2_PAD_SINK:
                /* read from memory */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (ccp2->input == CCP2_INPUT_SENSOR)
@@ -970,7 +975,7 @@ static int ccp2_link_setup(struct media_entity *entity,
                }
                break;
 
-       case CCP2_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       case CCP2_PAD_SINK | 2 << 16:
                /* read from sensor/phy */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (ccp2->input == CCP2_INPUT_MEMORY)
@@ -981,7 +986,7 @@ static int ccp2_link_setup(struct media_entity *entity,
                                ccp2->input = CCP2_INPUT_NONE;
                } break;
 
-       case CCP2_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+       case CCP2_PAD_SOURCE | 2 << 16:
                /* write to video port/ccdc */
                if (flags & MEDIA_LNK_FL_ENABLED)
                        ccp2->output = CCP2_OUTPUT_CCDC;
index 0fb057a74f69ed3db0aad9ff9cb39e688470a734..b1617f7efdee296e062874cb135cd80796254072 100644 (file)
@@ -1144,14 +1144,19 @@ static int csi2_link_setup(struct media_entity *entity,
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd);
        struct isp_csi2_ctrl_cfg *ctrl = &csi2->ctrl;
+       int index = local->index;
 
        /*
         * The ISP core doesn't support pipelines with multiple video outputs.
         * Revisit this when it will be implemented, and return -EBUSY for now.
         */
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case CSI2_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case CSI2_PAD_SOURCE:
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (csi2->output & ~CSI2_OUTPUT_MEMORY)
                                return -EBUSY;
@@ -1161,7 +1166,7 @@ static int csi2_link_setup(struct media_entity *entity,
                }
                break;
 
-       case CSI2_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+       case CSI2_PAD_SOURCE | 2 << 16:
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (csi2->output & ~CSI2_OUTPUT_CCDC)
                                return -EBUSY;
index 6986d2f65c19cd9cca4d35a043433785a64ab141..cfb2debb02bfef56e7fac55d3213c81c8f0c6ffd 100644 (file)
@@ -2144,9 +2144,14 @@ static int preview_link_setup(struct media_entity *entity,
 {
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case PREV_PAD_SINK | MEDIA_ENT_T_DEVNODE:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case PREV_PAD_SINK:
                /* read from memory */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (prev->input == PREVIEW_INPUT_CCDC)
@@ -2158,7 +2163,7 @@ static int preview_link_setup(struct media_entity *entity,
                }
                break;
 
-       case PREV_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       case PREV_PAD_SINK | 2 << 16:
                /* read from ccdc */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (prev->input == PREVIEW_INPUT_MEMORY)
@@ -2175,7 +2180,7 @@ static int preview_link_setup(struct media_entity *entity,
         * Revisit this when it will be implemented, and return -EBUSY for now.
         */
 
-       case PREV_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+       case PREV_PAD_SOURCE:
                /* write to memory */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (prev->output & ~PREVIEW_OUTPUT_MEMORY)
@@ -2186,7 +2191,7 @@ static int preview_link_setup(struct media_entity *entity,
                }
                break;
 
-       case PREV_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+       case PREV_PAD_SOURCE | 2 << 16:
                /* write to resizer */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (prev->output & ~PREVIEW_OUTPUT_RESIZER)
index 249af7f524f906e51c0e2e3f48307ddb6b05a4ec..e3ecf1787fc47e694a8dd8906365ab1f67a91813 100644 (file)
@@ -1623,9 +1623,14 @@ static int resizer_link_setup(struct media_entity *entity,
 {
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct isp_res_device *res = v4l2_get_subdevdata(sd);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case RESZ_PAD_SINK | MEDIA_ENT_T_DEVNODE:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case RESZ_PAD_SINK:
                /* read from memory */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (res->input == RESIZER_INPUT_VP)
@@ -1637,7 +1642,7 @@ static int resizer_link_setup(struct media_entity *entity,
                }
                break;
 
-       case RESZ_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       case RESZ_PAD_SINK | 2 << 16:
                /* read from ccdc or previewer */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (res->input == RESIZER_INPUT_MEMORY)
@@ -1649,7 +1654,7 @@ static int resizer_link_setup(struct media_entity *entity,
                }
                break;
 
-       case RESZ_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+       case RESZ_PAD_SOURCE:
                /* resizer always write to memory */
                break;
 
index d96bdaaae50e5014272711892a236de0d81a0786..b66584ecb6933bd6ec5db538d29da062fdcb1880 100644 (file)
@@ -885,9 +885,14 @@ ipipeif_link_setup(struct media_entity *entity, const struct media_pad *local,
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct vpfe_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
        struct vpfe_device *vpfe = to_vpfe_device(ipipeif);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case IPIPEIF_PAD_SINK | MEDIA_ENT_T_DEVNODE:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case IPIPEIF_PAD_SINK:
                /* Single shot mode */
                if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                        ipipeif->input = IPIPEIF_INPUT_NONE;
@@ -896,7 +901,7 @@ ipipeif_link_setup(struct media_entity *entity, const struct media_pad *local,
                ipipeif->input = IPIPEIF_INPUT_MEMORY;
                break;
 
-       case IPIPEIF_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       case IPIPEIF_PAD_SINK | 2 << 16:
                /* read from isif */
                if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                        ipipeif->input = IPIPEIF_INPUT_NONE;
@@ -908,7 +913,7 @@ ipipeif_link_setup(struct media_entity *entity, const struct media_pad *local,
                ipipeif->input = IPIPEIF_INPUT_ISIF;
                break;
 
-       case IPIPEIF_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+       case IPIPEIF_PAD_SOURCE | 2 << 16:
                if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                        ipipeif->output = IPIPEIF_OUTPUT_NONE;
                        break;
index df77288b0ec028b7646a5c10e66daa694f920543..8ca0c1297ec8c4f0e7b76a768f8db7e1ab6be50e 100644 (file)
@@ -1707,9 +1707,14 @@ isif_link_setup(struct media_entity *entity, const struct media_pad *local,
 {
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct vpfe_isif_device *isif = v4l2_get_subdevdata(sd);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case ISIF_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case ISIF_PAD_SINK | 2 << 16:
                /* read from decoder/sensor */
                if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                        isif->input = ISIF_INPUT_NONE;
@@ -1720,7 +1725,7 @@ isif_link_setup(struct media_entity *entity, const struct media_pad *local,
                isif->input = ISIF_INPUT_PARALLEL;
                break;
 
-       case ISIF_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+       case ISIF_PAD_SOURCE:
                /* write to memory */
                if (flags & MEDIA_LNK_FL_ENABLED)
                        isif->output = ISIF_OUTPUT_MEMORY;
@@ -1728,7 +1733,7 @@ isif_link_setup(struct media_entity *entity, const struct media_pad *local,
                        isif->output = ISIF_OUTPUT_NONE;
                break;
 
-       case ISIF_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+       case ISIF_PAD_SOURCE | 2 << 16:
                if (flags & MEDIA_LNK_FL_ENABLED)
                        isif->output = ISIF_OUTPUT_IPIPEIF;
                else
index 50c8725c5aa60b4aceeaa4bce5ff38a77938d2a3..ba887efd226a3764cb94d98f741e2693e7f04683 100644 (file)
@@ -1648,10 +1648,15 @@ static int resizer_link_setup(struct media_entity *entity,
        struct vpfe_device *vpfe_dev = to_vpfe_device(resizer);
        u16 ipipeif_source = vpfe_dev->vpfe_ipipeif.output;
        u16 ipipe_source = vpfe_dev->vpfe_ipipe.output;
+       int index = local->index;
+
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
 
        if (&resizer->crop_resizer.subdev == sd) {
-               switch (local->index | media_entity_type(remote->entity)) {
-               case RESIZER_CROP_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+               switch (index) {
+               case RESIZER_CROP_PAD_SINK | 2 << 16:
                        if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                                resizer->crop_resizer.input =
                                        RESIZER_CROP_INPUT_NONE;
@@ -1671,7 +1676,7 @@ static int resizer_link_setup(struct media_entity *entity,
                                return -EINVAL;
                        break;
 
-               case RESIZER_CROP_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+               case RESIZER_CROP_PAD_SOURCE | 2 << 16:
                        if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                                resizer->crop_resizer.output =
                                RESIZER_CROP_OUTPUT_NONE;
@@ -1683,7 +1688,7 @@ static int resizer_link_setup(struct media_entity *entity,
                        resizer->crop_resizer.output = RESIZER_A;
                        break;
 
-               case RESIZER_CROP_PAD_SOURCE2 | MEDIA_ENT_T_V4L2_SUBDEV:
+               case RESIZER_CROP_PAD_SOURCE2 | 2 << 16:
                        if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                                resizer->crop_resizer.output2 =
                                        RESIZER_CROP_OUTPUT_NONE;
@@ -1699,8 +1704,8 @@ static int resizer_link_setup(struct media_entity *entity,
                        return -EINVAL;
                }
        } else if (&resizer->resizer_a.subdev == sd) {
-               switch (local->index | media_entity_type(remote->entity)) {
-               case RESIZER_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+               switch (index) {
+               case RESIZER_PAD_SINK | 2 << 16:
                        if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                                resizer->resizer_a.input = RESIZER_INPUT_NONE;
                                break;
@@ -1710,7 +1715,7 @@ static int resizer_link_setup(struct media_entity *entity,
                        resizer->resizer_a.input = RESIZER_INPUT_CROP_RESIZER;
                        break;
 
-               case RESIZER_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+               case RESIZER_PAD_SOURCE:
                        if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                                resizer->resizer_a.output = RESIZER_OUTPUT_NONE;
                                break;
@@ -1724,8 +1729,8 @@ static int resizer_link_setup(struct media_entity *entity,
                        return -EINVAL;
                }
        } else if (&resizer->resizer_b.subdev == sd) {
-               switch (local->index | media_entity_type(remote->entity)) {
-               case RESIZER_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+               switch (index) {
+               case RESIZER_PAD_SINK | 2 << 16:
                        if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                                resizer->resizer_b.input = RESIZER_INPUT_NONE;
                                break;
@@ -1735,7 +1740,7 @@ static int resizer_link_setup(struct media_entity *entity,
                        resizer->resizer_b.input = RESIZER_INPUT_CROP_RESIZER;
                        break;
 
-               case RESIZER_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+               case RESIZER_PAD_SOURCE:
                        if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                                resizer->resizer_b.output = RESIZER_OUTPUT_NONE;
                                break;
index d21d978e139e92482ddac2797549289e23163fca..290f4b490b76461b333faafa5d29dcbc8d1cfb3e 100644 (file)
@@ -148,7 +148,7 @@ static void vpfe_prepare_pipeline(struct vpfe_video_device *video)
        while ((entity = media_entity_graph_walk_next(&graph))) {
                if (entity == &video->video_dev.entity)
                        continue;
-               if ((!is_media_entity_v4l2_io(remote->entity))
+               if (!is_media_entity_v4l2_io(entity))
                        continue;
                far_end = to_vpfe_video(media_entity_to_video_device(entity));
                if (far_end->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
@@ -293,7 +293,7 @@ static int vpfe_pipeline_enable(struct vpfe_pipeline *pipe)
        media_entity_graph_walk_start(&graph, entity);
        while ((entity = media_entity_graph_walk_next(&graph))) {
 
-               if !is_media_entity_v4l2_subdev(entity))
+               if (!is_media_entity_v4l2_subdev(entity))
                        continue;
                subdev = media_entity_to_v4l2_subdev(entity);
                ret = v4l2_subdev_call(subdev, video, s_stream, 1);
index 13878a2752779580973e0d984b890a3255442ae1..2b9a36cd8fa8eed5f43c4aa0603cbfb9d633704b 100644 (file)
@@ -1170,14 +1170,19 @@ static int csi2_link_setup(struct media_entity *entity,
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd);
        struct iss_csi2_ctrl_cfg *ctrl = &csi2->ctrl;
+       int index = local->index;
+
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
 
        /*
         * The ISS core doesn't support pipelines with multiple video outputs.
         * Revisit this when it will be implemented, and return -EBUSY for now.
         */
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case CSI2_PAD_SOURCE | MEDIA_ENT_T_DEVNODE:
+       switch (index) {
+       case CSI2_PAD_SOURCE:
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (csi2->output & ~CSI2_OUTPUT_MEMORY)
                                return -EBUSY;
@@ -1187,7 +1192,7 @@ static int csi2_link_setup(struct media_entity *entity,
                }
                break;
 
-       case CSI2_PAD_SOURCE | MEDIA_ENT_T_V4L2_SUBDEV:
+       case CSI2_PAD_SOURCE | 2 << 16:
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (csi2->output & ~CSI2_OUTPUT_IPIPEIF)
                                return -EBUSY;
index 82608cbb1f5fa00afeafe43c859f0c1ee1ca7d27..8cbb9840a989cff7abb4f17c866baf7bdd3e6fdf 100644 (file)
@@ -662,9 +662,14 @@ static int ipipeif_link_setup(struct media_entity *entity,
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd);
        struct iss_device *iss = to_iss_device(ipipeif);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case IPIPEIF_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case IPIPEIF_PAD_SINK | 2 << 16:
                /* Read from the sensor CSI2a or CSI2b. */
                if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                        ipipeif->input = IPIPEIF_INPUT_NONE;
@@ -681,7 +686,7 @@ static int ipipeif_link_setup(struct media_entity *entity,
 
                break;
 
-       case IPIPEIF_PAD_SOURCE_ISIF_SF | MEDIA_ENT_T_DEVNODE:
+       case IPIPEIF_PAD_SOURCE_ISIF_SF:
                /* Write to memory */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (ipipeif->output & ~IPIPEIF_OUTPUT_MEMORY)
@@ -692,7 +697,7 @@ static int ipipeif_link_setup(struct media_entity *entity,
                }
                break;
 
-       case IPIPEIF_PAD_SOURCE_VP | MEDIA_ENT_T_V4L2_SUBDEV:
+       case IPIPEIF_PAD_SOURCE_VP | 2 << 16:
                /* Send to IPIPE/RESIZER */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (ipipeif->output & ~IPIPEIF_OUTPUT_VP)
index 4a474873a8df0d42f4b5ce6615edb19aebc40edf..a3925ecd0ed795a9a59b5544e7dd1a4a666cca62 100644 (file)
@@ -716,9 +716,14 @@ static int resizer_link_setup(struct media_entity *entity,
        struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
        struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd);
        struct iss_device *iss = to_iss_device(resizer);
+       int index = local->index;
 
-       switch (local->index | media_entity_type(remote->entity)) {
-       case RESIZER_PAD_SINK | MEDIA_ENT_T_V4L2_SUBDEV:
+       /* FIXME: this is actually a hack! */
+       if (is_media_entity_v4l2_subdev(remote->entity))
+               index |= 2 << 16;
+
+       switch (index) {
+       case RESIZER_PAD_SINK | 2 << 16:
                /* Read from IPIPE or IPIPEIF. */
                if (!(flags & MEDIA_LNK_FL_ENABLED)) {
                        resizer->input = RESIZER_INPUT_NONE;
@@ -735,7 +740,7 @@ static int resizer_link_setup(struct media_entity *entity,
 
                break;
 
-       case RESIZER_PAD_SOURCE_MEM | MEDIA_ENT_T_DEVNODE:
+       case RESIZER_PAD_SOURCE_MEM:
                /* Write to memory */
                if (flags & MEDIA_LNK_FL_ENABLED) {
                        if (resizer->output & ~RESIZER_OUTPUT_MEMORY)