drm/msm/dp: Use drm_dp_read_sink_count() helper
authorStephen Boyd <swboyd@chromium.org>
Tue, 29 Aug 2023 18:47:27 +0000 (11:47 -0700)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 9 Oct 2023 09:17:46 +0000 (12:17 +0300)
Use the common function drm_dp_read_sink_count() instead of open-coding
it. This shrinks the kernel text a tiny bit.

Cc: Vinod Polimera <quic_vpolimer@quicinc.com>
Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/554983/
Link: https://lore.kernel.org/r/20230829184735.2841739-3-swboyd@chromium.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/dp/dp_panel.c

index 09d4f6c38ef8d3c6c19ac46e92baba5598bcd3fa..a0523b18b9e95d5a4b8cfc740ad2a756fc2fe4b7 100644 (file)
@@ -147,8 +147,8 @@ static int dp_panel_update_modes(struct drm_connector *connector,
 int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
        struct drm_connector *connector)
 {
-       int rc = 0, bw_code;
-       int rlen, count;
+       int rc, bw_code;
+       int count;
        struct dp_panel_private *panel;
 
        if (!dp_panel || !connector) {
@@ -174,16 +174,11 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
        }
 
        if (dp_panel->dfp_present) {
-               rlen = drm_dp_dpcd_read(panel->aux, DP_SINK_COUNT,
-                               &count, 1);
-               if (rlen == 1) {
-                       count = DP_GET_SINK_COUNT(count);
-                       if (!count) {
-                               DRM_ERROR("no downstream ports connected\n");
-                               panel->link->sink_count = 0;
-                               rc = -ENOTCONN;
-                               goto end;
-                       }
+               count = drm_dp_read_sink_count(panel->aux);
+               if (!count) {
+                       DRM_ERROR("no downstream ports connected\n");
+                       panel->link->sink_count = 0;
+                       return -ENOTCONN;
                }
        }