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 <quic_khsieh@quicinc.com> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> 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 <dmitry.baryshkov@linaro.org>
This commit is contained in:
parent
ac31f3387c
commit
a52bfaf614
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user