From patchwork Thu May 11 07:52:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 760968 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wNlmy24RKz9sCZ for ; Thu, 11 May 2017 17:56:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E1971C21C3C; Thu, 11 May 2017 07:56:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3583FC21E1D; Thu, 11 May 2017 07:52:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B36DDC21CDF; Thu, 11 May 2017 07:52:34 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id 00A67C21DD3 for ; Thu, 11 May 2017 07:52:31 +0000 (UTC) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v4B7cjgo003941; Thu, 11 May 2017 09:52:31 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-.pphosted.com with ESMTP id 2abjadrw0j-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 11 May 2017 09:52:31 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AEED138; Thu, 11 May 2017 07:52:30 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9FCA1110D; Thu, 11 May 2017 07:52:30 +0000 (GMT) Received: from localhost (10.201.23.85) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.339.0; Thu, 11 May 2017 09:52:30 +0200 From: Patrick Delaunay To: Date: Thu, 11 May 2017 09:52:05 +0200 Message-ID: <1494489128-24806-16-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494489128-24806-1-git-send-email-patrick.delaunay@st.com> References: <1494489128-24806-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-11_05:, , signatures=0 Cc: Franck Albesa , Christophe Kerello , Gerald Baeza , Patrick Delaunay Subject: [U-Boot] [PATCH v6 15/18] uuid: remove dependency with io.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 v6: None 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)); }