Skip to content

Commit 59796ed

Browse files
praritgregkh
authored andcommitted
mei: make modules.alias UUID information easier to read
scripts/mod/file2alias.c:add_uuid() convert UUID into a single string which does not conform to the standard little endian UUID formatting. This patch changes add_uuid() to output same format as %pUL and modifies the mei driver to match the change. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6c56026 commit 59796ed

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

‎drivers/misc/mei/bus.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
597597
const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
598598
size_t len;
599599

600-
len = snprintf(buf, PAGE_SIZE, "mei:%s:" MEI_CL_UUID_FMT ":",
601-
cldev->name, MEI_CL_UUID_ARGS(uuid->b));
602-
600+
len = snprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", cldev->name, uuid);
603601
return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
604602
}
605603
static DEVICE_ATTR_RO(modalias);
@@ -631,8 +629,7 @@ static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env)
631629
if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name))
632630
return -ENOMEM;
633631

634-
if (add_uevent_var(env, "MODALIAS=mei:%s:" MEI_CL_UUID_FMT ":",
635-
cldev->name, MEI_CL_UUID_ARGS(uuid->b)))
632+
if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:", cldev->name, uuid))
636633
return -ENOMEM;
637634

638635
return 0;

‎include/linux/mod_devicetable.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,6 @@ struct ipack_device_id {
601601

602602
#define MEI_CL_MODULE_PREFIX "mei:"
603603
#define MEI_CL_NAME_SIZE 32
604-
#define MEI_CL_UUID_FMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
605-
#define MEI_CL_UUID_ARGS(_u) \
606-
_u[0], _u[1], _u[2], _u[3], _u[4], _u[5], _u[6], _u[7], \
607-
_u[8], _u[9], _u[10], _u[11], _u[12], _u[13], _u[14], _u[15]
608604

609605
/**
610606
* struct mei_cl_device_id - MEI client device identifier

‎scripts/mod/file2alias.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ static inline void add_wildcard(char *str)
137137
static inline void add_uuid(char *str, uuid_le uuid)
138138
{
139139
int len = strlen(str);
140-
int i;
141140

142-
for (i = 0; i < 16; i++)
143-
sprintf(str + len + (i << 1), "%02x", uuid.b[i]);
141+
sprintf(str + len, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
142+
uuid.b[3], uuid.b[2], uuid.b[1], uuid.b[0],
143+
uuid.b[5], uuid.b[4], uuid.b[7], uuid.b[6],
144+
uuid.b[8], uuid.b[9], uuid.b[10], uuid.b[11],
145+
uuid.b[12], uuid.b[13], uuid.b[14], uuid.b[15]);
144146
}
145147

146148
/**

0 commit comments

Comments
 (0)