diff options
author | Yijing Wang <wangyijing@huawei.com> | 2013-09-09 09:13:07 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-10-04 16:31:03 -0400 |
commit | 9db008d0d963f358c13381e86f5a042579216f06 (patch) | |
tree | 06450cae6b2be5dc5223a7d6970e66d410b71f96 | |
parent | 03078633a6eb86fdb6ea2f40e6352de4b1181bbf (diff) |
staging: et131x: Use pci_dev->pcie_mpss and pcie_set_readrq() to simplify code
The PCI core caches the "PCIe Max Payload Size Supported" in
pci_dev->pcie_mpss, so use that instead of pcie_capability_read_dword().
Also use pcie_set_readrq() instead of pcie_capability_clear_and_set_word()
to simplify code.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Mark Einon <mark.einon@gmail.com>
-rw-r--r-- | drivers/staging/et131x/et131x.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index f73e58f5ef8d..876881d1826e 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c | |||
@@ -3605,17 +3605,10 @@ static int et131x_pci_init(struct et131x_adapter *adapter, | |||
3605 | goto err_out; | 3605 | goto err_out; |
3606 | } | 3606 | } |
3607 | 3607 | ||
3608 | /* Let's set up the PORT LOGIC Register. First we need to know what | 3608 | /* Let's set up the PORT LOGIC Register. */ |
3609 | * the max_payload_size is | ||
3610 | */ | ||
3611 | if (pcie_capability_read_word(pdev, PCI_EXP_DEVCAP, &max_payload)) { | ||
3612 | dev_err(&pdev->dev, | ||
3613 | "Could not read PCI config space for Max Payload Size\n"); | ||
3614 | goto err_out; | ||
3615 | } | ||
3616 | 3609 | ||
3617 | /* Program the Ack/Nak latency and replay timers */ | 3610 | /* Program the Ack/Nak latency and replay timers */ |
3618 | max_payload &= 0x07; | 3611 | max_payload = pdev->pcie_mpss; |
3619 | 3612 | ||
3620 | if (max_payload < 2) { | 3613 | if (max_payload < 2) { |
3621 | static const u16 acknak[2] = { 0x76, 0xD0 }; | 3614 | static const u16 acknak[2] = { 0x76, 0xD0 }; |
@@ -3645,8 +3638,7 @@ static int et131x_pci_init(struct et131x_adapter *adapter, | |||
3645 | } | 3638 | } |
3646 | 3639 | ||
3647 | /* Change the max read size to 2k */ | 3640 | /* Change the max read size to 2k */ |
3648 | if (pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL, | 3641 | if (pcie_set_readrq(pdev, 2048)) { |
3649 | PCI_EXP_DEVCTL_READRQ, 0x4 << 12)) { | ||
3650 | dev_err(&pdev->dev, | 3642 | dev_err(&pdev->dev, |
3651 | "Couldn't change PCI config space for Max read size\n"); | 3643 | "Couldn't change PCI config space for Max read size\n"); |
3652 | goto err_out; | 3644 | goto err_out; |