Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: use the common ascii hex helpers

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Harvey Harrison and committed by
David S. Miller
6a8341b6 697f8d03

+8 -10
+6 -7
drivers/net/skfp/smt.c
··· 19 19 #include "h/smc.h" 20 20 #include "h/smt_p.h" 21 21 #include <linux/bitrev.h> 22 + #include <linux/kernel.h> 22 23 23 24 #define KERNEL 24 25 #include "h/smtstate.h" ··· 1731 1730 #endif 1732 1731 1733 1732 #ifdef DEBUG 1734 - #define hextoasc(x) "0123456789abcdef"[x] 1735 - 1736 1733 char *addr_to_string(struct fddi_addr *addr) 1737 1734 { 1738 1735 int i ; 1739 1736 static char string[6*3] = "****" ; 1740 1737 1741 1738 for (i = 0 ; i < 6 ; i++) { 1742 - string[i*3] = hextoasc((addr->a[i]>>4)&0xf) ; 1743 - string[i*3+1] = hextoasc((addr->a[i])&0xf) ; 1744 - string[i*3+2] = ':' ; 1739 + string[i * 3] = hex_asc_hi(addr->a[i]); 1740 + string[i * 3 + 1] = hex_asc_lo(addr->a[i]); 1741 + string[i * 3 + 2] = ':'; 1745 1742 } 1746 - string[5*3+2] = 0 ; 1747 - return(string) ; 1743 + string[5 * 3 + 2] = 0; 1744 + return(string); 1748 1745 } 1749 1746 #endif 1750 1747
+2 -3
net/ipv4/netfilter/ipt_CLUSTERIP.c
··· 475 475 #define HBUFFERLEN 30 476 476 char hbuffer[HBUFFERLEN]; 477 477 int j,k; 478 - const char hexbuf[]= "0123456789abcdef"; 479 478 480 479 for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) { 481 - hbuffer[k++]=hexbuf[(payload->src_hw[j]>>4)&15]; 482 - hbuffer[k++]=hexbuf[payload->src_hw[j]&15]; 480 + hbuffer[k++] = hex_asc_hi(payload->src_hw[j]); 481 + hbuffer[k++] = hex_asc_lo(payload->src_hw[j]); 483 482 hbuffer[k++]=':'; 484 483 } 485 484 hbuffer[--k]='\0';