[U-Boot] [PATCH v4 15/16] uuid: remove dependency with io.h

Patrick Delaunay patrick.delaunay at st.com
Wed Mar 15 14:11:46 UTC 2017


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>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

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

diff --git a/lib/uuid.c b/lib/uuid.c
index 7ce822c..058b1c3 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>
 
@@ -278,13 +277,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