aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2016-05-20 20:00:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-20 20:58:30 -0400
commitaa4ea1c3b3948d325a6826adf9c367d11fa1ab74 (patch)
tree25e966452322c2a196dc742b68e1013cbd32b4b7 /lib
parentf4970682d73bba79cba10149d62482338d065086 (diff)
lib/vsprintf: simplify UUID printing
There are few functions here and there along with type definitions that provide UUID API. This series consolidates everything under one hood and converts current users. This has been tested for a while internally, however it doesn't mean we covered all possible cases (especially accuracy of UUID constants after conversion). So, please test this as much as you can and provide your tag. We appreciate the effort. The ACPI conversion is postponed for now to sort more generic things out first. This patch (of 9): Since we have hex_byte_pack_upper() we may use it directly and avoid second loop. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com> Cc: Mimi Zohar <zohar@linux.vnet.ibm.com> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index ccb664b54280..be0e7cf11e48 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1324,7 +1324,10 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
1324 } 1324 }
1325 1325
1326 for (i = 0; i < 16; i++) { 1326 for (i = 0; i < 16; i++) {
1327 p = hex_byte_pack(p, addr[index[i]]); 1327 if (uc)
1328 p = hex_byte_pack_upper(p, addr[index[i]]);
1329 else
1330 p = hex_byte_pack(p, addr[index[i]]);
1328 switch (i) { 1331 switch (i) {
1329 case 3: 1332 case 3:
1330 case 5: 1333 case 5:
@@ -1337,13 +1340,6 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
1337 1340
1338 *p = 0; 1341 *p = 0;
1339 1342
1340 if (uc) {
1341 p = uuid;
1342 do {
1343 *p = toupper(*p);
1344 } while (*(++p));
1345 }
1346
1347 return string(buf, end, uuid, spec); 1343 return string(buf, end, uuid, spec);
1348} 1344}
1349 1345