diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2012-07-24 05:20:21 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-08-23 12:11:13 -0400 |
commit | 56cda12986a243a66b9714f9ccac884e2faea38e (patch) | |
tree | 15dbf9a802a7c1677fc620166627b5580f9cffc1 /drivers/net/ethernet/sun/niu.c | |
parent | fadd1daa0b62bccb10acab6d693b9de990671456 (diff) |
niu: Use PCI Express Capability accessors
Use PCI Express Capability access functions to simplify niu driver.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/net/ethernet/sun/niu.c')
-rw-r--r-- | drivers/net/ethernet/sun/niu.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index c2a0fe393267..3208dca66758 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
@@ -9762,9 +9762,8 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9762 | union niu_parent_id parent_id; | 9762 | union niu_parent_id parent_id; |
9763 | struct net_device *dev; | 9763 | struct net_device *dev; |
9764 | struct niu *np; | 9764 | struct niu *np; |
9765 | int err, pos; | 9765 | int err; |
9766 | u64 dma_mask; | 9766 | u64 dma_mask; |
9767 | u16 val16; | ||
9768 | 9767 | ||
9769 | niu_driver_version(); | 9768 | niu_driver_version(); |
9770 | 9769 | ||
@@ -9787,8 +9786,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9787 | goto err_out_disable_pdev; | 9786 | goto err_out_disable_pdev; |
9788 | } | 9787 | } |
9789 | 9788 | ||
9790 | pos = pci_pcie_cap(pdev); | 9789 | if (!pci_is_pcie(pdev)) { |
9791 | if (pos <= 0) { | ||
9792 | dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n"); | 9790 | dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n"); |
9793 | goto err_out_free_res; | 9791 | goto err_out_free_res; |
9794 | } | 9792 | } |
@@ -9813,14 +9811,11 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9813 | goto err_out_free_dev; | 9811 | goto err_out_free_dev; |
9814 | } | 9812 | } |
9815 | 9813 | ||
9816 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCTL, &val16); | 9814 | pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL, |
9817 | val16 &= ~PCI_EXP_DEVCTL_NOSNOOP_EN; | 9815 | PCI_EXP_DEVCTL_NOSNOOP_EN, |
9818 | val16 |= (PCI_EXP_DEVCTL_CERE | | 9816 | PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_NFERE | |
9819 | PCI_EXP_DEVCTL_NFERE | | 9817 | PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE | |
9820 | PCI_EXP_DEVCTL_FERE | | 9818 | PCI_EXP_DEVCTL_RELAX_EN); |
9821 | PCI_EXP_DEVCTL_URRE | | ||
9822 | PCI_EXP_DEVCTL_RELAX_EN); | ||
9823 | pci_write_config_word(pdev, pos + PCI_EXP_DEVCTL, val16); | ||
9824 | 9819 | ||
9825 | dma_mask = DMA_BIT_MASK(44); | 9820 | dma_mask = DMA_BIT_MASK(44); |
9826 | err = pci_set_dma_mask(pdev, dma_mask); | 9821 | err = pci_set_dma_mask(pdev, dma_mask); |