Commit 735c65ce4a878b55e08821360fdfd42753cdbe14

Authored by Andy Shevchenko
Committed by David S. Miller
1 parent 8f31539dfa

drivers: isdn: use kernel macros to convert hex digit

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>

Showing 2 changed files with 4 additions and 16 deletions Side-by-side Diff

drivers/isdn/capi/capidrv.c
... ... @@ -1450,12 +1450,9 @@
1450 1450 }
1451 1451  
1452 1452 for (p = data, end = data+len; p < end; p++) {
1453   - u8 w;
1454 1453 PUTBYTE_TO_STATUS(card, ' ');
1455   - w = (*p >> 4) & 0xf;
1456   - PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w);
1457   - w = *p & 0xf;
1458   - PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w);
  1454 + PUTBYTE_TO_STATUS(card, hex_asc_hi(*p));
  1455 + PUTBYTE_TO_STATUS(card, hex_asc_lo(*p));
1459 1456 }
1460 1457 PUTBYTE_TO_STATUS(card, '\n');
1461 1458  
drivers/isdn/hisax/q931.c
... ... @@ -1152,20 +1152,11 @@
1152 1152 {
1153 1153 register int i;
1154 1154 register char *t = txt;
1155   - register u_char w;
1156 1155  
1157 1156 for (i = 0; i < cnt; i++) {
1158 1157 *t++ = ' ';
1159   - w = (p[i] >> 4) & 0x0f;
1160   - if (w < 10)
1161   - *t++ = '0' + w;
1162   - else
1163   - *t++ = 'A' - 10 + w;
1164   - w = p[i] & 0x0f;
1165   - if (w < 10)
1166   - *t++ = '0' + w;
1167   - else
1168   - *t++ = 'A' - 10 + w;
  1158 + *t++ = hex_asc_hi(p[i]);
  1159 + *t++ = hex_asc_lo(p[i]);
1169 1160 }
1170 1161 *t++ = 0;
1171 1162 return (t - txt);