All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <swboyd@chromium.org>
To: Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Vinod Polimera <quic_vpolimer@quicinc.com>,
	patches@lists.linux.dev, Kuogee Hsieh <quic_khsieh@quicinc.com>,
	freedreno@lists.freedesktop.org
Subject: [PATCH 6/7] drm/msm/dp: Inline dp_link_parse_sink_count()
Date: Tue, 29 Aug 2023 11:47:31 -0700	[thread overview]
Message-ID: <20230829184735.2841739-7-swboyd@chromium.org> (raw)
In-Reply-To: <20230829184735.2841739-1-swboyd@chromium.org>

The function dp_link_parse_sink_count() is really just
drm_dp_read_sink_count(). It debug prints out the bit for content
protection (DP_SINK_CP_READY), but that is not useful beyond debug
because 'link->dp_link.sink_count' is overwritten to only contain the
sink_count in this same function. Just use drm_dp_read_sink_count() in
the one place this function is called to simplify.

Cc: Vinod Polimera <quic_vpolimer@quicinc.com>
Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/gpu/drm/msm/dp/dp_link.c | 38 +++-----------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
index 42427129acea..94a37914a47f 100644
--- a/drivers/gpu/drm/msm/dp/dp_link.c
+++ b/drivers/gpu/drm/msm/dp/dp_link.c
@@ -712,49 +712,17 @@ static int dp_link_parse_request(struct dp_link_private *link)
 	return ret;
 }
 
-/**
- * dp_link_parse_sink_count() - parses the sink count
- * @dp_link: pointer to link module data
- *
- * Parses the DPCD to check if there is an update to the sink count
- * (Byte 0x200), and whether all the sink devices connected have Content
- * Protection enabled.
- */
-static int dp_link_parse_sink_count(struct dp_link *dp_link)
-{
-	ssize_t rlen;
-	bool cp_ready;
-
-	struct dp_link_private *link = container_of(dp_link,
-			struct dp_link_private, dp_link);
-
-	rlen = drm_dp_dpcd_readb(link->aux, DP_SINK_COUNT,
-				 &link->dp_link.sink_count);
-	if (rlen < 0) {
-		DRM_ERROR("sink count read failed. rlen=%zd\n", rlen);
-		return rlen;
-	}
-
-	cp_ready = link->dp_link.sink_count & DP_SINK_CP_READY;
-
-	link->dp_link.sink_count =
-		DP_GET_SINK_COUNT(link->dp_link.sink_count);
-
-	drm_dbg_dp(link->drm_dev, "sink_count = 0x%x, cp_ready = 0x%x\n",
-				link->dp_link.sink_count, cp_ready);
-	return 0;
-}
-
 static int dp_link_parse_sink_status_field(struct dp_link_private *link)
 {
-	int len = 0;
+	int len;
 
 	link->prev_sink_count = link->dp_link.sink_count;
-	len = dp_link_parse_sink_count(&link->dp_link);
+	len = drm_dp_read_sink_count(link->aux);
 	if (len < 0) {
 		DRM_ERROR("DP parse sink count failed\n");
 		return len;
 	}
+	link->dp_link.sink_count = len;
 
 	len = drm_dp_dpcd_read_link_status(link->aux,
 		link->link_status);
-- 
https://chromeos.dev


WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <swboyd@chromium.org>
To: Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	Sean Paul <sean@poorly.run>,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	Vinod Polimera <quic_vpolimer@quicinc.com>,
	Kuogee Hsieh <quic_khsieh@quicinc.com>
Subject: [PATCH 6/7] drm/msm/dp: Inline dp_link_parse_sink_count()
Date: Tue, 29 Aug 2023 11:47:31 -0700	[thread overview]
Message-ID: <20230829184735.2841739-7-swboyd@chromium.org> (raw)
In-Reply-To: <20230829184735.2841739-1-swboyd@chromium.org>

The function dp_link_parse_sink_count() is really just
drm_dp_read_sink_count(). It debug prints out the bit for content
protection (DP_SINK_CP_READY), but that is not useful beyond debug
because 'link->dp_link.sink_count' is overwritten to only contain the
sink_count in this same function. Just use drm_dp_read_sink_count() in
the one place this function is called to simplify.

Cc: Vinod Polimera <quic_vpolimer@quicinc.com>
Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/gpu/drm/msm/dp/dp_link.c | 38 +++-----------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_link.c b/drivers/gpu/drm/msm/dp/dp_link.c
index 42427129acea..94a37914a47f 100644
--- a/drivers/gpu/drm/msm/dp/dp_link.c
+++ b/drivers/gpu/drm/msm/dp/dp_link.c
@@ -712,49 +712,17 @@ static int dp_link_parse_request(struct dp_link_private *link)
 	return ret;
 }
 
-/**
- * dp_link_parse_sink_count() - parses the sink count
- * @dp_link: pointer to link module data
- *
- * Parses the DPCD to check if there is an update to the sink count
- * (Byte 0x200), and whether all the sink devices connected have Content
- * Protection enabled.
- */
-static int dp_link_parse_sink_count(struct dp_link *dp_link)
-{
-	ssize_t rlen;
-	bool cp_ready;
-
-	struct dp_link_private *link = container_of(dp_link,
-			struct dp_link_private, dp_link);
-
-	rlen = drm_dp_dpcd_readb(link->aux, DP_SINK_COUNT,
-				 &link->dp_link.sink_count);
-	if (rlen < 0) {
-		DRM_ERROR("sink count read failed. rlen=%zd\n", rlen);
-		return rlen;
-	}
-
-	cp_ready = link->dp_link.sink_count & DP_SINK_CP_READY;
-
-	link->dp_link.sink_count =
-		DP_GET_SINK_COUNT(link->dp_link.sink_count);
-
-	drm_dbg_dp(link->drm_dev, "sink_count = 0x%x, cp_ready = 0x%x\n",
-				link->dp_link.sink_count, cp_ready);
-	return 0;
-}
-
 static int dp_link_parse_sink_status_field(struct dp_link_private *link)
 {
-	int len = 0;
+	int len;
 
 	link->prev_sink_count = link->dp_link.sink_count;
-	len = dp_link_parse_sink_count(&link->dp_link);
+	len = drm_dp_read_sink_count(link->aux);
 	if (len < 0) {
 		DRM_ERROR("DP parse sink count failed\n");
 		return len;
 	}
+	link->dp_link.sink_count = len;
 
 	len = drm_dp_dpcd_read_link_status(link->aux,
 		link->link_status);
-- 
https://chromeos.dev


  parent reply	other threads:[~2023-08-29 18:48 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 18:47 [PATCH 0/7] drm/msm/dp: Simplify DPCD related code with helpers Stephen Boyd
2023-08-29 18:47 ` Stephen Boyd
2023-08-29 18:47 ` [PATCH 1/7] drm/msm/dp: Replace open-coded drm_dp_read_dpcd_caps() Stephen Boyd
2023-08-29 18:47   ` Stephen Boyd
2023-08-31 20:27   ` Kuogee Hsieh
2023-08-31 20:27     ` Kuogee Hsieh
2023-09-03 22:37   ` Dmitry Baryshkov
2023-09-03 22:37     ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 2/7] drm/msm/dp: Use drm_dp_read_sink_count() helper Stephen Boyd
2023-08-29 18:47   ` Stephen Boyd
2023-08-31 20:27   ` Kuogee Hsieh
2023-08-31 20:27     ` Kuogee Hsieh
2023-09-03 22:37   ` Dmitry Baryshkov
2023-09-03 22:37     ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 3/7] drm/msm/dp: Remove dead code related to downstream cap info Stephen Boyd
2023-08-29 18:47   ` Stephen Boyd
2023-08-31 20:28   ` Kuogee Hsieh
2023-08-31 20:28     ` Kuogee Hsieh
2023-08-31 20:28   ` Kuogee Hsieh
2023-08-31 20:28     ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-09-03 22:39     ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 4/7] drm/msm/dp: Remove aux_cfg_update_done and related code Stephen Boyd
2023-08-29 18:47   ` Stephen Boyd
2023-08-31 20:28   ` Kuogee Hsieh
2023-08-31 20:28     ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-09-03 22:39     ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 5/7] drm/msm/dp: Simplify with drm_dp_{max_link_rate, max_lane_count}() Stephen Boyd
2023-08-29 18:47   ` [PATCH 5/7] drm/msm/dp: Simplify with drm_dp_{max_link_rate,max_lane_count}() Stephen Boyd
2023-08-31 20:29   ` Kuogee Hsieh
2023-08-31 20:29     ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-09-03 22:39     ` Dmitry Baryshkov
2023-08-29 18:47 ` Stephen Boyd [this message]
2023-08-29 18:47   ` [PATCH 6/7] drm/msm/dp: Inline dp_link_parse_sink_count() Stephen Boyd
2023-08-31 20:29   ` Kuogee Hsieh
2023-08-31 20:29     ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-09-03 22:39     ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 7/7] drm/msm/dp: Remove dp_display_is_ds_bridge() Stephen Boyd
2023-08-29 18:47   ` Stephen Boyd
2023-08-31 20:29   ` Kuogee Hsieh
2023-08-31 20:29     ` Kuogee Hsieh
2023-09-03 22:40   ` Dmitry Baryshkov
2023-09-03 22:40     ` Dmitry Baryshkov
2023-09-05 21:52     ` Stephen Boyd
2023-09-05 21:52       ` Stephen Boyd
2023-09-03 22:45 ` [PATCH 0/7] drm/msm/dp: Simplify DPCD related code with helpers Dmitry Baryshkov
2023-09-03 22:45   ` Dmitry Baryshkov
2023-10-08 14:01 ` Dmitry Baryshkov
2023-10-08 14:01   ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230829184735.2841739-7-swboyd@chromium.org \
    --to=swboyd@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=quic_vpolimer@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.