From: Ville Syrjälä <ville.syrj...@linux.intel.com>

The i2c adapter is only relevant for some peer device types, so
let's clear the pdt if it's still the same as the old_pdt when we
tear down the i2c adapter.

I don't really like this design pattern of updating port->whatever
before doing the accompanying changes and passing around old_whatever
to figure stuff out. Would make much more sense to me to the pass the
new value around and only update the port->whatever when things are
consistent. But let's try to work with what we have right now.

Cc: stable at vger.kernel.org
Cc: Carlos Santa <carlos.santa at intel.com>
Cc: Kirill A. Shutemov <kirill at shutemov.name>
Tested-by: Carlos Santa <carlos.santa at intel.com>
Tested-by: Kirill A. Shutemov <kirill at shutemov.name>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97666
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 04e457117980..956babc161e5 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -882,6 +882,9 @@ static void drm_dp_port_teardown_pdt(struct drm_dp_mst_port 
*port, int old_pdt)
                drm_dp_put_mst_branch_device(mstb);
                break;
        }
+
+       if (port->pdt == old_pdt)
+               port->pdt = DP_PEER_DEVICE_NONE;
 }

 static void drm_dp_destroy_port(struct kref *kref)
-- 
2.7.4

Reply via email to