Skip to content

Commit 79cb1fa

Browse files
committed
drm/mst: remove mgr parameter and debug logging from drm_dp_get_vc_payload_bw()
The struct drm_dp_mst_topology_mgr *mgr parameter is only used for debug logging in case the passed in link rate or lane count are zero. There's no further error checking as such, and the function returns 0. There should be no case where the parameters are zero. The returned value is generally used as a divisor, and if we were hitting this, we'd be seeing division by zero. Just remove the debug logging altogether, along with the mgr parameter, so that the function can be used in non-MST contexts without the topology manager. v2: Also remove drm_dp_mst_helper_tests_init as unnecessary (Imre) Cc: Imre Deak <[email protected]> Cc: Lyude Paul <[email protected]> Reviewed-by: Imre Deak <[email protected]> Acked-by: Maxime Ripard <[email protected]> Acked-by: Thomas Zimmermann <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/72d77e7a7fe69c784e9df048b7e6f250fd7599e4.1735912293.git.jani.nikula@intel.com
1 parent 6f0f335 commit 79cb1fa

File tree

5 files changed

+6
-30
lines changed

5 files changed

+6
-30
lines changed

drivers/gpu/drm/display/drm_dp_mst_topology.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3572,8 +3572,7 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr,
35723572
}
35733573

35743574
/**
3575-
* drm_dp_get_vc_payload_bw - get the VC payload BW for an MST link
3576-
* @mgr: The &drm_dp_mst_topology_mgr to use
3575+
* drm_dp_get_vc_payload_bw - get the VC payload BW for an MTP link
35773576
* @link_rate: link rate in 10kbits/s units
35783577
* @link_lane_count: lane count
35793578
*
@@ -3584,17 +3583,12 @@ static int drm_dp_send_up_ack_reply(struct drm_dp_mst_topology_mgr *mgr,
35843583
*
35853584
* Returns the BW / timeslot value in 20.12 fixed point format.
35863585
*/
3587-
fixed20_12 drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr,
3588-
int link_rate, int link_lane_count)
3586+
fixed20_12 drm_dp_get_vc_payload_bw(int link_rate, int link_lane_count)
35893587
{
35903588
int ch_coding_efficiency =
35913589
drm_dp_bw_channel_coding_efficiency(drm_dp_is_uhbr_rate(link_rate));
35923590
fixed20_12 ret;
35933591

3594-
if (link_rate == 0 || link_lane_count == 0)
3595-
drm_dbg_kms(mgr->dev, "invalid link rate/lane count: (%d / %d)\n",
3596-
link_rate, link_lane_count);
3597-
35983592
/* See DP v2.0 2.6.4.2, 2.7.6.3 VCPayload_Bandwidth_for_OneTimeSlotPer_MTP_Allocation */
35993593
ret.full = DIV_ROUND_DOWN_ULL(mul_u32_u32(link_rate * link_lane_count,
36003594
ch_coding_efficiency),

drivers/gpu/drm/i915/display/intel_dp_mst.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
244244
crtc_state->fec_enable = !intel_dp_is_uhbr(crtc_state);
245245
}
246246

247-
mst_state->pbn_div = drm_dp_get_vc_payload_bw(&intel_dp->mst_mgr,
248-
crtc_state->port_clock,
247+
mst_state->pbn_div = drm_dp_get_vc_payload_bw(crtc_state->port_clock,
249248
crtc_state->lane_count);
250249

251250
max_dpt_bpp = intel_dp_mst_max_dpt_bpp(crtc_state, dsc);

drivers/gpu/drm/nouveau/dispnv50/disp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,8 +992,7 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
992992
if (!mst_state->pbn_div.full) {
993993
struct nouveau_encoder *outp = mstc->mstm->outp;
994994

995-
mst_state->pbn_div = drm_dp_get_vc_payload_bw(&mstm->mgr,
996-
outp->dp.link_bw, outp->dp.link_nr);
995+
mst_state->pbn_div = drm_dp_get_vc_payload_bw(outp->dp.link_bw, outp->dp.link_nr);
997996
}
998997

999998
slots = drm_dp_atomic_find_time_slots(state, &mstm->mgr, mstc->port, asyh->dp.pbn);

drivers/gpu/drm/tests/drm_dp_mst_helper_test.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,8 @@ static const struct drm_dp_mst_calc_pbn_div_test drm_dp_mst_calc_pbn_div_dp1_4_c
199199
static void drm_test_dp_mst_calc_pbn_div(struct kunit *test)
200200
{
201201
const struct drm_dp_mst_calc_pbn_div_test *params = test->param_value;
202-
/* mgr->dev is only needed by drm_dbg_kms(), but it's not called for the test cases. */
203-
struct drm_dp_mst_topology_mgr *mgr = test->priv;
204202

205-
KUNIT_EXPECT_EQ(test, drm_dp_get_vc_payload_bw(mgr, params->link_rate, params->lane_count).full,
203+
KUNIT_EXPECT_EQ(test, drm_dp_get_vc_payload_bw(params->link_rate, params->lane_count).full,
206204
params->expected.full);
207205
}
208206

@@ -568,21 +566,8 @@ static struct kunit_case drm_dp_mst_helper_tests[] = {
568566
{ }
569567
};
570568

571-
static int drm_dp_mst_helper_tests_init(struct kunit *test)
572-
{
573-
struct drm_dp_mst_topology_mgr *mgr;
574-
575-
mgr = kunit_kzalloc(test, sizeof(*mgr), GFP_KERNEL);
576-
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, mgr);
577-
578-
test->priv = mgr;
579-
580-
return 0;
581-
}
582-
583569
static struct kunit_suite drm_dp_mst_helper_test_suite = {
584570
.name = "drm_dp_mst_helper",
585-
.init = drm_dp_mst_helper_tests_init,
586571
.test_cases = drm_dp_mst_helper_tests,
587572
};
588573

include/drm/display/drm_dp_mst_helper.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector,
867867
struct drm_dp_mst_topology_mgr *mgr,
868868
struct drm_dp_mst_port *port);
869869

870-
fixed20_12 drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr,
871-
int link_rate, int link_lane_count);
870+
fixed20_12 drm_dp_get_vc_payload_bw(int link_rate, int link_lane_count);
872871

873872
int drm_dp_calc_pbn_mode(int clock, int bpp);
874873

0 commit comments

Comments
 (0)