media: rcar-vin: remove unneeded locking in async callbacks
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fri, 4 Jan 2019 16:12:18 +0000 (11:12 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 16 Jan 2019 16:32:52 +0000 (11:32 -0500)
The locking implemented in the async notifier callbacks are unnecessary
as the global list_lock in v4l2-async.c is held whenever one of the
callbacks are called.

The locking in itself is not harmful however it produces a LOCKDEP
warning between the global v4l2-async list_lock and the rcar-vin local
locking schema. Remove the rcar-vin locking for the async callbacks to
reduce complexity and silent the false LOCKDEP warning.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/rcar-vin/rcar-core.c

index f0719ce24b97a9f95b761f307be28878d9b17d5c..0e81b557f3b6e53c4cada5a81a75bd5e9e09155a 100644 (file)
@@ -542,9 +542,7 @@ static void rvin_parallel_notify_unbind(struct v4l2_async_notifier *notifier,
 
        vin_dbg(vin, "unbind parallel subdev %s\n", subdev->name);
 
-       mutex_lock(&vin->lock);
        rvin_parallel_subdevice_detach(vin);
-       mutex_unlock(&vin->lock);
 }
 
 static int rvin_parallel_notify_bound(struct v4l2_async_notifier *notifier,
@@ -554,9 +552,7 @@ static int rvin_parallel_notify_bound(struct v4l2_async_notifier *notifier,
        struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev);
        int ret;
 
-       mutex_lock(&vin->lock);
        ret = rvin_parallel_subdevice_attach(vin, subdev);
-       mutex_unlock(&vin->lock);
        if (ret)
                return ret;
 
@@ -664,7 +660,6 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
        }
 
        /* Create all media device links between VINs and CSI-2's. */
-       mutex_lock(&vin->group->lock);
        for (route = vin->info->routes; route->mask; route++) {
                struct media_pad *source_pad, *sink_pad;
                struct media_entity *source, *sink;
@@ -700,7 +695,6 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
                        break;
                }
        }
-       mutex_unlock(&vin->group->lock);
 
        return ret;
 }
@@ -716,8 +710,6 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
                if (vin->group->vin[i])
                        rvin_v4l2_unregister(vin->group->vin[i]);
 
-       mutex_lock(&vin->group->lock);
-
        for (i = 0; i < RVIN_CSI_MAX; i++) {
                if (vin->group->csi[i].fwnode != asd->match.fwnode)
                        continue;
@@ -725,8 +717,6 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
                vin_dbg(vin, "Unbind CSI-2 %s from slot %u\n", subdev->name, i);
                break;
        }
-
-       mutex_unlock(&vin->group->lock);
 }
 
 static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
@@ -736,8 +726,6 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
        struct rvin_dev *vin = v4l2_dev_to_vin(notifier->v4l2_dev);
        unsigned int i;
 
-       mutex_lock(&vin->group->lock);
-
        for (i = 0; i < RVIN_CSI_MAX; i++) {
                if (vin->group->csi[i].fwnode != asd->match.fwnode)
                        continue;
@@ -746,8 +734,6 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
                break;
        }
 
-       mutex_unlock(&vin->group->lock);
-
        return 0;
 }