media: v4l2-async: simplify v4l2_async_subdev structure
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 27 Sep 2017 14:12:00 +0000 (10:12 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 29 Dec 2017 12:14:28 +0000 (07:14 -0500)
The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one
struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME
match criteria requires just a device name.

So, it doesn't make sense to enclose those into structs,
as the criteria can go directly into the union.

That makes easier to document it, as we don't need to document
weird senseless structs.

At drivers, this makes even clearer about the match criteria.

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Hyun Kwon <hyun.kwon@xilinx.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
17 files changed:
drivers/media/platform/am437x/am437x-vpfe.c
drivers/media/platform/atmel/atmel-isc.c
drivers/media/platform/atmel/atmel-isi.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/exynos4-is/media-dev.c
drivers/media/platform/pxa_camera.c
drivers/media/platform/qcom/camss-8x16/camss.c
drivers/media/platform/rcar-vin/rcar-core.c
drivers/media/platform/rcar_drif.c
drivers/media/platform/soc_camera/soc_camera.c
drivers/media/platform/stm32/stm32-dcmi.c
drivers/media/platform/ti-vpe/cal.c
drivers/media/platform/xilinx/xilinx-vipp.c
drivers/media/v4l2-core/v4l2-async.c
drivers/media/v4l2-core/v4l2-fwnode.c
drivers/staging/media/imx/imx-media-dev.c
include/media/v4l2-async.h

index 0997c640191d9cee4be62df3b5fd811ebeedc5ff..601ae6487617f7a5890b39f11d80c1dbc00480a1 100644 (file)
@@ -2304,8 +2304,8 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
        vpfe_dbg(1, vpfe, "vpfe_async_bound\n");
 
        for (i = 0; i < ARRAY_SIZE(vpfe->cfg->asd); i++) {
-               if (vpfe->cfg->asd[i]->match.fwnode.fwnode ==
-                   asd[i].match.fwnode.fwnode) {
+               if (vpfe->cfg->asd[i]->match.fwnode ==
+                   asd[i].match.fwnode) {
                        sdinfo = &vpfe->cfg->sub_devs[i];
                        vpfe->sd[i] = subdev;
                        vpfe->sd[i]->grp_id = sdinfo->grp_id;
@@ -2510,7 +2510,7 @@ vpfe_get_pdata(struct platform_device *pdev)
                }
 
                pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
-               pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
+               pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
                of_node_put(rem);
        }
 
index 0c2635647f69ba1ef74282787f905621c1d00666..34676409ca085b29969905350f751c1004f5ca04 100644 (file)
@@ -2088,7 +2088,7 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
                        subdev_entity->pfe_cfg0 |= ISC_PFE_CFG0_PPOL_LOW;
 
                subdev_entity->asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
-               subdev_entity->asd->match.fwnode.fwnode =
+               subdev_entity->asd->match.fwnode =
                        of_fwnode_handle(rem);
                list_add_tail(&subdev_entity->list, &isc->subdev_entities);
        }
index e900995143a3fd80e92ecf801bfbdaa9babea17b..9958918e2449527d22e6680357664fafbb14a4f8 100644 (file)
@@ -1128,7 +1128,7 @@ static int isi_graph_parse(struct atmel_isi *isi, struct device_node *node)
                /* Remote node to connect */
                isi->entity.node = remote;
                isi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-               isi->entity.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
+               isi->entity.asd.match.fwnode = of_fwnode_handle(remote);
                return 0;
        }
 }
index a288d58fd29c8f2aa98fdefaa92a9a9e94ac56f3..9364cdf62f5427542679458df07b800588eb4006 100644 (file)
@@ -1390,7 +1390,7 @@ static int vpif_async_bound(struct v4l2_async_notifier *notifier,
 
        for (i = 0; i < vpif_obj.config->asd_sizes[0]; i++) {
                struct v4l2_async_subdev *_asd = vpif_obj.config->asd[i];
-               const struct fwnode_handle *fwnode = _asd->match.fwnode.fwnode;
+               const struct fwnode_handle *fwnode = _asd->match.fwnode;
 
                if (fwnode == subdev->fwnode) {
                        vpif_obj.sd[i] = subdev;
@@ -1595,7 +1595,7 @@ vpif_capture_get_pdata(struct platform_device *pdev)
                }
 
                pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
-               pdata->asd[i]->match.fwnode.fwnode = of_fwnode_handle(rem);
+               pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
                of_node_put(rem);
        }
 
index 0ef583cfc424f61671d0374909aacdaaf4c67fe0..78b48a1fa26c0cf3c45d728d74b9e55f3c476bd6 100644 (file)
@@ -456,7 +456,7 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
        }
 
        fmd->sensor[index].asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-       fmd->sensor[index].asd.match.fwnode.fwnode = of_fwnode_handle(rem);
+       fmd->sensor[index].asd.match.fwnode = of_fwnode_handle(rem);
        fmd->async_subdevs[index] = &fmd->sensor[index].asd;
 
        fmd->num_sensors++;
@@ -1364,7 +1364,7 @@ static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
 
        /* Find platform data for this sensor subdev */
        for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++)
-               if (fmd->sensor[i].asd.match.fwnode.fwnode ==
+               if (fmd->sensor[i].asd.match.fwnode ==
                    of_fwnode_handle(subdev->dev->of_node))
                        si = &fmd->sensor[i];
 
index d6840730304354f7045d3ab36231c03d95042022..c71a00736541110ca150abb4ba725bf44026b0f5 100644 (file)
@@ -2335,7 +2335,7 @@ static int pxa_camera_pdata_from_dt(struct device *dev,
        asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
        remote = of_graph_get_remote_port(np);
        if (remote) {
-               asd->match.fwnode.fwnode = of_fwnode_handle(remote);
+               asd->match.fwnode = of_fwnode_handle(remote);
                of_node_put(remote);
        } else {
                dev_notice(dev, "no remote for %pOF\n", np);
index 390a42c17b661eeef206e58618a225b2b35ffca5..05f06c98aa64592ceb9c1307af98df9359d05c4c 100644 (file)
@@ -341,7 +341,7 @@ static int camss_of_parse_ports(struct device *dev,
                }
 
                csd->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-               csd->asd.match.fwnode.fwnode = of_fwnode_handle(remote);
+               csd->asd.match.fwnode = of_fwnode_handle(remote);
        }
 
        return notifier->num_subdevs;
index 108d776f32651b27f83ff09f3895a170eacb575f..f1fc7978d6d1523dae8ad4aae92aa1f5db83c32b 100644 (file)
@@ -187,7 +187,7 @@ static int rvin_digital_graph_init(struct rvin_dev *vin)
                return -ENODEV;
 
        vin_dbg(vin, "Found digital subdevice %pOF\n",
-               to_of_node(vin->digital->asd.match.fwnode.fwnode));
+               to_of_node(vin->digital->asd.match.fwnode));
 
        vin->notifier.ops = &rvin_digital_notify_ops;
        ret = v4l2_async_notifier_register(&vin->v4l2_dev, &vin->notifier);
index 63c94f4028a7140d1f6dc3d08629d03b3887c6b0..b2e080ef5391ea37ed8c95396e351d2ab8a09085 100644 (file)
@@ -1107,7 +1107,7 @@ static int rcar_drif_notify_bound(struct v4l2_async_notifier *notifier,
        struct rcar_drif_sdr *sdr =
                container_of(notifier, struct rcar_drif_sdr, notifier);
 
-       if (sdr->ep.asd.match.fwnode.fwnode !=
+       if (sdr->ep.asd.match.fwnode !=
            of_fwnode_handle(subdev->dev->of_node)) {
                rdrif_err(sdr, "subdev %s cannot bind\n", subdev->name);
                return -EINVAL;
@@ -1235,7 +1235,7 @@ static int rcar_drif_parse_subdevs(struct rcar_drif_sdr *sdr)
                return -EINVAL;
        }
 
-       sdr->ep.asd.match.fwnode.fwnode = fwnode;
+       sdr->ep.asd.match.fwnode = fwnode;
        sdr->ep.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
        notifier->num_subdevs++;
 
index 916ff68b73d4ae05e9e5a9362a7f2874b9124ee7..d13e2c5fb06fac3cb08c0f2c6dbaf1daea0bae8c 100644 (file)
@@ -1517,7 +1517,7 @@ static int soc_of_bind(struct soc_camera_host *ici,
        if (!info)
                return -ENOMEM;
 
-       info->sasd.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
+       info->sasd.asd.match.fwnode = of_fwnode_handle(remote);
        info->sasd.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
        info->subdev = &info->sasd.asd;
 
index ac4c450a6c7d8ecb6720ab3c74515dd4aa76f7c5..9460b3080dca1c0cbca254f05550e265ee9f726d 100644 (file)
@@ -1520,7 +1520,7 @@ static int dcmi_graph_parse(struct stm32_dcmi *dcmi, struct device_node *node)
                /* Remote node to connect */
                dcmi->entity.node = remote;
                dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-               dcmi->entity.asd.match.fwnode.fwnode = of_fwnode_handle(remote);
+               dcmi->entity.asd.match.fwnode = of_fwnode_handle(remote);
                return 0;
        }
 }
index 719ed1d79957357eb2a9d921b98d734af7b45782..d1febe5baa6dd9b45c2482e1e2d32c373bbd355f 100644 (file)
@@ -1702,7 +1702,7 @@ static int of_cal_create_instance(struct cal_ctx *ctx, int inst)
                goto cleanup_exit;
        }
        asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
-       asd->match.fwnode.fwnode = of_fwnode_handle(sensor_node);
+       asd->match.fwnode = of_fwnode_handle(sensor_node);
 
        remote_ep = of_graph_get_remote_endpoint(ep_node);
        if (!remote_ep) {
index f4c3e48ed2c06ea0019ab2497b180c9a79a019f2..6bb28cd49dae90513fb089c355b32511e94df00e 100644 (file)
@@ -387,7 +387,7 @@ static int xvip_graph_parse_one(struct xvip_composite_device *xdev,
 
                entity->node = remote;
                entity->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-               entity->asd.match.fwnode.fwnode = of_fwnode_handle(remote);
+               entity->asd.match.fwnode = of_fwnode_handle(remote);
                list_add_tail(&entity->list, &xdev->entities);
                xdev->num_subdevs++;
        }
index e5acfab470a5ee6bd3dc9bea4c333abe44c7a6f5..2b08d03b251d6053aa9db3ccae0c5b8c2cbbdf90 100644 (file)
@@ -68,12 +68,12 @@ static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 static bool match_devname(struct v4l2_subdev *sd,
                          struct v4l2_async_subdev *asd)
 {
-       return !strcmp(asd->match.device_name.name, dev_name(sd->dev));
+       return !strcmp(asd->match.device_name, dev_name(sd->dev));
 }
 
 static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
-       return sd->fwnode == asd->match.fwnode.fwnode;
+       return sd->fwnode == asd->match.fwnode;
 }
 
 static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
@@ -319,7 +319,7 @@ static bool __v4l2_async_notifier_fwnode_has_async_subdev(
                if (asd->match_type != V4L2_ASYNC_MATCH_FWNODE)
                        continue;
 
-               if (asd->match.fwnode.fwnode == fwnode)
+               if (asd->match.fwnode == fwnode)
                        return true;
        }
 
@@ -330,7 +330,7 @@ static bool __v4l2_async_notifier_fwnode_has_async_subdev(
                if (sd->asd->match_type != V4L2_ASYNC_MATCH_FWNODE)
                        continue;
 
-               if (sd->asd->match.fwnode.fwnode == fwnode)
+               if (sd->asd->match.fwnode == fwnode)
                        return true;
        }
 
@@ -355,8 +355,8 @@ static bool v4l2_async_notifier_fwnode_has_async_subdev(
                struct v4l2_async_subdev *other_asd = notifier->subdevs[j];
 
                if (other_asd->match_type == V4L2_ASYNC_MATCH_FWNODE &&
-                   asd->match.fwnode.fwnode ==
-                   other_asd->match.fwnode.fwnode)
+                   asd->match.fwnode ==
+                   other_asd->match.fwnode)
                        return true;
        }
 
@@ -395,7 +395,7 @@ static int __v4l2_async_notifier_register(struct v4l2_async_notifier *notifier)
                        break;
                case V4L2_ASYNC_MATCH_FWNODE:
                        if (v4l2_async_notifier_fwnode_has_async_subdev(
-                                   notifier, asd->match.fwnode.fwnode, i)) {
+                                   notifier, asd->match.fwnode, i)) {
                                dev_err(dev,
                                        "fwnode has already been registered or in notifier's subdev list\n");
                                ret = -EEXIST;
@@ -510,7 +510,7 @@ void v4l2_async_notifier_cleanup(struct v4l2_async_notifier *notifier)
 
                switch (asd->match_type) {
                case V4L2_ASYNC_MATCH_FWNODE:
-                       fwnode_handle_put(asd->match.fwnode.fwnode);
+                       fwnode_handle_put(asd->match.fwnode);
                        break;
                default:
                        WARN_ON_ONCE(true);
index fb72c7ac04d48298148a08e4d7c23c35c9451478..d630640642ee8cf3b838741f53a2c918a0a7494c 100644 (file)
@@ -359,9 +359,9 @@ static int v4l2_async_notifier_fwnode_parse_endpoint(
                return -ENOMEM;
 
        asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
-       asd->match.fwnode.fwnode =
+       asd->match.fwnode =
                fwnode_graph_get_remote_port_parent(endpoint);
-       if (!asd->match.fwnode.fwnode) {
+       if (!asd->match.fwnode) {
                dev_warn(dev, "bad remote port parent\n");
                ret = -EINVAL;
                goto out_err;
@@ -393,7 +393,7 @@ static int v4l2_async_notifier_fwnode_parse_endpoint(
        return 0;
 
 out_err:
-       fwnode_handle_put(asd->match.fwnode.fwnode);
+       fwnode_handle_put(asd->match.fwnode);
        kfree(asd);
 
        return ret == -ENOTCONN ? 0 : ret;
@@ -566,7 +566,7 @@ static int v4l2_fwnode_reference_parse(
                }
 
                notifier->subdevs[notifier->num_subdevs] = asd;
-               asd->match.fwnode.fwnode = args.fwnode;
+               asd->match.fwnode = args.fwnode;
                asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
                notifier->num_subdevs++;
        }
@@ -853,7 +853,7 @@ static int v4l2_fwnode_reference_parse_int_props(
                }
 
                notifier->subdevs[notifier->num_subdevs] = asd;
-               asd->match.fwnode.fwnode = fwnode;
+               asd->match.fwnode = fwnode;
                asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
                notifier->num_subdevs++;
        }
index 2800700482d619f87d0accae1aa45bbe18f19322..f7ed5f506fa94d867f5ccd663fcf669f08e19da1 100644 (file)
@@ -48,7 +48,7 @@ find_async_subdev(struct imx_media_dev *imxmd,
                asd = &imxasd->asd;
                switch (asd->match_type) {
                case V4L2_ASYNC_MATCH_FWNODE:
-                       if (fwnode && asd->match.fwnode.fwnode == fwnode)
+                       if (fwnode && asd->match.fwnode == fwnode)
                                return asd;
                        break;
                case V4L2_ASYNC_MATCH_DEVNAME:
@@ -104,7 +104,7 @@ int imx_media_add_async_subdev(struct imx_media_dev *imxmd,
 
        if (fwnode) {
                asd->match_type = V4L2_ASYNC_MATCH_FWNODE;
-               asd->match.fwnode.fwnode = fwnode;
+               asd->match.fwnode = fwnode;
        } else {
                asd->match_type = V4L2_ASYNC_MATCH_DEVNAME;
                asd->match.device_name.name = devname;
index 6152434cbe827196949d55f420d69da6999acbcb..a010af5134b23cba1ceb994313c1a92f341c68ad 100644 (file)
@@ -58,12 +58,8 @@ enum v4l2_async_match_type {
 struct v4l2_async_subdev {
        enum v4l2_async_match_type match_type;
        union {
-               struct {
-                       struct fwnode_handle *fwnode;
-               } fwnode;
-               struct {
-                       const char *name;
-               } device_name;
+               struct fwnode_handle *fwnode;
+               const char *device_name;
                struct {
                        int adapter_id;
                        unsigned short address;