From a52bfaf614e702a04f4dd4ddf331f8923e29b15f Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Thu, 31 Mar 2022 01:30:06 +0300 Subject: [PATCH] drm/msm/dp: simplify dp_connector_get_modes() Since dp_panel_get_modes() handling for dp_mode was removed, dp_display_get_modes also doesn't change the passed dp_mode, drop the unused dp_mode variable being allocated unused and then freed. Reviewed-by: Kuogee Hsieh Reviewed-by: Stephen Boyd Signed-off-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/480137/ Link: https://lore.kernel.org/r/20220330223008.649274-3-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_display.c | 9 ++------- drivers/gpu/drm/msm/dp/dp_display.h | 3 +-- drivers/gpu/drm/msm/dp/dp_drm.c | 29 +---------------------------- 3 files changed, 4 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index c6d88283..a3ed029 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1030,11 +1030,9 @@ enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge, return MODE_OK; } -int dp_display_get_modes(struct msm_dp *dp, - struct dp_display_mode *dp_mode) +int dp_display_get_modes(struct msm_dp *dp) { struct dp_display_private *dp_display; - int ret = 0; if (!dp) { DRM_ERROR("invalid params\n"); @@ -1043,11 +1041,8 @@ int dp_display_get_modes(struct msm_dp *dp, dp_display = container_of(dp, struct dp_display_private, dp_display); - ret = dp_panel_get_modes(dp_display->panel, + return dp_panel_get_modes(dp_display->panel, dp->connector); - if (dp_mode->drm_mode.clock) - dp->max_pclk_khz = dp_mode->drm_mode.clock; - return ret; } bool dp_display_check_video_test(struct msm_dp *dp) diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 426d4ab..03c8577 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -34,8 +34,7 @@ struct msm_dp { int dp_display_set_plugged_cb(struct msm_dp *dp_display, hdmi_codec_plugged_cb fn, struct device *codec_dev); -int dp_display_get_modes(struct msm_dp *dp_display, - struct dp_display_mode *dp_mode); +int dp_display_get_modes(struct msm_dp *dp_display); int dp_display_request_irq(struct msm_dp *dp_display); bool dp_display_check_video_test(struct msm_dp *dp_display); int dp_display_get_test_bpp(struct msm_dp *dp_display); diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 73d63ab..5f6658e 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -41,49 +41,22 @@ static int dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector * { int rc = 0; struct msm_dp *dp; - struct dp_display_mode *dp_mode = NULL; - struct drm_display_mode *m, drm_mode; if (!connector) return 0; dp = to_dp_bridge(bridge)->dp_display; - dp_mode = kzalloc(sizeof(*dp_mode), GFP_KERNEL); - if (!dp_mode) - return 0; - /* pluggable case assumes EDID is read when HPD */ if (dp->is_connected) { - /* - *The get_modes() function might return one mode that is stored - * in dp_mode when compliance test is in progress. If not, the - * return value is equal to the total number of modes supported - * by the sink - */ - rc = dp_display_get_modes(dp, dp_mode); + rc = dp_display_get_modes(dp); if (rc <= 0) { DRM_ERROR("failed to get DP sink modes, rc=%d\n", rc); - kfree(dp_mode); return rc; } - if (dp_mode->drm_mode.clock) { /* valid DP mode */ - memset(&drm_mode, 0x0, sizeof(drm_mode)); - drm_mode_copy(&drm_mode, &dp_mode->drm_mode); - m = drm_mode_duplicate(connector->dev, &drm_mode); - if (!m) { - DRM_ERROR("failed to add mode %ux%u\n", - drm_mode.hdisplay, - drm_mode.vdisplay); - kfree(dp_mode); - return 0; - } - drm_mode_probed_add(connector, m); - } } else { drm_dbg_dp(connector->dev, "No sink connected\n"); } - kfree(dp_mode); return rc; } -- 2.7.4