summaryrefslogtreecommitdiff
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2023-04-18 12:54:32 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2023-07-28 11:45:51 +0300
commit393cfcc02d1d94defcf23af1fbc9950eafce4519 (patch)
tree56214a951ca16cbf34f11514d0ca8a1e9a959be6 /drivers/media/v4l2-core
parented59bbe18df09e654ffb18f791f2b47ff59384b1 (diff)
downloadlinux-393cfcc02d1d94defcf23af1fbc9950eafce4519.tar.xz
media: v4l: async: Drop duplicate handling when adding connections
The connections are checked for duplicates already when the notifier is registered. This is effectively a sanity check for driver (and possibly obscure firmware) bugs. Don't do this when adding the connection. Retain the int return type for now. It'll be needed very soon again. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743 Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/v4l2-async.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 0a9c9fb2a42c..0cd4e18e628c 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -471,14 +471,11 @@ v4l2_async_nf_has_async_match_entry(struct v4l2_async_notifier *notifier,
/*
* Find out whether an async sub-device was set up already or whether it exists
- * in a given notifier. The skip_self argument is used to skip testing the same
- * sub-device in the notifier in case the sub-device has been already added to
- * the notifier.
+ * in a given notifier.
*/
static bool
v4l2_async_nf_has_async_match(struct v4l2_async_notifier *notifier,
- struct v4l2_async_match_desc *match,
- bool skip_self)
+ struct v4l2_async_match_desc *match)
{
struct v4l2_async_connection *asc;
@@ -486,7 +483,7 @@ v4l2_async_nf_has_async_match(struct v4l2_async_notifier *notifier,
/* Check that an asd is not being added more than once. */
list_for_each_entry(asc, &notifier->asc_list, asc_entry) {
- if (skip_self && &asc->match == match)
+ if (&asc->match == match)
continue;
if (v4l2_async_match_equal(&asc->match, match))
return true;
@@ -501,16 +498,14 @@ v4l2_async_nf_has_async_match(struct v4l2_async_notifier *notifier,
}
static int v4l2_async_nf_match_valid(struct v4l2_async_notifier *notifier,
- struct v4l2_async_match_desc *match,
- bool skip_self)
+ struct v4l2_async_match_desc *match)
{
struct device *dev = notifier_dev(notifier);
switch (match->type) {
case V4L2_ASYNC_MATCH_TYPE_I2C:
case V4L2_ASYNC_MATCH_TYPE_FWNODE:
- if (v4l2_async_nf_has_async_match(notifier, match,
- skip_self)) {
+ if (v4l2_async_nf_has_async_match(notifier, match)) {
dev_dbg(dev, "v4l2-async: match descriptor already listed in a notifier\n");
return -EEXIST;
}
@@ -541,7 +536,7 @@ static int __v4l2_async_nf_register(struct v4l2_async_notifier *notifier)
mutex_lock(&list_lock);
list_for_each_entry(asc, &notifier->asc_list, asc_entry) {
- ret = v4l2_async_nf_match_valid(notifier, &asc->match, true);
+ ret = v4l2_async_nf_match_valid(notifier, &asc->match);
if (ret)
goto err_unlock;
@@ -670,19 +665,13 @@ EXPORT_SYMBOL_GPL(v4l2_async_nf_cleanup);
static int __v4l2_async_nf_add_connection(struct v4l2_async_notifier *notifier,
struct v4l2_async_connection *asc)
{
- int ret;
-
mutex_lock(&list_lock);
- ret = v4l2_async_nf_match_valid(notifier, &asc->match, false);
- if (ret)
- goto unlock;
-
list_add_tail(&asc->asc_entry, &notifier->asc_list);
-unlock:
mutex_unlock(&list_lock);
- return ret;
+
+ return 0;
}
struct v4l2_async_connection *