diff mbox series

[v3,1/4] modpost: Mark uuid_le type only for MEI

Message ID 20211001113747.64040-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/4] modpost: Mark uuid_le type only for MEI | expand

Commit Message

Andy Shevchenko Oct. 1, 2021, 11:37 a.m. UTC
The uuid_le type is used only for MEI ABI, do not advertise it for others.
Due to above, bury add_uuid() in its only user.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v3: no change
 scripts/mod/file2alias.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

Comments

Greg Kroah-Hartman Oct. 1, 2021, 11:59 a.m. UTC | #1
On Fri, Oct 01, 2021 at 02:37:44PM +0300, Andy Shevchenko wrote:
> The uuid_le type is used only for MEI ABI, do not advertise it for others.
> Due to above, bury add_uuid() in its only user.

Why not just remove it from the user and move to using guid_t instead?

And then remove this code entirely?

thanks,

greg k-h
Andy Shevchenko Oct. 1, 2021, 12:12 p.m. UTC | #2
On Fri, Oct 01, 2021 at 01:59:45PM +0200, Greg Kroah-Hartman wrote:
> On Fri, Oct 01, 2021 at 02:37:44PM +0300, Andy Shevchenko wrote:
> > The uuid_le type is used only for MEI ABI, do not advertise it for others.
> > Due to above, bury add_uuid() in its only user.
> 
> Why not just remove it from the user and move to using guid_t instead?
> 
> And then remove this code entirely?

The idea is to decouple ABI available type (uuid_le) from kernel internal one
(guid_t).
diff mbox series

Patch

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 49aba862073e..c9c9c2328e26 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -34,19 +34,22 @@  typedef Elf64_Addr	kernel_ulong_t;
 typedef uint32_t	__u32;
 typedef uint16_t	__u16;
 typedef unsigned char	__u8;
+
 typedef struct {
 	__u8 b[16];
 } guid_t;
 
-/* backwards compatibility, don't use in new code */
-typedef struct {
-	__u8 b[16];
-} uuid_le;
 typedef struct {
 	__u8 b[16];
 } uuid_t;
+
 #define	UUID_STRING_LEN		36
 
+/* MEI UUID type, don't use anywhere else */
+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
  * we handle those differences explicitly below */
@@ -104,17 +107,6 @@  static inline void add_wildcard(char *str)
 		strcat(str + len, "*");
 }
 
-static inline void add_uuid(char *str, uuid_le uuid)
-{
-	int len = strlen(str);
-
-	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]);
-}
-
 /**
  * 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
@@ -1211,12 +1203,16 @@  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);
+	DEF_FIELD(symval, mei_cl_device_id, uuid);
 	DEF_FIELD(symval, mei_cl_device_id, version);
 
 	sprintf(alias, MEI_CL_MODULE_PREFIX);
 	sprintf(alias + strlen(alias), "%s:",  (*name)[0]  ? *name : "*");
-	add_uuid(alias, *uuid);
+	sprintf(alias + strlen(alias), "%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]);
 	ADD(alias, ":", version != MEI_CL_VERSION_ANY, version);
 
 	strcat(alias, ":*");