[U-Boot] [RFC PATCH v1 2/3] uuid: remove dependency with io.h

Patrick Delaunay patrick.delaunay73 at gmail.com
Tue Nov 22 10:46:42 CET 2016


From: Patrick Delaunay <patrick.delaunay at st.com>

io.h is only used for CONFIG_RANDOM_UUID
- for clrsetbits_be16
- for clrsetbits_8
available only for some target (but not for SANDBOX)

Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay73 at gmail.com>
---

 lib/uuid.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/uuid.c b/lib/uuid.c
index eb8d8eb..47646e3 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -8,7 +8,6 @@
 #include <linux/ctype.h>
 #include <errno.h>
 #include <common.h>
-#include <asm/io.h>
 #include <part_efi.h>
 #include <malloc.h>
 
@@ -276,13 +275,13 @@ void gen_rand_uuid(unsigned char *uuid_bin)
 	for (i = 0; i < sizeof(struct uuid) / sizeof(*ptr); i++)
 		*(ptr + i) = cpu_to_be32(rand());
 
-	clrsetbits_be16(&uuid.time_hi_and_version,
-			UUID_VERSION_MASK,
-			UUID_VERSION << UUID_VERSION_SHIFT);
+	/* UUID is big endian */
+	uuid.time_hi_and_version |= ~cpu_to_be16(UUID_VERSION_MASK);
+	uuid.time_hi_and_version &=
+		cpu_to_be16(UUID_VERSION << UUID_VERSION_SHIFT);
 
-	clrsetbits_8(&uuid.clock_seq_hi_and_reserved,
-		     UUID_VARIANT_MASK,
-		     UUID_VARIANT << UUID_VARIANT_SHIFT);
+	uuid.clock_seq_hi_and_reserved |= ~UUID_VARIANT_MASK;
+	uuid.clock_seq_hi_and_reserved &= UUID_VARIANT << UUID_VARIANT_SHIFT;
 
 	memcpy(uuid_bin, &uuid, sizeof(struct uuid));
 }
-- 
1.9.1



More information about the U-Boot mailing list