]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/mediatek: mtk_hdmi: Move plugged_cb/codec_dev setting to new function
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tue, 15 Apr 2025 10:43:08 +0000 (12:43 +0200)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Mon, 21 Apr 2025 13:38:37 +0000 (13:38 +0000)
In preparation for splitting common bits of this driver, move the
mutex-protected cable plugged callback and codec device setting
to a new function called mtk_hdmi_audio_set_plugged_cb().

Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20250415104321.51149-11-angelogioacchino.delregno@collabora.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_hdmi.c

index 697508edfa41fd3e36318b305276e38b2d4c1e73..60ec16f6827ff057b861850ed8420c8486a7d2e3 100644 (file)
@@ -1582,17 +1582,22 @@ static int mtk_hdmi_audio_get_eld(struct device *dev, void *data, uint8_t *buf,
        return 0;
 }
 
-static int mtk_hdmi_audio_hook_plugged_cb(struct device *dev, void *data,
-                                         hdmi_codec_plugged_cb fn,
+static void mtk_hdmi_audio_set_plugged_cb(struct mtk_hdmi *hdmi, hdmi_codec_plugged_cb fn,
                                          struct device *codec_dev)
 {
-       struct mtk_hdmi *hdmi = data;
-
        mutex_lock(&hdmi->update_plugged_status_lock);
        hdmi->plugged_cb = fn;
        hdmi->codec_dev = codec_dev;
        mutex_unlock(&hdmi->update_plugged_status_lock);
+}
+
+static int mtk_hdmi_audio_hook_plugged_cb(struct device *dev, void *data,
+                                         hdmi_codec_plugged_cb fn,
+                                         struct device *codec_dev)
+{
+       struct mtk_hdmi *hdmi = data;
 
+       mtk_hdmi_audio_set_plugged_cb(hdmi, fn, codec_dev);
        mtk_hdmi_update_plugged_status(hdmi);
 
        return 0;