Skip to contentSkip to conversation

mei, make modules.alias UUID information easier to read

PATCH New Prarit Bhargava 1 participant 1 message Aug 7, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mei, make modules.alias UUID information easier to read

scripts/mod/file2alias.c:add_uuid() munges a UUID into a single string which does not conform to the standard little endian UUID. This patch changes add_uuid() to use the UUID correctly so that future drivers which use UUID matches can simply use the %pUL format, and modifies the mei driver with those changes.

Cc Tomas Winkler <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/misc/mei/bus.c          |    6 ++----
 include/linux/mod_devicetable.h |    4 ----
 scripts/mod/file2alias.c        |    9 ++++++---
 3 files changed, 8 insertions(+), 11 deletions(-)
drivers/misc/mei/bus.c +2 -4
index 458aa5a..457e132 100644
@@ -141,8 +141,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
 	const uuid_le *uuid = mei_me_cl_uuid(device->me_cl);
 	size_t len;
 
-	len = snprintf(buf, PAGE_SIZE, "mei:%s:" MEI_CL_UUID_FMT ":",
-		device->name, MEI_CL_UUID_ARGS(uuid->b));
+	len = snprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", device->name, uuid);
 
 	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
@@ -167,8 +166,7 @@ static int mei_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
 	if (add_uevent_var(env, "MEI_CL_NAME=%s", device->name))
 		return -ENOMEM;
 
-	if (add_uevent_var(env, "MODALIAS=mei:%s:" MEI_CL_UUID_FMT ":",
-		device->name, MEI_CL_UUID_ARGS(uuid->b)))
+	if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:", device->name, uuid))
 		return -ENOMEM;
 
 	return 0;
include/linux/mod_devicetable.h +0 -4
index 34f25b7..becda6f 100644
@@ -601,10 +601,6 @@ struct ipack_device_id {
 
 #define MEI_CL_MODULE_PREFIX "mei:"
 #define MEI_CL_NAME_SIZE 32
-#define MEI_CL_UUID_FMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
-#define MEI_CL_UUID_ARGS(_u) \
-	_u[0], _u[1], _u[2], _u[3], _u[4], _u[5], _u[6], _u[7], \
-	_u[8], _u[9], _u[10], _u[11], _u[12], _u[13], _u[14], _u[15]
 
 /**
  * struct mei_cl_device_id - MEI client device identifier
scripts/mod/file2alias.c +6 -3
index 5f20882..8a46c60 100644
@@ -137,10 +137,13 @@ static inline void add_wildcard(char *str)
 static inline void add_uuid(char *str, uuid_le uuid)
 {
 	int len = strlen(str);
-	int i;
 
-	for (i = 0; i < 16; i++)
-		sprintf(str + len + (i << 1), "%02x", uuid.b[i]);
+	sprintf(str + len,
+		"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+		uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0],
+		uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6],
+		uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11],
+		uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]);
 }
 
 /**
Signature · 1 line
1.7.9.3