Skip to content

Commit e1ae63b

Browse files
bpankajlLyude
authored andcommitted
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 <[email protected]> Suggested-by: Emil Velikov <[email protected]> Suggested-by: Lyude Paul <[email protected]> Signed-off-by: Lyude Paul <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Lyude Paul <[email protected]>
1 parent a5c4dc1 commit e1ae63b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/gpu/drm/drm_dp_mst_topology.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4673,11 +4673,23 @@ static void drm_dp_tx_work(struct work_struct *work)
46734673
mutex_unlock(&mgr->qlock);
46744674
}
46754675

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+
46764689
static inline void
46774690
drm_dp_delayed_destroy_port(struct drm_dp_mst_port *port)
46784691
{
4679-
if (port->connector)
4680-
port->mgr->cbs->destroy_connector(port->mgr, port->connector);
4692+
drm_dp_destroy_connector(port);
46814693

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

0 commit comments

Comments
 (0)