summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/thunderbolt/switch.c8
-rw-r--r--drivers/thunderbolt/tb.h4
-rw-r--r--drivers/thunderbolt/tb_msgs.h12
-rw-r--r--include/linux/uuid.h14
-rw-r--r--lib/test_uuid.c2
5 files changed, 13 insertions, 27 deletions
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 40219a706309..e9391bbd4036 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -30,7 +30,7 @@ static DEFINE_IDA(nvm_ida);
30 30
31struct nvm_auth_status { 31struct nvm_auth_status {
32 struct list_head list; 32 struct list_head list;
33 uuid_be uuid; 33 uuid_t uuid;
34 u32 status; 34 u32 status;
35}; 35};
36 36
@@ -47,7 +47,7 @@ static struct nvm_auth_status *__nvm_get_auth_status(const struct tb_switch *sw)
47 struct nvm_auth_status *st; 47 struct nvm_auth_status *st;
48 48
49 list_for_each_entry(st, &nvm_auth_status_cache, list) { 49 list_for_each_entry(st, &nvm_auth_status_cache, list) {
50 if (!uuid_be_cmp(st->uuid, *sw->uuid)) 50 if (uuid_equal(&st->uuid, sw->uuid))
51 return st; 51 return st;
52 } 52 }
53 53
@@ -1461,7 +1461,7 @@ struct tb_sw_lookup {
1461 struct tb *tb; 1461 struct tb *tb;
1462 u8 link; 1462 u8 link;
1463 u8 depth; 1463 u8 depth;
1464 const uuid_be *uuid; 1464 const uuid_t *uuid;
1465}; 1465};
1466 1466
1467static int tb_switch_match(struct device *dev, void *data) 1467static int tb_switch_match(struct device *dev, void *data)
@@ -1518,7 +1518,7 @@ struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link, u8 depth)
1518 * Returned switch has reference count increased so the caller needs to 1518 * Returned switch has reference count increased so the caller needs to
1519 * call tb_switch_put() when done with the switch. 1519 * call tb_switch_put() when done with the switch.
1520 */ 1520 */
1521struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_be *uuid) 1521struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_t *uuid)
1522{ 1522{
1523 struct tb_sw_lookup lookup; 1523 struct tb_sw_lookup lookup;
1524 struct device *dev; 1524 struct device *dev;
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 3d9f64676e58..e0deee4f1eb0 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -101,7 +101,7 @@ struct tb_switch {
101 struct tb_dma_port *dma_port; 101 struct tb_dma_port *dma_port;
102 struct tb *tb; 102 struct tb *tb;
103 u64 uid; 103 u64 uid;
104 uuid_be *uuid; 104 uuid_t *uuid;
105 u16 vendor; 105 u16 vendor;
106 u16 device; 106 u16 device;
107 const char *vendor_name; 107 const char *vendor_name;
@@ -407,7 +407,7 @@ void tb_sw_set_unplugged(struct tb_switch *sw);
407struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route); 407struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route);
408struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link, 408struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link,
409 u8 depth); 409 u8 depth);
410struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_be *uuid); 410struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_t *uuid);
411 411
412static inline unsigned int tb_switch_phy_port_from_link(unsigned int link) 412static inline unsigned int tb_switch_phy_port_from_link(unsigned int link)
413{ 413{
diff --git a/drivers/thunderbolt/tb_msgs.h b/drivers/thunderbolt/tb_msgs.h
index 85b6d33c0919..de6441e4a060 100644
--- a/drivers/thunderbolt/tb_msgs.h
+++ b/drivers/thunderbolt/tb_msgs.h
@@ -179,7 +179,7 @@ struct icm_fr_pkg_get_topology_response {
179 179
180struct icm_fr_event_device_connected { 180struct icm_fr_event_device_connected {
181 struct icm_pkg_header hdr; 181 struct icm_pkg_header hdr;
182 uuid_be ep_uuid; 182 uuid_t ep_uuid;
183 u8 connection_key; 183 u8 connection_key;
184 u8 connection_id; 184 u8 connection_id;
185 u16 link_info; 185 u16 link_info;
@@ -193,7 +193,7 @@ struct icm_fr_event_device_connected {
193 193
194struct icm_fr_pkg_approve_device { 194struct icm_fr_pkg_approve_device {
195 struct icm_pkg_header hdr; 195 struct icm_pkg_header hdr;
196 uuid_be ep_uuid; 196 uuid_t ep_uuid;
197 u8 connection_key; 197 u8 connection_key;
198 u8 connection_id; 198 u8 connection_id;
199 u16 reserved; 199 u16 reserved;
@@ -207,7 +207,7 @@ struct icm_fr_event_device_disconnected {
207 207
208struct icm_fr_pkg_add_device_key { 208struct icm_fr_pkg_add_device_key {
209 struct icm_pkg_header hdr; 209 struct icm_pkg_header hdr;
210 uuid_be ep_uuid; 210 uuid_t ep_uuid;
211 u8 connection_key; 211 u8 connection_key;
212 u8 connection_id; 212 u8 connection_id;
213 u16 reserved; 213 u16 reserved;
@@ -216,7 +216,7 @@ struct icm_fr_pkg_add_device_key {
216 216
217struct icm_fr_pkg_add_device_key_response { 217struct icm_fr_pkg_add_device_key_response {
218 struct icm_pkg_header hdr; 218 struct icm_pkg_header hdr;
219 uuid_be ep_uuid; 219 uuid_t ep_uuid;
220 u8 connection_key; 220 u8 connection_key;
221 u8 connection_id; 221 u8 connection_id;
222 u16 reserved; 222 u16 reserved;
@@ -224,7 +224,7 @@ struct icm_fr_pkg_add_device_key_response {
224 224
225struct icm_fr_pkg_challenge_device { 225struct icm_fr_pkg_challenge_device {
226 struct icm_pkg_header hdr; 226 struct icm_pkg_header hdr;
227 uuid_be ep_uuid; 227 uuid_t ep_uuid;
228 u8 connection_key; 228 u8 connection_key;
229 u8 connection_id; 229 u8 connection_id;
230 u16 reserved; 230 u16 reserved;
@@ -233,7 +233,7 @@ struct icm_fr_pkg_challenge_device {
233 233
234struct icm_fr_pkg_challenge_device_response { 234struct icm_fr_pkg_challenge_device_response {
235 struct icm_pkg_header hdr; 235 struct icm_pkg_header hdr;
236 uuid_be ep_uuid; 236 uuid_t ep_uuid;
237 u8 connection_key; 237 u8 connection_key;
238 u8 connection_id; 238 u8 connection_id;
239 u16 reserved; 239 u16 reserved;
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 2251e1925ea4..33b0bdbb613c 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -84,26 +84,12 @@ int guid_parse(const char *uuid, guid_t *u);
84int uuid_parse(const char *uuid, uuid_t *u); 84int uuid_parse(const char *uuid, uuid_t *u);
85 85
86/* backwards compatibility, don't use in new code */ 86/* backwards compatibility, don't use in new code */
87typedef uuid_t uuid_be;
88#define UUID_BE(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
89 UUID_INIT(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)
90#define NULL_UUID_BE \
91 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
92 0x00, 0x00, 0x00, 0x00)
93
94#define uuid_le_gen(u) guid_gen(u) 87#define uuid_le_gen(u) guid_gen(u)
95#define uuid_be_gen(u) uuid_gen(u)
96#define uuid_le_to_bin(guid, u) guid_parse(guid, u) 88#define uuid_le_to_bin(guid, u) guid_parse(guid, u)
97#define uuid_be_to_bin(uuid, u) uuid_parse(uuid, u)
98 89
99static inline int uuid_le_cmp(const guid_t u1, const guid_t u2) 90static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
100{ 91{
101 return memcmp(&u1, &u2, sizeof(guid_t)); 92 return memcmp(&u1, &u2, sizeof(guid_t));
102} 93}
103 94
104static inline int uuid_be_cmp(const uuid_t u1, const uuid_t u2)
105{
106 return memcmp(&u1, &u2, sizeof(uuid_t));
107}
108
109#endif 95#endif
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 478c049630b5..cd819c397dc7 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -82,7 +82,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
82 test_uuid_failed("conversion", false, true, data->uuid, NULL); 82 test_uuid_failed("conversion", false, true, data->uuid, NULL);
83 83
84 total_tests++; 84 total_tests++;
85 if (uuid_equal(&data->be, &be)) { 85 if (!uuid_equal(&data->be, &be)) {
86 sprintf(buf, "%pUb", &be); 86 sprintf(buf, "%pUb", &be);
87 test_uuid_failed("cmp", false, true, data->uuid, buf); 87 test_uuid_failed("cmp", false, true, data->uuid, buf);
88 } 88 }