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

Stephen Boyd swboyd at chromium.org
Thu Jul 22 20:31:29 UTC 2021


Quoting maitreye (2021-07-21 16:19:40)
> From: Maitreyee Rao <maitreye at codeaurora.org>
>
> Add trace points across the MSM DP driver to help debug
> interop issues.
>
> Changes in v4:
>  - Changed goto statement and used if else-if

I think drm likes to see all the changelog here to see patch evolution.

>
> Signed-off-by: Maitreyee Rao <maitreye at codeaurora.org>
> ---
> diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
> index be986da..8c98ab7 100644
> --- a/drivers/gpu/drm/msm/dp/dp_link.c
> +++ b/drivers/gpu/drm/msm/dp/dp_link.c
> @@ -1036,43 +1036,28 @@ 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;
>         }
> -
> -       ret = dp_link_process_ds_port_status_change(link);
> -       if (!ret) {
> +       else if (!(ret = dp_link_process_ds_port_status_change(link))) {
>                 dp_link->sink_request |= DS_PORT_STATUS_CHANGED;
> -               return ret;
>         }
> -
> -       ret = dp_link_process_link_training_request(link);
> -       if (!ret) {
> +       else if (!(ret = dp_link_process_link_training_request(link))) {
>                 dp_link->sink_request |= DP_TEST_LINK_TRAINING;
> -               return ret;
>         }
> -
> -       ret = dp_link_process_phy_test_pattern_request(link);
> -       if (!ret) {
> +       else if (!(ret = dp_link_process_phy_test_pattern_request(link))) {
>                 dp_link->sink_request |= DP_TEST_LINK_PHY_TEST_PATTERN;
> -               return ret;
> -       }
> -
> -       ret = dp_link_process_link_status_update(link);
> -       if (!ret) {
> +       }
> +       else if (!(ret = dp_link_process_link_status_update(link))) {

The kernel coding style is to leave the brackets on the same line

	if (condition) {

	} else if (conditon) {

	}

See Documentation/process/coding-style.rst

Also, the if (!(ret = dp_link_...)) style is really hard to read. Maybe
apply this patch before?

----8<----
diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
index 1195044a7a3b..408cddd90f0f 100644
--- a/drivers/gpu/drm/msm/dp/dp_link.c
+++ b/drivers/gpu/drm/msm/dp/dp_link.c
@@ -1027,41 +1027,22 @@ 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;
-	}
-
-	ret = dp_link_process_ds_port_status_change(link);
-	if (!ret) {
+	} else if (!dp_link_process_ds_port_status_change(link)) {
 		dp_link->sink_request |= DS_PORT_STATUS_CHANGED;
-		return ret;
-	}
-
-	ret = dp_link_process_link_training_request(link);
-	if (!ret) {
+	} else if (!dp_link_process_link_training_request(link)) {
 		dp_link->sink_request |= DP_TEST_LINK_TRAINING;
-		return ret;
-	}
-
-	ret = dp_link_process_phy_test_pattern_request(link);
-	if (!ret) {
+	} else if (!dp_link_process_phy_test_pattern_request(link)) {
 		dp_link->sink_request |= DP_TEST_LINK_PHY_TEST_PATTERN;
-		return ret;
-	}
-
-	ret = dp_link_process_link_status_update(link);
-	if (!ret) {
+	} else if (!dp_link_process_link_status_update(link)) {
 		dp_link->sink_request |= DP_LINK_STATUS_UPDATED;
-		return ret;
-	}
-
-	if (dp_link_is_video_pattern_requested(link)) {
-		ret = 0;
-		dp_link->sink_request |= DP_TEST_LINK_VIDEO_PATTERN;
-	}
+	} else {
+		if (dp_link_is_video_pattern_requested(link))
+			dp_link->sink_request |= DP_TEST_LINK_VIDEO_PATTERN;

-	if (dp_link_is_audio_pattern_requested(link)) {
-		dp_link->sink_request |= DP_TEST_LINK_AUDIO_PATTERN;
-		return -EINVAL;
+		if (dp_link_is_audio_pattern_requested(link)) {
+			dp_link->sink_request |= DP_TEST_LINK_AUDIO_PATTERN;
+			ret = -EINVAL;
+		}
 	}

 	return ret;


More information about the Freedreno mailing list