MIPS: BCM47xx: Use sscanf for parsing mac address
Instead of writing own function for parsing the mac address we now use sscanf. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> To: linux-mips@linux-mips.org Cc: Hauke Mehrtens <hauke@hauke-m.de> Patchwork: https://patchwork.linux-mips.org/patch/1847/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:

committed by
Ralf Baechle

parent
2aa088d6fd
commit
59833fcf48
@@ -12,6 +12,7 @@
|
||||
#define __NVRAM_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
struct nvram_header {
|
||||
u32 magic;
|
||||
@@ -36,4 +37,10 @@ struct nvram_header {
|
||||
|
||||
extern int nvram_getenv(char *name, char *val, size_t val_len);
|
||||
|
||||
static inline void nvram_parse_macaddr(char *buf, u8 *macaddr)
|
||||
{
|
||||
sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],
|
||||
&macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user