Hi, Angelo: On Thu, 2024-12-05 at 12:45 +0100, AngeloGioacchino Del Regno wrote: > External email : Please do not click links or open attachments until you have verified the sender or the content. > > > In preparation for adding a new driver for the HDMI TX v2 IP, > split out the functions that will be common between the already > present mtk_hdmi (v1) driver and the new one. > > Since the probe flow for both drivers is 90% similar, add a common > probe function that will be called from each driver's .probe() > callback, avoiding lots of code duplication. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx> > --- [snip] > static void mtk_hdmi_clk_disable_audio(struct mtk_hdmi *hdmi) > @@ -1143,10 +886,11 @@ static void mtk_hdmi_clk_disable_audio(struct mtk_hdmi *hdmi) > static enum drm_connector_status > mtk_hdmi_update_plugged_status(struct mtk_hdmi *hdmi) > { > - bool connected; > + bool connected = true; > > mutex_lock(&hdmi->update_plugged_status_lock); > - connected = mtk_cec_hpd_high(hdmi->cec_dev); > + if (hdmi->cec_dev) Only v1 would call mtk_hdmi_update_plugged_status() and v1 should has hdmi->cec_dev, so this checking is redundant. > + connected = mtk_cec_hpd_high(hdmi->cec_dev); > if (hdmi->plugged_cb && hdmi->codec_dev) > hdmi->plugged_cb(hdmi->codec_dev, connected); > mutex_unlock(&hdmi->update_plugged_status_lock); > @@ -1254,18 +998,12 @@ static int mtk_hdmi_bridge_attach(struct drm_bridge *bridge, > return ret; > } > > - mtk_cec_set_hpd_event(hdmi->cec_dev, mtk_hdmi_hpd_event, hdmi->dev); > + if (hdmi->cec_dev) Ditto. Regards, CK > + mtk_cec_set_hpd_event(hdmi->cec_dev, mtk_hdmi_hpd_event, hdmi->dev); > > return 0; > } >