[PATCH v3] drm/msm/dp: add logs across DP driver for ease of debugging

Stephen Boyd swboyd at chromium.org
Wed Jul 21 05:31:15 UTC 2021


Quoting maitreye (2021-07-20 15:39:30)
> diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
> index be986da..316e8e6 100644
> --- a/drivers/gpu/drm/msm/dp/dp_link.c
> +++ b/drivers/gpu/drm/msm/dp/dp_link.c
> @@ -1036,43 +1036,46 @@ int dp_link_process_request(struct dp_link *dp_link)
>
>         if (link->request.test_requested == DP_TEST_LINK_EDID_READ) {
>                 dp_link->sink_request |= DP_TEST_LINK_EDID_READ;
> -               return ret;
> +               goto out;
>         }
>
>         ret = dp_link_process_ds_port_status_change(link);
>         if (!ret) {
>                 dp_link->sink_request |= DS_PORT_STATUS_CHANGED;
> -               return ret;
> +               goto out;
>         }
>
>         ret = dp_link_process_link_training_request(link);
>         if (!ret) {
>                 dp_link->sink_request |= DP_TEST_LINK_TRAINING;
> -               return ret;
> +               goto out;
>         }
>
>         ret = dp_link_process_phy_test_pattern_request(link);
>         if (!ret) {
>                 dp_link->sink_request |= DP_TEST_LINK_PHY_TEST_PATTERN;
> -               return ret;
> +               goto out;
>         }
>
>         ret = dp_link_process_link_status_update(link);

if ret == 0 we go into the if below and goto out.

>         if (!ret) {
>                 dp_link->sink_request |= DP_LINK_STATUS_UPDATED;
> -               return ret;
> +               goto out;
>         }

At this point ret != 0 due to the goto above.

>
>         if (dp_link_is_video_pattern_requested(link)) {
> -               ret = 0;

And now we've removed the ret = 0 assignment from here.

>                 dp_link->sink_request |= DP_TEST_LINK_VIDEO_PATTERN;
> +               goto out;

And then we goto out. Isn't this a behavior change? Still feels like we
should be using if/else-if logic here instead of this goto maze.

>         }
>
>         if (dp_link_is_audio_pattern_requested(link)) {
>                 dp_link->sink_request |= DP_TEST_LINK_AUDIO_PATTERN;
> -               return -EINVAL;
> +               ret = -EINVAL;
> +               goto out;
>         }
>
> +out:
> +       DRM_DEBUG_DP("sink request=%#x", dp_link->sink_request);
>         return ret;
>  }
>


More information about the dri-devel mailing list