drm/vc4: crtc: Fix vc4_get_crtc_encoder logic
authorMaxime Ripard <maxime@cerno.tech>
Fri, 7 May 2021 15:05:07 +0000 (17:05 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Mon, 24 May 2021 12:41:50 +0000 (14:41 +0200)
commit5a184d959d5a5a66b377cb5cd4c95a80388e0c88
treeead2343c293105d1dddf145d465482b116b50e5c
parentc6883985d46319e0d4f159de8932b09ff93e877d
drm/vc4: crtc: Fix vc4_get_crtc_encoder logic

The vc4_get_crtc_encoder function currently only works when the
connector->state->crtc pointer is set, which is only true when the
connector is currently enabled.

However, we use it as part of the disable path as well, and our lookup
will fail in that case, resulting in it returning a null pointer we
can't act on.

We can access the connector that used to be connected to that crtc
though using the old connector state in the disable path.

Since we want to support both the enable and disable path, we can
support it by passing the state accessor variant as a function pointer,
together with the atomic state.

Fixes: 792c3132bc1b ("drm/vc4: encoder: Add finer-grained encoder callbacks")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210507150515.257424-5-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_crtc.c