Skip to content

Commit b71ccff

Browse files
committed
drm/amd/display: switch to guid_gen() to generate valid GUIDs
Instead of just smashing jiffies into a GUID, use guid_gen() to generate RFC 4122 compliant GUIDs. Reviewed-by: Daniel Vetter <[email protected]> Acked-by: Harry Wentland <[email protected]> Acked-by: Alex Deucher <[email protected]> Acked-by: Hamza Mahfooz <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Jani Nikula <[email protected]>
1 parent 4548f10 commit b71ccff

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,9 +2568,9 @@ static int dm_late_init(void *handle)
25682568

25692569
static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr)
25702570
{
2571+
u8 buf[UUID_SIZE];
2572+
guid_t guid;
25712573
int ret;
2572-
u8 guid[16];
2573-
u64 tmp64;
25742574

25752575
mutex_lock(&mgr->lock);
25762576
if (!mgr->mst_primary)
@@ -2591,26 +2591,27 @@ static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr)
25912591
}
25922592

25932593
/* Some hubs forget their guids after they resume */
2594-
ret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
2595-
if (ret != 16) {
2594+
ret = drm_dp_dpcd_read(mgr->aux, DP_GUID, buf, sizeof(buf));
2595+
if (ret != sizeof(buf)) {
25962596
drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n");
25972597
goto out_fail;
25982598
}
25992599

2600-
if (memchr_inv(guid, 0, 16) == NULL) {
2601-
tmp64 = get_jiffies_64();
2602-
memcpy(&guid[0], &tmp64, sizeof(u64));
2603-
memcpy(&guid[8], &tmp64, sizeof(u64));
2600+
import_guid(&guid, buf);
26042601

2605-
ret = drm_dp_dpcd_write(mgr->aux, DP_GUID, guid, 16);
2602+
if (guid_is_null(&guid)) {
2603+
guid_gen(&guid);
2604+
export_guid(buf, &guid);
26062605

2607-
if (ret != 16) {
2606+
ret = drm_dp_dpcd_write(mgr->aux, DP_GUID, buf, sizeof(buf));
2607+
2608+
if (ret != sizeof(buf)) {
26082609
drm_dbg_kms(mgr->dev, "check mstb guid failed - undocked during suspend?\n");
26092610
goto out_fail;
26102611
}
26112612
}
26122613

2613-
import_guid(&mgr->mst_primary->guid, guid);
2614+
guid_copy(&mgr->mst_primary->guid, &guid);
26142615

26152616
out_fail:
26162617
mutex_unlock(&mgr->lock);

0 commit comments

Comments
 (0)