diff options
Diffstat (limited to 'drivers/misc/pch_phub.c')
-rw-r--r-- | drivers/misc/pch_phub.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c index 931e635aa491..a5925f7f17f6 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; |
@@ -669,8 +665,6 @@ static struct bin_attribute pch_bin_attr = { | |||
669 | static int pch_phub_probe(struct pci_dev *pdev, | 665 | static int pch_phub_probe(struct pci_dev *pdev, |
670 | const struct pci_device_id *id) | 666 | const struct pci_device_id *id) |
671 | { | 667 | { |
672 | int retval; | ||
673 | |||
674 | int ret; | 668 | int ret; |
675 | struct pch_phub_reg *chip; | 669 | struct pch_phub_reg *chip; |
676 | 670 | ||
@@ -713,13 +707,13 @@ static int pch_phub_probe(struct pci_dev *pdev, | |||
713 | if (id->driver_data == 1) { /* EG20T PCH */ | 707 | if (id->driver_data == 1) { /* EG20T PCH */ |
714 | const char *board_name; | 708 | const char *board_name; |
715 | 709 | ||
716 | retval = sysfs_create_file(&pdev->dev.kobj, | 710 | ret = sysfs_create_file(&pdev->dev.kobj, |
717 | &dev_attr_pch_mac.attr); | 711 | &dev_attr_pch_mac.attr); |
718 | if (retval) | 712 | if (ret) |
719 | goto err_sysfs_create; | 713 | goto err_sysfs_create; |
720 | 714 | ||
721 | retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); | 715 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); |
722 | if (retval) | 716 | if (ret) |
723 | goto exit_bin_attr; | 717 | goto exit_bin_attr; |
724 | 718 | ||
725 | pch_phub_read_modify_write_reg(chip, | 719 | pch_phub_read_modify_write_reg(chip, |
@@ -743,8 +737,8 @@ static int pch_phub_probe(struct pci_dev *pdev, | |||
743 | chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; | 737 | chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; |
744 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; | 738 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; |
745 | } else if (id->driver_data == 2) { /* ML7213 IOH */ | 739 | } else if (id->driver_data == 2) { /* ML7213 IOH */ |
746 | retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); | 740 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); |
747 | if (retval) | 741 | if (ret) |
748 | goto err_sysfs_create; | 742 | goto err_sysfs_create; |
749 | /* set the prefech value | 743 | /* set the prefech value |
750 | * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a | 744 | * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a |
@@ -766,12 +760,12 @@ static int pch_phub_probe(struct pci_dev *pdev, | |||
766 | PCH_PHUB_ROM_START_ADDR_ML7223; | 760 | PCH_PHUB_ROM_START_ADDR_ML7223; |
767 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; | 761 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; |
768 | } else if (id->driver_data == 4) { /* ML7223 IOH Bus-n*/ | 762 | } else if (id->driver_data == 4) { /* ML7223 IOH Bus-n*/ |
769 | retval = sysfs_create_file(&pdev->dev.kobj, | 763 | ret = sysfs_create_file(&pdev->dev.kobj, |
770 | &dev_attr_pch_mac.attr); | 764 | &dev_attr_pch_mac.attr); |
771 | if (retval) | 765 | if (ret) |
772 | goto err_sysfs_create; | 766 | goto err_sysfs_create; |
773 | retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); | 767 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); |
774 | if (retval) | 768 | if (ret) |
775 | goto exit_bin_attr; | 769 | goto exit_bin_attr; |
776 | /* set the prefech value | 770 | /* set the prefech value |
777 | * Device2(USB OHCI #0,1,2,3/ USB EHCI #0):a | 771 | * Device2(USB OHCI #0,1,2,3/ USB EHCI #0):a |
@@ -783,13 +777,13 @@ static int pch_phub_probe(struct pci_dev *pdev, | |||
783 | PCH_PHUB_ROM_START_ADDR_ML7223; | 777 | PCH_PHUB_ROM_START_ADDR_ML7223; |
784 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; | 778 | chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; |
785 | } else if (id->driver_data == 5) { /* ML7831 */ | 779 | } else if (id->driver_data == 5) { /* ML7831 */ |
786 | retval = sysfs_create_file(&pdev->dev.kobj, | 780 | ret = sysfs_create_file(&pdev->dev.kobj, |
787 | &dev_attr_pch_mac.attr); | 781 | &dev_attr_pch_mac.attr); |
788 | if (retval) | 782 | if (ret) |
789 | goto err_sysfs_create; | 783 | goto err_sysfs_create; |
790 | 784 | ||
791 | retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); | 785 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); |
792 | if (retval) | 786 | if (ret) |
793 | goto exit_bin_attr; | 787 | goto exit_bin_attr; |
794 | 788 | ||
795 | /* set the prefech value */ | 789 | /* set the prefech value */ |