drm/vc4: hdmi: Remove mutex in detect
authorMaxime Ripard <maxime@cerno.tech>
Mon, 29 Aug 2022 13:47:26 +0000 (15:47 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Tue, 13 Sep 2022 15:20:26 +0000 (16:20 +0100)
commitda94e9c64c19a7fb2caa896628cb501a06cc3e96
treebbdd95880e0b62ba9c9c183192d73a58ab9c5846
parentd098a31fe0f867cb7c00a4206740e768b00d8550
drm/vc4: hdmi: Remove mutex in detect

We recently introduced a new mutex to protect concurrent execution of
ALSA and KMS hooks, and the concurrent access to some of vc4_hdmi
fields.

However, using it in the detect hook was creating a reentrency issue
with CEC code. Indeed, calling cec_s_phys_addr_from_edid from detect
might call the CEC adap_enable hook with the lock held, eventually
resulting in a deadlock.

Since we didn't really need to protect anything at the moment in the CEC
code, the decision was made to ignore the mutex in those CEC hooks,
working around the issue.

However, we can have the same thing happening if we end up triggering a
mode set from the detect callback, for example using
drm_atomic_helper_connector_hdmi_reset_link().

Since we don't really need to protect anything in detect either, let's
just drop the lock in detect, and add it again in CEC.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220829134731.213478-4-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/vc4/vc4_hdmi.h