media: rcar-vin: Unconditionally unregister notifier on remove
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Thu, 13 Aug 2020 21:06:01 +0000 (23:06 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 29 Aug 2020 06:16:38 +0000 (08:16 +0200)
commitf18d6a4cb0561c322e284ed404f2ec97b1092396
treeef77f0924ba182b3cbbe2c5988b3514d6174d194
parent780d815dcc9b34d93ae69385a8465c38d423ff0f
media: rcar-vin: Unconditionally unregister notifier on remove

If the VIN device is part of a group of VIN devices (all Gen3 boards)
there is no reason to only unregister the group notifier if the VIN that
registers the notifier is removed. The VIN that registers the notifier
is always the last VIN device to be bound, so keeping the notifier
around after any VIN is unbound creates an unbalanced state where no VIN
in the group is operational.

Fix this by unconditionally unregistering the notifier when any VIN
device is unbound. Unregistering the notifier will lead to unbound()
being called and all video devices exposed by any VIN instance to be
removed.

The lock was only needed to protect the check which VIN registers the
notifier and is no longer needed.

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