Commit 3c8c1539 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

media: v4l: async: Rename async nf functions, clean up long lines



Rename V4L2 async notifier functions, replacing "notifier" with "nf" and
removing "_subdev" at the end of the function names adding subdevs as you
can only add subdevs to a notifier. Also wrap and otherwise clean up long
lines.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarJacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> (imx7)
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 406bb586
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -191,21 +191,21 @@ registered this way are stored in a global list of subdevices, ready to be
picked up by bridge drivers.

Bridge drivers in turn have to register a notifier object. This is
performed using the :c:func:`v4l2_async_notifier_register` call. To
performed using the :c:func:`v4l2_async_nf_register` call. To
unregister the notifier the driver has to call
:c:func:`v4l2_async_notifier_unregister`. The former of the two functions
:c:func:`v4l2_async_nf_unregister`. The former of the two functions
takes two arguments: a pointer to struct :c:type:`v4l2_device` and a
pointer to struct :c:type:`v4l2_async_notifier`.

Before registering the notifier, bridge drivers must do two things: first, the
notifier must be initialized using the :c:func:`v4l2_async_notifier_init`.
notifier must be initialized using the :c:func:`v4l2_async_nf_init`.
Second, bridge drivers can then begin to form a list of subdevice descriptors
that the bridge device needs for its operation. Several functions are available
to add subdevice descriptors to a notifier, depending on the type of device and
the needs of the driver.

:c:func:`v4l2_async_notifier_add_fwnode_remote_subdev` and
:c:func:`v4l2_async_notifier_add_i2c_subdev` are for bridge and ISP drivers for
:c:func:`v4l2_async_nf_add_fwnode_remote` and
:c:func:`v4l2_async_nf_add_i2c` are for bridge and ISP drivers for
registering their async sub-devices with the notifier.

:c:func:`v4l2_async_register_subdev_sensor` is a helper function for
@@ -230,7 +230,7 @@ These functions allocate an async sub-device descriptor which is of type struct

	...

	my_asd = v4l2_async_notifier_add_fwnode_remote_subdev(&notifier, ep,
	my_asd = v4l2_async_nf_add_fwnode_remote(&notifier, ep,
						 struct my_async_subdev);
	fwnode_handle_put(ep);

+8 −9
Original line number Diff line number Diff line
@@ -606,19 +606,18 @@ static int max9286_v4l2_notifier_register(struct max9286_priv *priv)
	if (!priv->nsources)
		return 0;

	v4l2_async_notifier_init(&priv->notifier);
	v4l2_async_nf_init(&priv->notifier);

	for_each_source(priv, source) {
		unsigned int i = to_index(priv, source);
		struct max9286_asd *mas;

		mas = v4l2_async_notifier_add_fwnode_subdev(&priv->notifier,
							    source->fwnode,
		mas = v4l2_async_nf_add_fwnode(&priv->notifier, source->fwnode,
					       struct max9286_asd);
		if (IS_ERR(mas)) {
			dev_err(dev, "Failed to add subdev for source %u: %ld",
				i, PTR_ERR(mas));
			v4l2_async_notifier_cleanup(&priv->notifier);
			v4l2_async_nf_cleanup(&priv->notifier);
			return PTR_ERR(mas);
		}

@@ -627,10 +626,10 @@ static int max9286_v4l2_notifier_register(struct max9286_priv *priv)

	priv->notifier.ops = &max9286_notify_ops;

	ret = v4l2_async_subdev_notifier_register(&priv->sd, &priv->notifier);
	ret = v4l2_async_subdev_nf_register(&priv->sd, &priv->notifier);
	if (ret) {
		dev_err(dev, "Failed to register subdev_notifier");
		v4l2_async_notifier_cleanup(&priv->notifier);
		v4l2_async_nf_cleanup(&priv->notifier);
		return ret;
	}

@@ -642,8 +641,8 @@ static void max9286_v4l2_notifier_unregister(struct max9286_priv *priv)
	if (!priv->nsources)
		return;

	v4l2_async_notifier_unregister(&priv->notifier);
	v4l2_async_notifier_cleanup(&priv->notifier);
	v4l2_async_nf_unregister(&priv->notifier);
	v4l2_async_nf_cleanup(&priv->notifier);
}

static int max9286_s_stream(struct v4l2_subdev *sd, int enable)
+10 −12
Original line number Diff line number Diff line
@@ -876,9 +876,8 @@ static int mipid02_parse_rx_ep(struct mipid02_dev *bridge)
	bridge->rx = ep;

	/* register async notifier so we get noticed when sensor is connected */
	v4l2_async_notifier_init(&bridge->notifier);
	asd = v4l2_async_notifier_add_fwnode_remote_subdev(
					&bridge->notifier,
	v4l2_async_nf_init(&bridge->notifier);
	asd = v4l2_async_nf_add_fwnode_remote(&bridge->notifier,
					      of_fwnode_handle(ep_node),
					      struct v4l2_async_subdev);
	of_node_put(ep_node);
@@ -890,10 +889,9 @@ static int mipid02_parse_rx_ep(struct mipid02_dev *bridge)
	}
	bridge->notifier.ops = &mipid02_notifier_ops;

	ret = v4l2_async_subdev_notifier_register(&bridge->sd,
						  &bridge->notifier);
	ret = v4l2_async_subdev_nf_register(&bridge->sd, &bridge->notifier);
	if (ret)
		v4l2_async_notifier_cleanup(&bridge->notifier);
		v4l2_async_nf_cleanup(&bridge->notifier);

	return ret;

@@ -1031,8 +1029,8 @@ static int mipid02_probe(struct i2c_client *client)
	return 0;

unregister_notifier:
	v4l2_async_notifier_unregister(&bridge->notifier);
	v4l2_async_notifier_cleanup(&bridge->notifier);
	v4l2_async_nf_unregister(&bridge->notifier);
	v4l2_async_nf_cleanup(&bridge->notifier);
power_off:
	mipid02_set_power_off(bridge);
entity_cleanup:
@@ -1048,8 +1046,8 @@ static int mipid02_remove(struct i2c_client *client)
	struct v4l2_subdev *sd = i2c_get_clientdata(client);
	struct mipid02_dev *bridge = to_mipid02_dev(sd);

	v4l2_async_notifier_unregister(&bridge->notifier);
	v4l2_async_notifier_cleanup(&bridge->notifier);
	v4l2_async_nf_unregister(&bridge->notifier);
	v4l2_async_nf_cleanup(&bridge->notifier);
	v4l2_async_unregister_subdev(&bridge->sd);
	mipid02_set_power_off(bridge);
	media_entity_cleanup(&bridge->sd.entity);
+9 −8
Original line number Diff line number Diff line
@@ -1478,8 +1478,9 @@ static int cio2_parse_firmware(struct cio2_device *cio2)
		if (ret)
			goto err_parse;

		s_asd = v4l2_async_notifier_add_fwnode_remote_subdev(
				&cio2->notifier, ep, struct sensor_async_subdev);
		s_asd = v4l2_async_nf_add_fwnode_remote(&cio2->notifier, ep,
							struct
							sensor_async_subdev);
		if (IS_ERR(s_asd)) {
			ret = PTR_ERR(s_asd);
			goto err_parse;
@@ -1502,7 +1503,7 @@ static int cio2_parse_firmware(struct cio2_device *cio2)
	 * suspend.
	 */
	cio2->notifier.ops = &cio2_async_ops;
	ret = v4l2_async_notifier_register(&cio2->v4l2_dev, &cio2->notifier);
	ret = v4l2_async_nf_register(&cio2->v4l2_dev, &cio2->notifier);
	if (ret)
		dev_err(&cio2->pci_dev->dev,
			"failed to register async notifier : %d\n", ret);
@@ -1804,7 +1805,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
	if (r)
		goto fail_v4l2_device_unregister;

	v4l2_async_notifier_init(&cio2->notifier);
	v4l2_async_nf_init(&cio2->notifier);

	/* Register notifier for subdevices we care */
	r = cio2_parse_firmware(cio2);
@@ -1824,8 +1825,8 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
	return 0;

fail_clean_notifier:
	v4l2_async_notifier_unregister(&cio2->notifier);
	v4l2_async_notifier_cleanup(&cio2->notifier);
	v4l2_async_nf_unregister(&cio2->notifier);
	v4l2_async_nf_cleanup(&cio2->notifier);
	cio2_queues_exit(cio2);
fail_v4l2_device_unregister:
	v4l2_device_unregister(&cio2->v4l2_dev);
@@ -1844,8 +1845,8 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
	struct cio2_device *cio2 = pci_get_drvdata(pci_dev);

	media_device_unregister(&cio2->media_dev);
	v4l2_async_notifier_unregister(&cio2->notifier);
	v4l2_async_notifier_cleanup(&cio2->notifier);
	v4l2_async_nf_unregister(&cio2->notifier);
	v4l2_async_nf_cleanup(&cio2->notifier);
	cio2_queues_exit(cio2);
	cio2_fbpt_exit_dummy(cio2);
	v4l2_device_unregister(&cio2->v4l2_dev);
+10 −9
Original line number Diff line number Diff line
@@ -2297,7 +2297,7 @@ vpfe_get_pdata(struct vpfe_device *vpfe)

	dev_dbg(dev, "vpfe_get_pdata\n");

	v4l2_async_notifier_init(&vpfe->notifier);
	v4l2_async_nf_init(&vpfe->notifier);

	if (!IS_ENABLED(CONFIG_OF) || !dev->of_node)
		return dev->platform_data;
@@ -2365,9 +2365,10 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
			goto cleanup;
		}

		pdata->asd[i] = v4l2_async_notifier_add_fwnode_subdev(
			&vpfe->notifier, of_fwnode_handle(rem),
			struct v4l2_async_subdev);
		pdata->asd[i] = v4l2_async_nf_add_fwnode(&vpfe->notifier,
							 of_fwnode_handle(rem),
							 struct
							 v4l2_async_subdev);
		of_node_put(rem);
		if (IS_ERR(pdata->asd[i]))
			goto cleanup;
@@ -2377,7 +2378,7 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
	return pdata;

cleanup:
	v4l2_async_notifier_cleanup(&vpfe->notifier);
	v4l2_async_nf_cleanup(&vpfe->notifier);
	of_node_put(endpoint);
	return NULL;
}
@@ -2465,7 +2466,7 @@ static int vpfe_probe(struct platform_device *pdev)
	}

	vpfe->notifier.ops = &vpfe_async_ops;
	ret = v4l2_async_notifier_register(&vpfe->v4l2_dev, &vpfe->notifier);
	ret = v4l2_async_nf_register(&vpfe->v4l2_dev, &vpfe->notifier);
	if (ret) {
		vpfe_err(vpfe, "Error registering async notifier\n");
		ret = -EINVAL;
@@ -2477,7 +2478,7 @@ static int vpfe_probe(struct platform_device *pdev)
probe_out_v4l2_unregister:
	v4l2_device_unregister(&vpfe->v4l2_dev);
probe_out_cleanup:
	v4l2_async_notifier_cleanup(&vpfe->notifier);
	v4l2_async_nf_cleanup(&vpfe->notifier);
	return ret;
}

@@ -2490,8 +2491,8 @@ static int vpfe_remove(struct platform_device *pdev)

	pm_runtime_disable(&pdev->dev);

	v4l2_async_notifier_unregister(&vpfe->notifier);
	v4l2_async_notifier_cleanup(&vpfe->notifier);
	v4l2_async_nf_unregister(&vpfe->notifier);
	v4l2_async_nf_cleanup(&vpfe->notifier);
	v4l2_device_unregister(&vpfe->v4l2_dev);
	video_unregister_device(&vpfe->video_dev);

Loading