OSDN Git Service

drm/vc4: txp: Protect device resources
authorMaxime Ripard <maxime@cerno.tech>
Mon, 11 Jul 2022 17:39:23 +0000 (19:39 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 13 Jul 2022 08:46:11 +0000 (10:46 +0200)
commitb7345c9799da578c150fde3072446e4049c39c41
tree9c8c9a5941ad2692912bb8afe885d2e9ee286d91
parentd67210bbe5f3ec53fa6a46fbaad87d7a65ab544c
drm/vc4: txp: Protect device resources

Our current code now mixes some resources whose lifetime are tied to the
device (clocks, IO mappings, etc.) and some that are tied to the DRM device
(encoder, bridge).

The device one will be freed at unbind time, but the DRM one will only be
freed when the last user of the DRM device closes its file handle.

So we end up with a time window during which we can call the encoder hooks,
but we don't have access to the underlying resources and device.

Let's protect all those sections with drm_dev_enter() and drm_dev_exit() so
that we bail out if we are during that window.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220711173939.1132294-54-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_txp.c