drivers: isdn: use kernel macros to convert hex digit
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Thu, 15 Jul 2010 02:37:18 +0000 (02:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Jul 2010 02:05:24 +0000 (19:05 -0700)
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Tilman Schmidt <tilman@imap.cc>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/capi/capidrv.c
drivers/isdn/hisax/q931.c

index bf55ed5f38e37ff74a35c051356f470330476ac7..2978bdaa6b8823473a029bce120237b94e133c2f 100644 (file)
@@ -1450,12 +1450,9 @@ static void handle_dtrace_data(capidrv_contr *card,
        }
 
        for (p = data, end = data+len; p < end; p++) {
-               u8 w;
                PUTBYTE_TO_STATUS(card, ' ');
-               w = (*p >> 4) & 0xf;
-               PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w);
-               w = *p & 0xf;
-               PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w);
+               PUTBYTE_TO_STATUS(card, hex_asc_hi(*p));
+               PUTBYTE_TO_STATUS(card, hex_asc_lo(*p));
        }
        PUTBYTE_TO_STATUS(card, '\n');
 
index 8b853d58e8208e7ca64adacd2b197609a2ba3133..c0771f98fa11ae175e383692329d997e89f1724c 100644 (file)
@@ -1152,20 +1152,11 @@ QuickHex(char *txt, u_char * p, int cnt)
 {
        register int i;
        register char *t = txt;
-       register u_char w;
 
        for (i = 0; i < cnt; i++) {
                *t++ = ' ';
-               w = (p[i] >> 4) & 0x0f;
-               if (w < 10)
-                       *t++ = '0' + w;
-               else
-                       *t++ = 'A' - 10 + w;
-               w = p[i] & 0x0f;
-               if (w < 10)
-                       *t++ = '0' + w;
-               else
-                       *t++ = 'A' - 10 + w;
+               *t++ = hex_asc_hi(p[i]);
+               *t++ = hex_asc_lo(p[i]);
        }
        *t++ = 0;
        return (t - txt);