From: Patrick Delaunay Date: Thu, 13 Apr 2017 11:52:53 +0200 Subject: [U-Boot] [PATCH v5 15/16] uuid: remove dependency with io.h In-Reply-To: <1492077174-31148-1-git-send-email-patrick.delaunay@st.com> References: <1492077174-31148-1-git-send-email-patrick.delaunay@st.com> Message-ID: <1492077174-31148-16-git-send-email-patrick.delaunay@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- Changes in v5: None 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 #include #include -#include #include #include @@ -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