From patchwork Thu Dec 12 13:49:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 3331961 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C92D2C0D4A for ; Thu, 12 Dec 2013 13:50:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3798B207E4 for ; Thu, 12 Dec 2013 13:49:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09B55207E3 for ; Thu, 12 Dec 2013 13:49:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751416Ab3LLNtx (ORCPT ); Thu, 12 Dec 2013 08:49:53 -0500 Received: from mga02.intel.com ([134.134.136.20]:9002 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396Ab3LLNtw (ORCPT ); Thu, 12 Dec 2013 08:49:52 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 12 Dec 2013 05:49:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,878,1378882800"; d="scan'208";a="451180205" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.173]) by orsmga002.jf.intel.com with ESMTP; 12 Dec 2013 05:49:50 -0800 Received: from andy by smile with local (Exim 4.82) (envelope-from ) id 1Vr6dm-0007n4-3A; Thu, 12 Dec 2013 15:49:22 +0200 From: Andy Shevchenko To: netdev@vger.kernel.org, "David S. Miller" , linux-nfs@vger.kernel.org, Trond Myklebust Cc: Andy Shevchenko Subject: [PATCH v1] net/sunrpc/cache: simplify code by using hex_pack_byte() Date: Thu, 12 Dec 2013 15:49:21 +0200 Message-Id: <1386856161-29889-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 1.8.4.4 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP hex_pack_byte() is a fast way to convert a byte in its ASCII representation. We may use it instead of custom approach. Signed-off-by: Andy Shevchenko --- net/sunrpc/cache.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index a72de07..0877db0 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1111,9 +1111,7 @@ void qword_addhex(char **bpp, int *lp, char *buf, int blen) *bp++ = 'x'; len -= 2; while (blen && len >= 2) { - unsigned char c = *buf++; - *bp++ = '0' + ((c&0xf0)>>4) + (c>=0xa0)*('a'-'9'-1); - *bp++ = '0' + (c&0x0f) + ((c&0x0f)>=0x0a)*('a'-'9'-1); + bp = hex_byte_pack(bp, *buf++); len -= 2; blen--; }