Merge tag 'usb-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[platform/kernel/linux-exynos.git] / scripts / mod / file2alias.c
index a7a8560..84c86f3 100644 (file)
@@ -34,6 +34,9 @@ typedef Elf64_Addr    kernel_ulong_t;
 typedef uint32_t       __u32;
 typedef uint16_t       __u16;
 typedef unsigned char  __u8;
+typedef struct {
+       __u8 b[16];
+} uuid_le;
 
 /* Big exception to the "don't include kernel headers into userspace, which
  * even potentially has different endianness and word sizes, since
@@ -131,6 +134,15 @@ static inline void add_wildcard(char *str)
                strcat(str + len, "*");
 }
 
+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]);
+}
+
 /**
  * Check that sizeof(device_id type) are consistent with size of section
  * in .o file. If in-consistent then userspace and kernel does not agree
@@ -1160,13 +1172,18 @@ static int do_cpu_entry(const char *filename, void *symval, char *alias)
 }
 ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry);
 
-/* Looks like: mei:S */
+/* Looks like: mei:S:uuid */
 static int do_mei_entry(const char *filename, void *symval,
                        char *alias)
 {
        DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
+       DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid);
+
+       sprintf(alias, MEI_CL_MODULE_PREFIX);
+       sprintf(alias + strlen(alias), "%s:",  (*name)[0]  ? *name : "*");
+       add_uuid(alias, *uuid);
 
-       sprintf(alias, MEI_CL_MODULE_PREFIX "%s", *name);
+       strcat(alias, ":*");
 
        return 1;
 }