@@ -89,7 +89,7 @@ static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
8989 struct drm_dp_mst_branch * mstb ,
9090 struct drm_dp_mst_port * port );
9191static bool drm_dp_validate_guid (struct drm_dp_mst_topology_mgr * mgr ,
92- u8 * guid );
92+ guid_t * guid );
9393
9494static int drm_dp_mst_register_i2c_bus (struct drm_dp_mst_port * port );
9595static void drm_dp_mst_unregister_i2c_bus (struct drm_dp_mst_port * port );
@@ -801,7 +801,7 @@ static bool drm_dp_sideband_parse_link_address(const struct drm_dp_mst_topology_
801801 int idx = 1 ;
802802 int i ;
803803
804- memcpy ( repmsg -> u .link_addr .guid , & raw -> msg [idx ], 16 );
804+ import_guid ( & repmsg -> u .link_addr .guid , & raw -> msg [idx ]);
805805 idx += 16 ;
806806 repmsg -> u .link_addr .nports = raw -> msg [idx ] & 0xf ;
807807 idx ++ ;
@@ -829,7 +829,7 @@ static bool drm_dp_sideband_parse_link_address(const struct drm_dp_mst_topology_
829829 idx ++ ;
830830 if (idx > raw -> curlen )
831831 goto fail_len ;
832- memcpy ( repmsg -> u .link_addr .ports [i ].peer_guid , & raw -> msg [idx ], 16 );
832+ import_guid ( & repmsg -> u .link_addr .ports [i ].peer_guid , & raw -> msg [idx ]);
833833 idx += 16 ;
834834 if (idx > raw -> curlen )
835835 goto fail_len ;
@@ -1029,7 +1029,7 @@ static bool drm_dp_sideband_parse_reply(const struct drm_dp_mst_topology_mgr *mg
10291029 msg -> req_type = (raw -> msg [0 ] & 0x7f );
10301030
10311031 if (msg -> reply_type == DP_SIDEBAND_REPLY_NAK ) {
1032- memcpy ( msg -> u .nak .guid , & raw -> msg [1 ], 16 );
1032+ import_guid ( & msg -> u .nak .guid , & raw -> msg [1 ]);
10331033 msg -> u .nak .reason = raw -> msg [17 ];
10341034 msg -> u .nak .nak_data = raw -> msg [18 ];
10351035 return false;
@@ -1078,7 +1078,7 @@ drm_dp_sideband_parse_connection_status_notify(const struct drm_dp_mst_topology_
10781078 if (idx > raw -> curlen )
10791079 goto fail_len ;
10801080
1081- memcpy ( msg -> u .conn_stat .guid , & raw -> msg [idx ], 16 );
1081+ import_guid ( & msg -> u .conn_stat .guid , & raw -> msg [idx ]);
10821082 idx += 16 ;
10831083 if (idx > raw -> curlen )
10841084 goto fail_len ;
@@ -1107,7 +1107,7 @@ static bool drm_dp_sideband_parse_resource_status_notify(const struct drm_dp_mst
11071107 if (idx > raw -> curlen )
11081108 goto fail_len ;
11091109
1110- memcpy ( msg -> u .resource_stat .guid , & raw -> msg [idx ], 16 );
1110+ import_guid ( & msg -> u .resource_stat .guid , & raw -> msg [idx ]);
11111111 idx += 16 ;
11121112 if (idx > raw -> curlen )
11131113 goto fail_len ;
@@ -2174,20 +2174,24 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
21742174 offset , size , buffer );
21752175}
21762176
2177- static int drm_dp_check_mstb_guid (struct drm_dp_mst_branch * mstb , u8 * guid )
2177+ static int drm_dp_check_mstb_guid (struct drm_dp_mst_branch * mstb , guid_t * guid )
21782178{
21792179 int ret = 0 ;
21802180
2181- memcpy (mstb -> guid , guid , 16 );
2181+ guid_copy (& mstb -> guid , guid );
2182+
2183+ if (!drm_dp_validate_guid (mstb -> mgr , & mstb -> guid )) {
2184+ u8 buf [UUID_SIZE ];
2185+
2186+ export_guid (buf , & mstb -> guid );
21822187
2183- if (!drm_dp_validate_guid (mstb -> mgr , mstb -> guid )) {
21842188 if (mstb -> port_parent ) {
21852189 ret = drm_dp_send_dpcd_write (mstb -> mgr ,
21862190 mstb -> port_parent ,
2187- DP_GUID , 16 , mstb -> guid );
2191+ DP_GUID , sizeof ( buf ), buf );
21882192 } else {
21892193 ret = drm_dp_dpcd_write (mstb -> mgr -> aux ,
2190- DP_GUID , mstb -> guid , 16 );
2194+ DP_GUID , buf , sizeof ( buf ) );
21912195 }
21922196 }
21932197
@@ -2570,20 +2574,19 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
25702574 return mstb ;
25712575}
25722576
2573- static struct drm_dp_mst_branch * get_mst_branch_device_by_guid_helper (
2574- struct drm_dp_mst_branch * mstb ,
2575- const uint8_t * guid )
2577+ static struct drm_dp_mst_branch *
2578+ get_mst_branch_device_by_guid_helper ( struct drm_dp_mst_branch * mstb ,
2579+ const guid_t * guid )
25762580{
25772581 struct drm_dp_mst_branch * found_mstb ;
25782582 struct drm_dp_mst_port * port ;
25792583
25802584 if (!mstb )
25812585 return NULL ;
25822586
2583- if (memcmp ( mstb -> guid , guid , 16 ) == 0 )
2587+ if (guid_equal ( & mstb -> guid , guid ) )
25842588 return mstb ;
25852589
2586-
25872590 list_for_each_entry (port , & mstb -> ports , next ) {
25882591 found_mstb = get_mst_branch_device_by_guid_helper (port -> mstb , guid );
25892592
@@ -2596,7 +2599,7 @@ static struct drm_dp_mst_branch *get_mst_branch_device_by_guid_helper(
25962599
25972600static struct drm_dp_mst_branch *
25982601drm_dp_get_mst_branch_device_by_guid (struct drm_dp_mst_topology_mgr * mgr ,
2599- const uint8_t * guid )
2602+ const guid_t * guid )
26002603{
26012604 struct drm_dp_mst_branch * mstb ;
26022605 int ret ;
@@ -2693,17 +2696,20 @@ static void drm_dp_mst_link_probe_work(struct work_struct *work)
26932696}
26942697
26952698static bool drm_dp_validate_guid (struct drm_dp_mst_topology_mgr * mgr ,
2696- u8 * guid )
2699+ guid_t * guid )
26972700{
26982701 u64 salt ;
2702+ u8 buf [UUID_SIZE ];
26992703
2700- if (memchr_inv (guid , 0 , 16 ))
2704+ if (! guid_is_null (guid ))
27012705 return true;
27022706
27032707 salt = get_jiffies_64 ();
27042708
2705- memcpy (& guid [0 ], & salt , sizeof (u64 ));
2706- memcpy (& guid [8 ], & salt , sizeof (u64 ));
2709+ memcpy (& buf [0 ], & salt , sizeof (u64 ));
2710+ memcpy (& buf [8 ], & salt , sizeof (u64 ));
2711+
2712+ import_guid (guid , buf );
27072713
27082714 return false;
27092715}
@@ -2943,7 +2949,7 @@ static int drm_dp_send_link_address(struct drm_dp_mst_topology_mgr *mgr,
29432949 drm_dbg_kms (mgr -> dev , "link address reply: %d\n" , reply -> nports );
29442950 drm_dp_dump_link_address (mgr , reply );
29452951
2946- ret = drm_dp_check_mstb_guid (mstb , reply -> guid );
2952+ ret = drm_dp_check_mstb_guid (mstb , & reply -> guid );
29472953 if (ret ) {
29482954 char buf [64 ];
29492955
@@ -3770,8 +3776,9 @@ EXPORT_SYMBOL(drm_dp_mst_topology_mgr_suspend);
37703776int drm_dp_mst_topology_mgr_resume (struct drm_dp_mst_topology_mgr * mgr ,
37713777 bool sync )
37723778{
3779+ u8 buf [UUID_SIZE ];
3780+ guid_t guid ;
37733781 int ret ;
3774- u8 guid [16 ];
37753782
37763783 mutex_lock (& mgr -> lock );
37773784 if (!mgr -> mst_primary )
@@ -3792,13 +3799,15 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr,
37923799 }
37933800
37943801 /* Some hubs forget their guids after they resume */
3795- ret = drm_dp_dpcd_read (mgr -> aux , DP_GUID , guid , 16 );
3796- if (ret != 16 ) {
3802+ ret = drm_dp_dpcd_read (mgr -> aux , DP_GUID , buf , sizeof ( buf ) );
3803+ if (ret != sizeof ( buf ) ) {
37973804 drm_dbg_kms (mgr -> dev , "dpcd read failed - undocked during suspend?\n" );
37983805 goto out_fail ;
37993806 }
38003807
3801- ret = drm_dp_check_mstb_guid (mgr -> mst_primary , guid );
3808+ import_guid (& guid , buf );
3809+
3810+ ret = drm_dp_check_mstb_guid (mgr -> mst_primary , & guid );
38023811 if (ret ) {
38033812 drm_dbg_kms (mgr -> dev , "check mstb failed - undocked during suspend?\n" );
38043813 goto out_fail ;
@@ -3976,12 +3985,12 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr,
39763985 bool hotplug = false, dowork = false;
39773986
39783987 if (hdr -> broadcast ) {
3979- const u8 * guid = NULL ;
3988+ const guid_t * guid = NULL ;
39803989
39813990 if (msg -> req_type == DP_CONNECTION_STATUS_NOTIFY )
3982- guid = msg -> u .conn_stat .guid ;
3991+ guid = & msg -> u .conn_stat .guid ;
39833992 else if (msg -> req_type == DP_RESOURCE_STATUS_NOTIFY )
3984- guid = msg -> u .resource_stat .guid ;
3993+ guid = & msg -> u .resource_stat .guid ;
39853994
39863995 if (guid )
39873996 mstb = drm_dp_get_mst_branch_device_by_guid (mgr , guid );
0 commit comments