aboutsummaryrefslogtreecommitdiffstats
path: root/net/ethernet/eth.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-07-16 17:09:15 -0700
committerDavid S. Miller <davem@davemloft.net>2013-07-16 17:09:22 -0700
commitae8e9c5a1a7889315229a741fd48a5dd0bc2964c (patch)
tree6ea199fad466af8253da9ae617ce112bb182ee43 /net/ethernet/eth.c
parent52fe29e4bb614367c108b717c6d7fe5953eb7af3 (diff)
downloadkernel_goldelico_gta04-ae8e9c5a1a7889315229a741fd48a5dd0bc2964c.zip
kernel_goldelico_gta04-ae8e9c5a1a7889315229a741fd48a5dd0bc2964c.tar.gz
kernel_goldelico_gta04-ae8e9c5a1a7889315229a741fd48a5dd0bc2964c.tar.bz2
net: Fix sysfs_format_mac() code duplication.
It's just a duplicate implementation of "%*phC". Thanks to Joe Perches for showing that we had exactly this support in the lib/vsprintf.c code already. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethernet/eth.c')
-rw-r--r--net/ethernet/eth.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 5359560..be1f64d 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -401,27 +401,8 @@ struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
}
EXPORT_SYMBOL(alloc_etherdev_mqs);
-static size_t _format_mac_addr(char *buf, int buflen,
- const unsigned char *addr, int len)
-{
- int i;
- char *cp = buf;
-
- for (i = 0; i < len; i++) {
- cp += scnprintf(cp, buflen - (cp - buf), "%02x", addr[i]);
- if (i == len - 1)
- break;
- cp += scnprintf(cp, buflen - (cp - buf), ":");
- }
- return cp - buf;
-}
-
ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len)
{
- size_t l;
-
- l = _format_mac_addr(buf, PAGE_SIZE, addr, len);
- l += scnprintf(buf + l, PAGE_SIZE - l, "\n");
- return (ssize_t)l;
+ return scnprintf(buf, PAGE_SIZE, "%*phC\n", len, addr);
}
EXPORT_SYMBOL(sysfs_format_mac);