Skip to contentSkip to conversation

drm/dp_mst: Remove ->destroy_connector() callback

PATCH In review Lyude Paul 2 participants 6 messages Mar 31, 2020 – Apr 1, 2020

Subsystems (4)
lore
Share & tools
lore

Lyude Paul

author
#0 lore raw

cover drm/dp_mst: Remove ->destroy_connector() callback

This finishes up the work that Pankaj Bharadiya started in:

https://patchwork.freedesktop.org/series/74412/

And allows us to entirely remove ->destroy_connector()

Lyude Paul (4):
drm/amd/amdgpu_dm/mst: Remove unneeded edid assignment when destroying
connectors
drm/amd/amdgpu_dm/mst: Remove ->destroy_connector() callback drm/amd/amdgpu_dm/mst: Stop printing extra messages in
dm_dp_add_mst_connector()
drm/dp_mst: Remove drm_dp_mst_topology_cbs.destroy_connector

 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 45 +++++--------------
 drivers/gpu/drm/drm_dp_mst_topology.c         | 16 ++-----
 include/drm/drm_dp_mst_helper.h               |  2 -
 3 files changed, 15 insertions(+), 48 deletions(-)
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#1 lore raw

PATCH 1/4 drm/amd/amdgpu_dm/mst: Remove unneeded edid assignment when destroying connectors

Doesn't do anything, noticed this while cleaning up some unrelated stuff.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +0 -1
index e8208df420d9..7b3303efb1ff 100644
@@ -140,7 +140,6 @@ dm_dp_mst_connector_destroy(struct drm_connector *connector)
 	struct amdgpu_encoder *amdgpu_encoder = amdgpu_dm_connector->mst_encoder;
 
 	kfree(amdgpu_dm_connector->edid);
-	amdgpu_dm_connector->edid = NULL;
 
 	drm_encoder_cleanup(&amdgpu_encoder->base);
 	kfree(amdgpu_encoder);
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw

PATCH 2/4 drm/amd/amdgpu_dm/mst: Remove ->destroy_connector() callback

In reply to Lyude Paul

Pankaj Bharadiya started cleaning up the MST connector callbacks a while ago, as I pointed out that they are the same across every driver and don't serve much purpose. There was one callback that was left over though from amdgpu, that we delayed removing due to not being completely sure as to whether or not it was needed.

So, I've read through said callback and can confirm it's not at all needed. Pretty much all of the work that is done in dm_dp_destroy_mst_connector() can be done in dm_dp_mst_connector_destroy(). Additionally, I've removed some bits that didn't actually do anything:

* Removed DRM_INFO message we were printing, this shouldn't be info level and there's more appropriate drm debugging flags that should be used instead
* Removed amdgpu_dm_update_freesync_caps() - reading into this function, it doesn't actually do anything important and I'm not sure why it was ever being called here
* Stop clearing aconnector->dc_sink - this also doesn't do anything
* Stop clearing link settings in dc_link - this also doesn't do anything
* Also, use shorter variable

Cc Pankaj Bharadiya <[email protected]>
---
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 39 ++++++-------------
 1 file changed, 12 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +12 -27
index 7b3303efb1ff..09025ccc68ca 100644
@@ -136,16 +136,23 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
 static void
 dm_dp_mst_connector_destroy(struct drm_connector *connector)
 {
-	struct amdgpu_dm_connector *amdgpu_dm_connector = to_amdgpu_dm_connector(connector);
-	struct amdgpu_encoder *amdgpu_encoder = amdgpu_dm_connector->mst_encoder;
+	struct amdgpu_dm_connector *aconnector =
+		to_amdgpu_dm_connector(connector);
+	struct amdgpu_encoder *amdgpu_encoder = aconnector->mst_encoder;
 
-	kfree(amdgpu_dm_connector->edid);
+	if (aconnector->dc_sink) {
+		dc_link_remove_remote_sink(aconnector->dc_link,
+					   aconnector->dc_sink);
+		dc_sink_release(aconnector->dc_sink);
+	}
+
+	kfree(aconnector->edid);
 
 	drm_encoder_cleanup(&amdgpu_encoder->base);
 	kfree(amdgpu_encoder);
 	drm_connector_cleanup(connector);
-	drm_dp_mst_put_port_malloc(amdgpu_dm_connector->port);
-	kfree(amdgpu_dm_connector);
+	drm_dp_mst_put_port_malloc(aconnector->port);
+	kfree(aconnector);
 }
 
 static int
@@ -436,30 +443,8 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
 	return connector;
 }
 
-static void dm_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
-					struct drm_connector *connector)
-{
-	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
-
-	DRM_INFO("DM_MST: Disabling connector: %p [id: %d] [master: %p]\n",
-		 aconnector, connector->base.id, aconnector->mst_port);
-
-	if (aconnector->dc_sink) {
-		amdgpu_dm_update_freesync_caps(connector, NULL);
-		dc_link_remove_remote_sink(aconnector->dc_link,
-					   aconnector->dc_sink);
-		dc_sink_release(aconnector->dc_sink);
-		aconnector->dc_sink = NULL;
-		aconnector->dc_link->cur_link_settings.lane_count = 0;
-	}
-
-	drm_connector_unregister(connector);
-	drm_connector_put(connector);
-}
-
 static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
 	.add_connector = dm_dp_add_mst_connector,
-	.destroy_connector = dm_dp_destroy_mst_connector,
 };
 
 void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 3/4 drm/amd/amdgpu_dm/mst: Stop printing extra messages in dm_dp_add_mst_connector()

In reply to Lyude Paul

You can already trace the creation and destruction of connectors using DRM, and we definitely don't need to be printing info messages on connector hotplugs as well. So, get rid of these.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +0 -5
index 09025ccc68ca..d56b758bcce5 100644
@@ -433,13 +433,8 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
 	 */
 	amdgpu_dm_connector_funcs_reset(connector);
 
-	DRM_INFO("DM_MST: added connector: %p [id: %d] [master: %p]\n",
-		 aconnector, connector->base.id, aconnector->mst_port);
-
 	drm_dp_mst_get_port_malloc(port);
 
-	DRM_DEBUG_KMS(":%d\n", connector->base.id);
-
 	return connector;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw

PATCH 4/4 drm/dp_mst: Remove drm_dp_mst_topology_cbs.destroy_connector

In reply to Lyude Paul

Now that we've removed the last user of this callback, get rid of it and drm_dp_destroy_connector().

Cc Pankaj Bharadiya <[email protected]>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 16 +++-------------
 include/drm/drm_dp_mst_helper.h       |  2 --
 2 files changed, 3 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -13
index 31b7a8f5309d..e235b2b29f59 100644
@@ -4692,23 +4692,13 @@ 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)
+static inline void
+drm_dp_delayed_destroy_port(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 {
+	if (port->connector) {
 		drm_connector_unregister(port->connector);
 		drm_connector_put(port->connector);
 	}
-}
-
-static inline void
-drm_dp_delayed_destroy_port(struct drm_dp_mst_port *port)
-{
-	drm_dp_destroy_connector(port);
 
 	drm_dp_port_set_pdt(port, DP_PEER_DEVICE_NONE, port->mcs);
 	drm_dp_mst_put_port_malloc(port);
include/drm/drm_dp_mst_helper.h +0 -2
index 13461db1444a..7af51c947b81 100644
@@ -488,8 +488,6 @@ struct drm_dp_mst_topology_mgr;
 struct drm_dp_mst_topology_cbs {
 	/* create a connector for a port */
 	struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *path);
-	void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr,
-				  struct drm_connector *connector);
 };
 
 #define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8)
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on the v1 series
#5 lore raw
In reply to Lyude Paul
Quoted 7 lines · Lyude Paul

This finishes up the work that Pankaj Bharadiya started in:

https://patchwork.freedesktop.org/series/74412/

And allows us to entirely remove ->destroy_connector()

Quoted 7 lines

Lyude Paul (4):
drm/amd/amdgpu_dm/mst: Remove unneeded edid assignment when destroying
connectors
drm/amd/amdgpu_dm/mst: Remove ->destroy_connector() callback drm/amd/amdgpu_dm/mst: Stop printing extra messages in
dm_dp_add_mst_connector()
drm/dp_mst: Remove drm_dp_mst_topology_cbs.destroy_connector

I noticed this as well when I was sorting out the load and unload callback removal. Thanks for finishing this up. This series looks good to me, assuming none of the display folks have any concerns:

Quoted 6 lines
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 45 +++++--------------
 drivers/gpu/drm/drm_dp_mst_topology.c         | 16 ++-----
 include/drm/drm_dp_mst_helper.h               |  2 -
 3 files changed, 15 insertions(+), 48 deletions(-)
Quoted 7 lines

--
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel