From: Andrey Grodzovsky Date: Tue, 14 Feb 2017 18:50:17 +0000 (-0500) Subject: drm/amd/display: Remove get_connector_for_link. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9fb8de78ed01453ccc696a9f18cbfe41c60fd433;p=openwrt%2Fstaging%2Fblogic.git drm/amd/display: Remove get_connector_for_link. 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 Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index d4e01b51f949..bdf7c6075414 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -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; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c index aa243584b2cc..df7cc463b946 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c @@ -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__); diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 9dd8b2ad4c59..6bb6ad23b31b 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -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 {