media: rcar-vin: Do not hold the group lock when unregistering notifier
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Sun, 28 Nov 2021 13:24:59 +0000 (14:24 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 7 Dec 2021 10:29:55 +0000 (11:29 +0100)
There is no need to hold the group lock when unregistering the notifier,
but doing so triggers a warning about a possible cyclic lock dependency.

The lock warning cover the case where a subdevice is about to be bound
to the notifier at the same time as it's unregistered. The locking for
this scenario is handled in the v4l2-async framework so it's safe to
remove the lock in the driver. This match the locking logic in the
driver for when the notifier in question is registered.

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

index 6d4cffdbf47a0dd0ad73297f14b64f707f306f72..0186ae235113bb8f5c3ba84c4db9b85bacb4314f 100644 (file)
@@ -349,12 +349,10 @@ out:
 
 static void rvin_group_notifier_cleanup(struct rvin_dev *vin)
 {
-       mutex_lock(&vin->group->lock);
        if (&vin->v4l2_dev == vin->group->notifier.v4l2_dev) {
                v4l2_async_nf_unregister(&vin->group->notifier);
                v4l2_async_nf_cleanup(&vin->group->notifier);
        }
-       mutex_unlock(&vin->group->lock);
 }
 
 static int rvin_group_notifier_init(struct rvin_dev *vin, unsigned int port,