Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755434AbcDDNaV (ORCPT ); Mon, 4 Apr 2016 09:30:21 -0400 Received: from mga02.intel.com ([134.134.136.20]:37310 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753606AbcDDNaS (ORCPT ); Mon, 4 Apr 2016 09:30:18 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,440,1455004800"; d="scan'208";a="937864689" From: Andy Shevchenko To: Arnd Bergmann , "Theodore Ts'o" , Matt Fleming , Andrew Morton , Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-api@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH v2 1/8] lib/vsprintf: simplify UUID printing Date: Mon, 4 Apr 2016 16:30:03 +0300 Message-Id: <1459776610-68469-2-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1459776610-68469-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1459776610-68469-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 890 Lines: 40 Since we have hex_byte_pack_upper() we may use it directly and avoid second loop. Signed-off-by: Andy Shevchenko --- lib/vsprintf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index ccb664b..be0e7cf 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1324,7 +1324,10 @@ char *uuid_string(char *buf, char *end, const u8 *addr, } for (i = 0; i < 16; i++) { - p = hex_byte_pack(p, addr[index[i]]); + if (uc) + p = hex_byte_pack_upper(p, addr[index[i]]); + else + p = hex_byte_pack(p, addr[index[i]]); switch (i) { case 3: case 5: @@ -1337,13 +1340,6 @@ char *uuid_string(char *buf, char *end, const u8 *addr, *p = 0; - if (uc) { - p = uuid; - do { - *p = toupper(*p); - } while (*(++p)); - } - return string(buf, end, uuid, spec); } -- 2.8.0.rc3