diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-05-28 11:54:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-03 17:23:32 -0400 |
commit | 143e9c76c487957de89808cf2a3c828518ad131b (patch) | |
tree | 8dfe02e4fd6ad1b62e75446665c60aa7ded268b7 /drivers/misc/pch_phub.c | |
parent | c265a0d5152619bddcf1986f17995d2df6781554 (diff) |
pch_phub: re-use native MAC address parser
We have mac_pton() helper to parse MAC addresses.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/pch_phub.c')
-rw-r--r-- | drivers/misc/pch_phub.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c index 931e635aa491..8b4d4fb9187b 100644 --- a/drivers/misc/pch_phub.c +++ b/drivers/misc/pch_phub.c | |||
@@ -633,17 +633,13 @@ static ssize_t show_pch_mac(struct device *dev, struct device_attribute *attr, | |||
633 | static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, | 633 | static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, |
634 | const char *buf, size_t count) | 634 | const char *buf, size_t count) |
635 | { | 635 | { |
636 | u8 mac[6]; | 636 | u8 mac[ETH_ALEN]; |
637 | ssize_t rom_size; | 637 | ssize_t rom_size; |
638 | struct pch_phub_reg *chip = dev_get_drvdata(dev); | 638 | struct pch_phub_reg *chip = dev_get_drvdata(dev); |
639 | 639 | ||
640 | if (count != 18) | 640 | if (!mac_pton(buf, mac)) |
641 | return -EINVAL; | 641 | return -EINVAL; |
642 | 642 | ||
643 | sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", | ||
644 | (u32 *)&mac[0], (u32 *)&mac[1], (u32 *)&mac[2], (u32 *)&mac[3], | ||
645 | (u32 *)&mac[4], (u32 *)&mac[5]); | ||
646 | |||
647 | chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); | 643 | chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); |
648 | if (!chip->pch_phub_extrom_base_address) | 644 | if (!chip->pch_phub_extrom_base_address) |
649 | return -ENOMEM; | 645 | return -ENOMEM; |