diff options
Diffstat (limited to 'drivers/media/platform/rcar-vin')
-rw-r--r-- | drivers/media/platform/rcar-vin/rcar-core.c | 13 | ||||
-rw-r--r-- | drivers/media/platform/rcar-vin/rcar-csi2.c | 26 | ||||
-rw-r--r-- | drivers/media/platform/rcar-vin/rcar-v4l2.c | 8 |
3 files changed, 27 insertions, 20 deletions
diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index ce09799976ef..f476b2f1eb35 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -170,7 +170,6 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags, if (csi_id == -ENODEV) { struct v4l2_subdev *sd; - unsigned int i; /* * Make sure the source entity subdevice is registered as @@ -268,8 +267,8 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin) match = of_match_node(vin->dev->driver->of_match_table, vin->dev->of_node); - strlcpy(mdev->driver_name, KBUILD_MODNAME, sizeof(mdev->driver_name)); - strlcpy(mdev->model, match->compatible, sizeof(mdev->model)); + strscpy(mdev->driver_name, KBUILD_MODNAME, sizeof(mdev->driver_name)); + strscpy(mdev->model, match->compatible, sizeof(mdev->model)); snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", dev_name(mdev->dev)); @@ -476,7 +475,7 @@ static int rvin_parallel_subdevice_attach(struct rvin_dev *vin, return ret; ret = v4l2_ctrl_add_handler(&vin->ctrl_handler, subdev->ctrl_handler, - NULL); + NULL, true); if (ret < 0) { v4l2_ctrl_handler_free(&vin->ctrl_handler); return ret; @@ -611,6 +610,8 @@ static int rvin_parallel_init(struct rvin_dev *vin) { int ret; + v4l2_async_notifier_init(&vin->notifier); + ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port( vin->dev, &vin->notifier, sizeof(struct rvin_parallel_entity), 0, rvin_parallel_parse_v4l2); @@ -803,6 +804,8 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin) return 0; } + v4l2_async_notifier_init(&vin->group->notifier); + /* * Have all VIN's look for CSI-2 subdevices. Some subdevices will * overlap but the parser function can handle it, so each subdevice @@ -824,7 +827,7 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin) mutex_unlock(&vin->group->lock); - if (!vin->group->notifier.num_subdevs) + if (list_empty(&vin->group->notifier.asd_list)) return 0; vin->group->notifier.ops = &rvin_group_notify_ops; diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c index dc5ae8025832..b0044a08e71e 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -714,7 +714,7 @@ static int rcsi2_parse_v4l2(struct rcar_csi2 *priv, if (vep->base.port || vep->base.id) return -ENOTCONN; - if (vep->bus_type != V4L2_MBUS_CSI2) { + if (vep->bus_type != V4L2_MBUS_CSI2_DPHY) { dev_err(priv->dev, "Unsupported bus: %u\n", vep->bus_type); return -EINVAL; } @@ -743,7 +743,7 @@ static int rcsi2_parse_v4l2(struct rcar_csi2 *priv, static int rcsi2_parse_dt(struct rcar_csi2 *priv) { struct device_node *ep; - struct v4l2_fwnode_endpoint v4l2_ep; + struct v4l2_fwnode_endpoint v4l2_ep = { .bus_type = 0 }; int ret; ep = of_graph_get_endpoint_by_regs(priv->dev->of_node, 0, 0); @@ -771,21 +771,25 @@ static int rcsi2_parse_dt(struct rcar_csi2 *priv) of_node_put(ep); - priv->notifier.subdevs = devm_kzalloc(priv->dev, - sizeof(*priv->notifier.subdevs), - GFP_KERNEL); - if (!priv->notifier.subdevs) - return -ENOMEM; + v4l2_async_notifier_init(&priv->notifier); + + ret = v4l2_async_notifier_add_subdev(&priv->notifier, &priv->asd); + if (ret) { + fwnode_handle_put(priv->asd.match.fwnode); + return ret; + } - priv->notifier.num_subdevs = 1; - priv->notifier.subdevs[0] = &priv->asd; priv->notifier.ops = &rcar_csi2_notify_ops; dev_dbg(priv->dev, "Found '%pOF'\n", to_of_node(priv->asd.match.fwnode)); - return v4l2_async_subdev_notifier_register(&priv->subdev, - &priv->notifier); + ret = v4l2_async_subdev_notifier_register(&priv->subdev, + &priv->notifier); + if (ret) + v4l2_async_notifier_cleanup(&priv->notifier); + + return ret; } /* ----------------------------------------------------------------------------- diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 5a54779cfc27..dc77682b4785 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -238,8 +238,8 @@ static int rvin_querycap(struct file *file, void *priv, { struct rvin_dev *vin = video_drvdata(file); - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); - strlcpy(cap->card, "R_Car_VIN", sizeof(cap->card)); + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); + strscpy(cap->card, "R_Car_VIN", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(vin->dev)); return 0; @@ -440,7 +440,7 @@ static int rvin_enum_input(struct file *file, void *priv, i->std = vin->vdev.tvnorms; } - strlcpy(i->name, "Camera", sizeof(i->name)); + strscpy(i->name, "Camera", sizeof(i->name)); return 0; } @@ -714,7 +714,7 @@ static int rvin_mc_enum_input(struct file *file, void *priv, return -EINVAL; i->type = V4L2_INPUT_TYPE_CAMERA; - strlcpy(i->name, "Camera", sizeof(i->name)); + strscpy(i->name, "Camera", sizeof(i->name)); return 0; } |