drm/amd/display: Remove get_connector_for_link.
authorAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Tue, 14 Feb 2017 18:50:17 +0000 (13:50 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 21:22:07 +0000 (17:22 -0400)
We can keep a 1:1 relation between a link and a physical
connector and hence skip the iteration. This function
is used in context of only physical connetors.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
drivers/gpu/drm/amd/display/dc/dc.h

index d4e01b51f949868d1c10d87e0b2b748fc5d7bdd8..bdf7c6075414190ac34dd71f0900318b9b674a55 100644 (file)
@@ -148,21 +148,6 @@ static struct amdgpu_connector *get_connector_for_sink(
        return NULL;
 }
 
-static struct amdgpu_connector *get_connector_for_link(
-       struct drm_device *dev,
-       const struct dc_link *link)
-{
-       struct drm_connector *connector;
-
-       list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-               struct amdgpu_connector *aconnector = to_amdgpu_connector(connector);
-               if (aconnector->dc_link == link)
-                       return aconnector;
-       }
-
-       return NULL;
-}
-
 static void get_payload_table(
                struct amdgpu_connector *aconnector,
                struct dp_mst_stream_allocation_table *proposed_table)
@@ -363,9 +348,7 @@ bool dm_helpers_dp_mst_start_top_mgr(
                const struct dc_link *link,
                bool boot)
 {
-       struct amdgpu_device *adev = ctx->driver_context;
-       struct drm_device *dev = adev->ddev;
-       struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
+       struct amdgpu_connector *aconnector = link->priv;
 
        if (!aconnector) {
                        DRM_ERROR("Failed to found connector for link!");
@@ -388,9 +371,7 @@ void dm_helpers_dp_mst_stop_top_mgr(
                struct dc_context *ctx,
                const struct dc_link *link)
 {
-       struct amdgpu_device *adev = ctx->driver_context;
-       struct drm_device *dev = adev->ddev;
-       struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
+       struct amdgpu_connector *aconnector = link->priv;
 
        if (!aconnector) {
                        DRM_ERROR("Failed to found connector for link!");
@@ -412,9 +393,7 @@ bool dm_helpers_dp_read_dpcd(
                uint32_t size)
 {
 
-       struct amdgpu_device *adev = ctx->driver_context;
-       struct drm_device *dev = adev->ddev;
-       struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
+       struct amdgpu_connector *aconnector = link->priv;
 
        if (!aconnector) {
                DRM_ERROR("Failed to found connector for link!");
@@ -432,10 +411,7 @@ bool dm_helpers_dp_write_dpcd(
                const uint8_t *data,
                uint32_t size)
 {
-
-       struct amdgpu_device *adev = ctx->driver_context;
-       struct drm_device *dev = adev->ddev;
-       struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
+       struct amdgpu_connector *aconnector = link->priv;
 
        if (!aconnector) {
                DRM_ERROR("Failed to found connector for link!");
@@ -451,9 +427,7 @@ bool dm_helpers_submit_i2c(
                const struct dc_link *link,
                struct i2c_command *cmd)
 {
-       struct amdgpu_device *adev = ctx->driver_context;
-       struct drm_device *dev = adev->ddev;
-       struct amdgpu_connector *aconnector = get_connector_for_link(dev, link);
+       struct amdgpu_connector *aconnector = link->priv;
        struct i2c_msg *msgs;
        int i = 0;
        int num = cmd->number_of_payloads;
index aa243584b2cc2d514e4db8021df0e0fae493a795..df7cc463b94634405574b7e951034238611d2241 100644 (file)
@@ -2002,6 +2002,7 @@ int amdgpu_dm_connector_init(
        struct dc *dc = dm->dc;
        const struct dc_link *link = dc_get_link_at_index(dc, link_index);
        struct amdgpu_i2c_adapter *i2c;
+       ((struct dc_link *)link)->priv = aconnector;
 
        DRM_DEBUG_KMS("%s()\n", __func__);
 
index 9dd8b2ad4c591d35a043a7e5465c9ec68bf58d03..6bb6ad23b31b6c6eeaa9496f824956ae9a8ee6b0 100644 (file)
@@ -592,6 +592,8 @@ struct dc_link {
        struct psr_caps psr_caps;
        bool test_pattern_enabled;
        union compliance_test_state compliance_test_state;
+
+       void *priv;
 };
 
 struct dpcd_caps {