[why]
When resume, we will reprobe the topology to detect any changes during
suspend. If we unplug a branch device during suspend and then resume, we
can eventually unregister child connectors of this branch device because
we call drm_dp_mst_topology_put_mstb() in drm_dp_port_set_pdt().
However, we don't unregister connectors for end devices which is
disconnected during suspend. e.g. Unplug a SST monitor during
suspend then resume. We won't unregister this connector which is no
longer exist in the topology.

[How]
Unregister connectors for disconnected end devices when resume.

Cc: sta...@vger.kernel.org
Signed-off-by: Wayne Lin <wayne....@amd.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 85a959427247..0b04ea65cb8e 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2478,6 +2478,12 @@ drm_dp_mst_handle_link_address_port(struct 
drm_dp_mst_branch *mstb,
                 drm_dp_mst_is_end_device(port->pdt, port->mcs))
                drm_dp_mst_port_add_connector(mstb, port);
 
+       if (port->connector && port->pdt == DP_PEER_DEVICE_NONE) {
+               drm_connector_unregister(port->connector);
+               drm_connector_put(port->connector);
+               port->connector = NULL;
+       }
+
        if (send_link_addr && port->mstb) {
                ret = drm_dp_send_link_address(mgr, port->mstb);
                if (ret == 1) /* MSTB below us changed */
-- 
2.17.1

Reply via email to