Commit e1ae63b3 authored by Pankaj Bharadiya's avatar Pankaj Bharadiya Committed by Lyude Paul
Browse files

drm: Add drm_dp_destroy_connector helper and use it



drm_dp_mst_topology_mgr_cbs.destroy_connector callbacks are identical
amongst every driver and don't do anything other than cleaning up the
connector (drm_connector_unregister()/drm_connector_put()) except for
amdgpu_dm driver where some amdgpu_dm specific code in there which I
an not sure if it should stay or not.

Create and use a helper which calls driver's destroy_connector hook if
available otherwise does cleanup internally.

This is the step towards removing identical hooks from every driver.

Signed-off-by: default avatarPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Suggested-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Suggested-by: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200307083023.76498-5-pankaj.laxminarayan.bharadiya@intel.com


Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent a5c4dc16
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -4673,11 +4673,23 @@ static void drm_dp_tx_work(struct work_struct *work)
	mutex_unlock(&mgr->qlock);
}

static inline void drm_dp_destroy_connector(struct drm_dp_mst_port *port)
{
	if (!port->connector)
		return;

	if (port->mgr->cbs->destroy_connector) {
		port->mgr->cbs->destroy_connector(port->mgr, port->connector);
	} else {
		drm_connector_unregister(port->connector);
		drm_connector_put(port->connector);
	}
}

static inline void
drm_dp_delayed_destroy_port(struct drm_dp_mst_port *port)
{
	if (port->connector)
		port->mgr->cbs->destroy_connector(port->mgr, port->connector);
	drm_dp_destroy_connector(port);

	drm_dp_port_set_pdt(port, DP_PEER_DEVICE_NONE, port->mcs);
	drm_dp_mst_put_port_malloc(port);