Hi Frank, On 12/2/26 11:56 AM, Frank Zhang wrote: > Regarding `hdmi->mutex`, this mutex is not only used in atomic enable/disable, > but also used in dw_hdmi_qp_hpd_notify(). Although the lock scope is very > small, it still introduces lock condition for audio callbacks, or am I missing > something? > > To keep the lock scope cleaner, we can use a dedicated mutex (e.g., > `hdmi->audio_mutex`) for tmds_char_rate. Does this sound reasonable to you?
I'd still prefer to reuse hdmi->mutex. In dw_hdmi_qp_hpd_notify() it only covers taking a reference on curr_conn, both read_hpd() and the hotplug event handling run outside of it. Any contention with the audio callbacks is therefore negligible, and those are slow-path operations anyway. Moreover, curr_conn and tmds_char_rate describe the same thing, i.e. the currently active output, and both are published by the atomic enable/disable hooks, so keeping them under a single lock ensures they're always seen in a consistent state. A second mutex adds unnecessary complexity and could potentially open a window where the two get out of sync. So please just update the comment above the mutex to mention it also guards tmds_char_rate. > This commit(247695b19afc) is on branch: drm-misc-next, right? I will rebase > onto this branch in the next version. Yes. Cristian
