[v1,1/1] mei: Move uuid_le_cmp() to its only user

Message ID 20230202145412.87569-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [v1,1/1] mei: Move uuid_le_cmp() to its only user |

Commit Message

Andy Shevchenko Feb. 2, 2023, 2:54 p.m. UTC
  There is only a single user of uuid_le_cmp() API, let's make it private
to that user.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/misc/mei/mei_dev.h | 5 +++++
 include/linux/uuid.h       | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

Christoph Hellwig Feb. 2, 2023, 3:17 p.m. UTC | #1
On Thu, Feb 02, 2023 at 04:54:12PM +0200, Andy Shevchenko wrote:
> There is only a single user of uuid_le_cmp() API, let's make it private
> to that user.

Any reason this code can't just use guid_t and guid_equal?
  
Andy Shevchenko Feb. 2, 2023, 3:21 p.m. UTC | #2
On Thu, Feb 02, 2023 at 04:17:59PM +0100, Christoph Hellwig wrote:
> On Thu, Feb 02, 2023 at 04:54:12PM +0200, Andy Shevchenko wrote:
> > There is only a single user of uuid_le_cmp() API, let's make it private
> > to that user.
> 
> Any reason this code can't just use guid_t and guid_equal?

It's part of ABI, while guid_* are for the internal use.

Eventually they may switch to the internal types, but it's up to MEI.
  
Christoph Hellwig Feb. 2, 2023, 3:22 p.m. UTC | #3
On Thu, Feb 02, 2023 at 05:21:52PM +0200, Andy Shevchenko wrote:
> On Thu, Feb 02, 2023 at 04:17:59PM +0100, Christoph Hellwig wrote:
> > On Thu, Feb 02, 2023 at 04:54:12PM +0200, Andy Shevchenko wrote:
> > > There is only a single user of uuid_le_cmp() API, let's make it private
> > > to that user.
> > 
> > Any reason this code can't just use guid_t and guid_equal?
> 
> It's part of ABI, while guid_* are for the internal use.
> 
> Eventually they may switch to the internal types, but it's up to MEI.

How can a type name be part of a binary interface?
  
Andy Shevchenko Feb. 2, 2023, 3:31 p.m. UTC | #4
On Thu, Feb 02, 2023 at 04:22:34PM +0100, Christoph Hellwig wrote:
> On Thu, Feb 02, 2023 at 05:21:52PM +0200, Andy Shevchenko wrote:
> > On Thu, Feb 02, 2023 at 04:17:59PM +0100, Christoph Hellwig wrote:
> > > On Thu, Feb 02, 2023 at 04:54:12PM +0200, Andy Shevchenko wrote:
> > > > There is only a single user of uuid_le_cmp() API, let's make it private
> > > > to that user.
> > > 
> > > Any reason this code can't just use guid_t and guid_equal?
> > 
> > It's part of ABI, while guid_* are for the internal use.
> > 
> > Eventually they may switch to the internal types, but it's up to MEI.
> 
> How can a type name be part of a binary interface?

If I'm not mistaken there is a difference between simple __u8[16] and
struct { __u8[16] } due to alignment. But data wise it's the same, of
course. That said, it depends on how this type is being used in the
any of ABI.

From the API perspective the guid_* are not visible to uAPI.
  

Patch

diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 996b70a988be..895011b7a0bf 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -13,6 +13,11 @@ 
 #include <linux/mei.h>
 #include <linux/mei_cl_bus.h>
 
+static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
+{
+	return memcmp(&u1, &u2, sizeof(uuid_le));
+}
+
 #include "hw.h"
 #include "hbm.h"
 
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 5be158a49e11..6b1a3efa1e0b 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -110,9 +110,4 @@  int uuid_parse(const char *uuid, uuid_t *u);
 /* MEI UUID type, don't use anywhere else */
 #include <uapi/linux/uuid.h>
 
-static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
-{
-	return memcmp(&u1, &u2, sizeof(uuid_le));
-}
-
 #endif