Skip to content
Permalink
Browse files
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: Sakari Ailus <sakari.ailus@linux.intel.com>
  • Loading branch information
Sakari Ailus authored and intel-lab-lkp committed Jun 22, 2021
1 parent 477fa1c commit 922378435e59e00aef32ba7590991f0e9b24acac
Show file tree
Hide file tree
Showing 41 changed files with 469 additions and 490 deletions.
@@ -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,8 +230,8 @@ These functions allocate an async sub-device descriptor which is of type struct
...
my_asd = v4l2_async_notifier_add_fwnode_remote_subdev(&notifier, ep,
struct my_async_subdev);
my_asd = v4l2_async_nf_add_fwnode_remote(&notifier, ep,
struct my_async_subdev);
fwnode_handle_put(ep);
if (IS_ERR(asd))
@@ -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,
struct max9286_asd);
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)
@@ -876,11 +876,10 @@ 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,
of_fwnode_handle(ep_node),
struct v4l2_async_subdev);
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);

if (IS_ERR(asd)) {
@@ -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);
@@ -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);
@@ -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);

@@ -2218,8 +2218,8 @@ void isc_subdev_cleanup(struct isc_device *isc)
struct isc_subdev_entity *subdev_entity;

list_for_each_entry(subdev_entity, &isc->subdev_entities, list) {
v4l2_async_notifier_unregister(&subdev_entity->notifier);
v4l2_async_notifier_cleanup(&subdev_entity->notifier);
v4l2_async_nf_unregister(&subdev_entity->notifier);
v4l2_async_nf_cleanup(&subdev_entity->notifier);
}

INIT_LIST_HEAD(&isc->subdev_entities);
@@ -1159,23 +1159,22 @@ static int isi_graph_init(struct atmel_isi *isi)
if (!ep)
return -EINVAL;

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

asd = v4l2_async_notifier_add_fwnode_remote_subdev(
&isi->notifier,
of_fwnode_handle(ep),
struct v4l2_async_subdev);
asd = v4l2_async_nf_add_fwnode_remote(&isi->notifier,
of_fwnode_handle(ep),
struct v4l2_async_subdev);
of_node_put(ep);

if (IS_ERR(asd))
return PTR_ERR(asd);

isi->notifier.ops = &isi_graph_notify_ops;

ret = v4l2_async_notifier_register(&isi->v4l2_dev, &isi->notifier);
ret = v4l2_async_nf_register(&isi->v4l2_dev, &isi->notifier);
if (ret < 0) {
dev_err(isi->dev, "Notifier registration failed\n");
v4l2_async_notifier_cleanup(&isi->notifier);
v4l2_async_nf_cleanup(&isi->notifier);
return ret;
}

@@ -1327,8 +1326,8 @@ static int atmel_isi_remove(struct platform_device *pdev)
isi->p_fb_descriptors,
isi->fb_descriptors_phys);
pm_runtime_disable(&pdev->dev);
v4l2_async_notifier_unregister(&isi->notifier);
v4l2_async_notifier_cleanup(&isi->notifier);
v4l2_async_nf_unregister(&isi->notifier);
v4l2_async_nf_cleanup(&isi->notifier);
v4l2_device_unregister(&isi->v4l2_dev);

return 0;
@@ -495,13 +495,14 @@ static int atmel_isc_probe(struct platform_device *pdev)

list_for_each_entry(subdev_entity, &isc->subdev_entities, list) {
struct v4l2_async_subdev *asd;
struct fwnode_handle *fwnode =
of_fwnode_handle(subdev_entity->epn);

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

asd = v4l2_async_notifier_add_fwnode_remote_subdev(
&subdev_entity->notifier,
of_fwnode_handle(subdev_entity->epn),
struct v4l2_async_subdev);
asd = v4l2_async_nf_add_fwnode_remote(&subdev_entity->notifier,
fwnode,
struct v4l2_async_subdev);

of_node_put(subdev_entity->epn);
subdev_entity->epn = NULL;
@@ -513,8 +514,8 @@ static int atmel_isc_probe(struct platform_device *pdev)

subdev_entity->notifier.ops = &isc_async_ops;

ret = v4l2_async_notifier_register(&isc->v4l2_dev,
&subdev_entity->notifier);
ret = v4l2_async_nf_register(&isc->v4l2_dev,
&subdev_entity->notifier);
if (ret) {
dev_err(dev, "fail to register async notifier\n");
goto cleanup_subdev;
@@ -506,9 +506,9 @@ static int microchip_xisc_probe(struct platform_device *pdev)
list_for_each_entry(subdev_entity, &isc->subdev_entities, list) {
struct v4l2_async_subdev *asd;

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

asd = v4l2_async_notifier_add_fwnode_remote_subdev(
asd = v4l2_async_nf_add_fwnode_remote_subdev(
&subdev_entity->notifier,
of_fwnode_handle(subdev_entity->epn),
struct v4l2_async_subdev);
@@ -523,8 +523,8 @@ static int microchip_xisc_probe(struct platform_device *pdev)

subdev_entity->notifier.ops = &isc_async_ops;

ret = v4l2_async_notifier_register(&isc->v4l2_dev,
&subdev_entity->notifier);
ret = v4l2_async_nf_register(&isc->v4l2_dev,
&subdev_entity->notifier);
if (ret) {
dev_err(dev, "fail to register async notifier\n");
goto cleanup_subdev;
@@ -401,21 +401,19 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx)
return -EINVAL;
}

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

asd = v4l2_async_notifier_add_fwnode_remote_subdev(&csi2rx->notifier,
fwh,
struct v4l2_async_subdev);
asd = v4l2_async_nf_add_fwnode_remote(&csi2rx->notifier, fwh,
struct v4l2_async_subdev);
of_node_put(ep);
if (IS_ERR(asd))
return PTR_ERR(asd);

csi2rx->notifier.ops = &csi2rx_notifier_ops;

ret = v4l2_async_subdev_notifier_register(&csi2rx->subdev,
&csi2rx->notifier);
ret = v4l2_async_subdev_nf_register(&csi2rx->subdev, &csi2rx->notifier);
if (ret)
v4l2_async_notifier_cleanup(&csi2rx->notifier);
v4l2_async_nf_cleanup(&csi2rx->notifier);

return ret;
}
@@ -471,7 +469,7 @@ static int csi2rx_probe(struct platform_device *pdev)
return 0;

err_cleanup:
v4l2_async_notifier_cleanup(&csi2rx->notifier);
v4l2_async_nf_cleanup(&csi2rx->notifier);
err_free_priv:
kfree(csi2rx);
return ret;

0 comments on commit 9223784

Please sign in to comment.