[v1,1/1] uuid: Decouple guid_t and uuid_le types and respective macros
Commit Message
The guid_t type and respective macros are being used internally only.
The uuid_le has its user outside the kernel. Decouple these types and
macros, and make guid_t completely internal type to the kernel.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/uuid.h | 20 ++++++++++++++++----
include/uapi/linux/uuid.h | 12 ++++--------
2 files changed, 20 insertions(+), 12 deletions(-)
Comments
Hi Andy,
I love your patch! Perhaps something to improve:
[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on akpm-mm/mm-everything linus/master v6.2-rc1 next-20221226]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/uuid-Decouple-guid_t-and-uuid_le-types-and-respective-macros/20221228-213942
base: git://git.infradead.org/users/hch/configfs.git for-next
patch link: https://lore.kernel.org/r/20221228133616.69278-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] uuid: Decouple guid_t and uuid_le types and respective macros
config: x86_64-allyesconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/419ed69a685704bcd3f5f617181e305fb06bce0d
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/uuid-Decouple-guid_t-and-uuid_le-types-and-respective-macros/20221228-213942
git checkout 419ed69a685704bcd3f5f617181e305fb06bce0d
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/misc/mei/hdcp/ drivers/misc/mei/pxp/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/misc/mei/hdcp/mei_hdcp.c:21:
include/linux/uuid.h:24:1: error: incompatible types when initializing type 'unsigned char' using type 'guid_t'
24 | ((guid_t) \
| ^
drivers/misc/mei/hdcp/mei_hdcp.c:862:23: note: in expansion of macro 'GUID_INIT'
862 | #define MEI_UUID_HDCP GUID_INIT(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
| ^~~~~~~~~
drivers/misc/mei/hdcp/mei_hdcp.c:866:19: note: in expansion of macro 'MEI_UUID_HDCP'
866 | { .uuid = MEI_UUID_HDCP, .version = MEI_CL_VERSION_ANY },
| ^~~~~~~~~~~~~
>> drivers/misc/mei/hdcp/mei_hdcp.c:865:55: warning: missing braces around initializer [-Wmissing-braces]
865 | static const struct mei_cl_device_id mei_hdcp_tbl[] = {
| ^
--
In file included from drivers/misc/mei/pxp/mei_pxp.c:16:
include/linux/uuid.h:24:1: error: incompatible types when initializing type 'unsigned char' using type 'guid_t'
24 | ((guid_t) \
| ^
drivers/misc/mei/pxp/mei_pxp.c:209:22: note: in expansion of macro 'GUID_INIT'
209 | #define MEI_GUID_PXP GUID_INIT(0xfbf6fcf1, 0x96cf, 0x4e2e, 0xA6, \
| ^~~~~~~~~
drivers/misc/mei/pxp/mei_pxp.c:213:19: note: in expansion of macro 'MEI_GUID_PXP'
213 | { .uuid = MEI_GUID_PXP, .version = MEI_CL_VERSION_ANY },
| ^~~~~~~~~~~~
>> drivers/misc/mei/pxp/mei_pxp.c:212:48: warning: missing braces around initializer [-Wmissing-braces]
212 | static struct mei_cl_device_id mei_pxp_tbl[] = {
| ^
vim +865 drivers/misc/mei/hdcp/mei_hdcp.c
64e9bbdd9588ad Ramalingam C 2019-02-21 861
64e9bbdd9588ad Ramalingam C 2019-02-21 862 #define MEI_UUID_HDCP GUID_INIT(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
64e9bbdd9588ad Ramalingam C 2019-02-21 863 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04)
64e9bbdd9588ad Ramalingam C 2019-02-21 864
50bf73bdce8efc Rikard Falkeborn 2020-06-11 @865 static const struct mei_cl_device_id mei_hdcp_tbl[] = {
64e9bbdd9588ad Ramalingam C 2019-02-21 866 { .uuid = MEI_UUID_HDCP, .version = MEI_CL_VERSION_ANY },
64e9bbdd9588ad Ramalingam C 2019-02-21 867 { }
64e9bbdd9588ad Ramalingam C 2019-02-21 868 };
64e9bbdd9588ad Ramalingam C 2019-02-21 869 MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl);
64e9bbdd9588ad Ramalingam C 2019-02-21 870
Hi Andy,
I love your patch! Yet something to improve:
[auto build test ERROR on hch-configfs/for-next]
[also build test ERROR on akpm-mm/mm-everything linus/master v6.2-rc1 next-20221226]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/uuid-Decouple-guid_t-and-uuid_le-types-and-respective-macros/20221228-213942
base: git://git.infradead.org/users/hch/configfs.git for-next
patch link: https://lore.kernel.org/r/20221228133616.69278-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] uuid: Decouple guid_t and uuid_le types and respective macros
config: x86_64-randconfig-a006-20221226
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/419ed69a685704bcd3f5f617181e305fb06bce0d
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/uuid-Decouple-guid_t-and-uuid_le-types-and-respective-macros/20221228-213942
git checkout 419ed69a685704bcd3f5f617181e305fb06bce0d
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/misc/mei/hdcp/ drivers/misc/mei/pxp/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All error/warnings (new ones prefixed by >>):
>> drivers/misc/mei/hdcp/mei_hdcp.c:866:12: error: initializing '__u8' (aka 'unsigned char') with an expression of incompatible type 'guid_t'
{ .uuid = MEI_UUID_HDCP, .version = MEI_CL_VERSION_ANY },
^~~~~~~~~~~~~
drivers/misc/mei/hdcp/mei_hdcp.c:862:23: note: expanded from macro 'MEI_UUID_HDCP'
#define MEI_UUID_HDCP GUID_INIT(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uuid.h:23:62: note: expanded from macro 'GUID_INIT'
#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
^
>> drivers/misc/mei/hdcp/mei_hdcp.c:866:12: warning: suggest braces around initialization of subobject [-Wmissing-braces]
{ .uuid = MEI_UUID_HDCP, .version = MEI_CL_VERSION_ANY },
^~~~~~~~~~~~~
{ }
drivers/misc/mei/hdcp/mei_hdcp.c:862:23: note: expanded from macro 'MEI_UUID_HDCP'
#define MEI_UUID_HDCP GUID_INIT(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uuid.h:23:62: note: expanded from macro 'GUID_INIT'
#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
^
>> drivers/misc/mei/hdcp/mei_hdcp.c:869:1: error: definition of variable with array type needs an explicit size or an initializer
MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl);
^
include/linux/module.h:243:21: note: expanded from macro 'MODULE_DEVICE_TABLE'
extern typeof(name) __mod_##type##__##name##_device_table \
^
<scratch space>:29:1: note: expanded from here
__mod_mei__mei_hdcp_tbl_device_table
^
1 warning and 2 errors generated.
--
>> drivers/misc/mei/pxp/mei_pxp.c:213:12: error: initializing '__u8' (aka 'unsigned char') with an expression of incompatible type 'guid_t'
{ .uuid = MEI_GUID_PXP, .version = MEI_CL_VERSION_ANY },
^~~~~~~~~~~~
drivers/misc/mei/pxp/mei_pxp.c:209:22: note: expanded from macro 'MEI_GUID_PXP'
#define MEI_GUID_PXP GUID_INIT(0xfbf6fcf1, 0x96cf, 0x4e2e, 0xA6, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uuid.h:23:62: note: expanded from macro 'GUID_INIT'
#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
^
>> drivers/misc/mei/pxp/mei_pxp.c:213:12: warning: suggest braces around initialization of subobject [-Wmissing-braces]
{ .uuid = MEI_GUID_PXP, .version = MEI_CL_VERSION_ANY },
^~~~~~~~~~~~
{ }
drivers/misc/mei/pxp/mei_pxp.c:209:22: note: expanded from macro 'MEI_GUID_PXP'
#define MEI_GUID_PXP GUID_INIT(0xfbf6fcf1, 0x96cf, 0x4e2e, 0xA6, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uuid.h:23:62: note: expanded from macro 'GUID_INIT'
#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
^
>> drivers/misc/mei/pxp/mei_pxp.c:216:1: error: definition of variable with array type needs an explicit size or an initializer
MODULE_DEVICE_TABLE(mei, mei_pxp_tbl);
^
include/linux/module.h:243:21: note: expanded from macro 'MODULE_DEVICE_TABLE'
extern typeof(name) __mod_##type##__##name##_device_table \
^
<scratch space>:180:1: note: expanded from here
__mod_mei__mei_pxp_tbl_device_table
^
1 warning and 2 errors generated.
vim +866 drivers/misc/mei/hdcp/mei_hdcp.c
64e9bbdd9588ad Ramalingam C 2019-02-21 861
64e9bbdd9588ad Ramalingam C 2019-02-21 862 #define MEI_UUID_HDCP GUID_INIT(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
64e9bbdd9588ad Ramalingam C 2019-02-21 863 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04)
64e9bbdd9588ad Ramalingam C 2019-02-21 864
50bf73bdce8efc Rikard Falkeborn 2020-06-11 865 static const struct mei_cl_device_id mei_hdcp_tbl[] = {
64e9bbdd9588ad Ramalingam C 2019-02-21 @866 { .uuid = MEI_UUID_HDCP, .version = MEI_CL_VERSION_ANY },
64e9bbdd9588ad Ramalingam C 2019-02-21 867 { }
64e9bbdd9588ad Ramalingam C 2019-02-21 868 };
64e9bbdd9588ad Ramalingam C 2019-02-21 @869 MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl);
64e9bbdd9588ad Ramalingam C 2019-02-21 870
@@ -8,15 +8,25 @@
#ifndef _LINUX_UUID_H_
#define _LINUX_UUID_H_
-#include <uapi/linux/uuid.h>
#include <linux/string.h>
#define UUID_SIZE 16
+typedef struct {
+ __u8 b[UUID_SIZE];
+} guid_t;
+
typedef struct {
__u8 b[UUID_SIZE];
} uuid_t;
+#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+((guid_t) \
+{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
+ (b) & 0xff, ((b) >> 8) & 0xff, \
+ (c) & 0xff, ((c) >> 8) & 0xff, \
+ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
+
#define UUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
((uuid_t) \
{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
@@ -97,10 +107,12 @@ extern const u8 uuid_index[16];
int guid_parse(const char *uuid, guid_t *u);
int uuid_parse(const char *uuid, uuid_t *u);
-/* backwards compatibility, don't use in new code */
-static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
+/* 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(guid_t));
+ return memcmp(&u1, &u2, sizeof(uuid_le));
}
#endif
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* DO NOT USE in new code! This is solely for MEI due to legacy reasons */
/*
- * UUID/GUID definition
+ * MEI UUID definition
*
* Copyright (C) 2010, Intel Corp.
* Huang Ying <ying.huang@intel.com>
@@ -14,19 +14,15 @@
typedef struct {
__u8 b[16];
-} guid_t;
+} uuid_le;
-#define GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
-((guid_t) \
+#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+((uuid_le) \
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
(b) & 0xff, ((b) >> 8) & 0xff, \
(c) & 0xff, ((c) >> 8) & 0xff, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-/* backwards compatibility, don't use in new code */
-typedef guid_t uuid_le;
-#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
- GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
#define NULL_UUID_LE \
UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00)