Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Suggested-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200307083023.76498-5-pankaj.laxminarayan.bharadiya@intel.com
Reviewed-by: Lyude Paul <lyude@redhat.com>

authored by

Pankaj Bharadiya and committed by
Lyude Paul
e1ae63b3 a5c4dc16

+14 -2
+14 -2
drivers/gpu/drm/drm_dp_mst_topology.c
··· 4673 4673 mutex_unlock(&mgr->qlock); 4674 4674 } 4675 4675 4676 + static inline void drm_dp_destroy_connector(struct drm_dp_mst_port *port) 4677 + { 4678 + if (!port->connector) 4679 + return; 4680 + 4681 + if (port->mgr->cbs->destroy_connector) { 4682 + port->mgr->cbs->destroy_connector(port->mgr, port->connector); 4683 + } else { 4684 + drm_connector_unregister(port->connector); 4685 + drm_connector_put(port->connector); 4686 + } 4687 + } 4688 + 4676 4689 static inline void 4677 4690 drm_dp_delayed_destroy_port(struct drm_dp_mst_port *port) 4678 4691 { 4679 - if (port->connector) 4680 - port->mgr->cbs->destroy_connector(port->mgr, port->connector); 4692 + drm_dp_destroy_connector(port); 4681 4693 4682 4694 drm_dp_port_set_pdt(port, DP_PEER_DEVICE_NONE, port->mcs); 4683 4695 drm_dp_mst_put_port_malloc(port);