aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Mason <jdmason@kudzu.us>2013-09-11 14:22:39 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-13 20:13:00 -0400
commit29ed74c35088a775807743a5c84eecf6efa85d9f (patch)
treeef8b6b3e22cb04b7404ce343c3cf4866b67627ae
parentc3eb7a771dcd2b27c02f4711545ac6785f66afc5 (diff)
bnx2x: Use pci_dev pm_cap
Use the already existing pm_cap variable in struct pci_dev for determining the power management offset. This saves the driver from having to keep track of an extra variable. Signed-off-by: Jon Mason <jdmason@kudzu.us> Cc: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c8
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c10
4 files changed, 11 insertions, 12 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 0c338026ce01..70b6a05834d1 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1542,7 +1542,6 @@ struct bnx2x {
1542 */ 1542 */
1543 bool fcoe_init; 1543 bool fcoe_init;
1544 1544
1545 int pm_cap;
1546 int mrrs; 1545 int mrrs;
1547 1546
1548 struct delayed_work sp_task; 1547 struct delayed_work sp_task;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 90045c920d09..61726af1de6e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -3008,16 +3008,16 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
3008 u16 pmcsr; 3008 u16 pmcsr;
3009 3009
3010 /* If there is no power capability, silently succeed */ 3010 /* If there is no power capability, silently succeed */
3011 if (!bp->pm_cap) { 3011 if (!bp->pdev->pm_cap) {
3012 BNX2X_DEV_INFO("No power capability. Breaking.\n"); 3012 BNX2X_DEV_INFO("No power capability. Breaking.\n");
3013 return 0; 3013 return 0;
3014 } 3014 }
3015 3015
3016 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmcsr); 3016 pci_read_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL, &pmcsr);
3017 3017
3018 switch (state) { 3018 switch (state) {
3019 case PCI_D0: 3019 case PCI_D0:
3020 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, 3020 pci_write_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL,
3021 ((pmcsr & ~PCI_PM_CTRL_STATE_MASK) | 3021 ((pmcsr & ~PCI_PM_CTRL_STATE_MASK) |
3022 PCI_PM_CTRL_PME_STATUS)); 3022 PCI_PM_CTRL_PME_STATUS));
3023 3023
@@ -3041,7 +3041,7 @@ int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state)
3041 if (bp->wol) 3041 if (bp->wol)
3042 pmcsr |= PCI_PM_CTRL_PME_ENABLE; 3042 pmcsr |= PCI_PM_CTRL_PME_ENABLE;
3043 3043
3044 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, 3044 pci_write_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_CTRL,
3045 pmcsr); 3045 pmcsr);
3046 3046
3047 /* No more memory access after this point until 3047 /* No more memory access after this point until
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 2612e3c715d4..324de5f05332 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1387,9 +1387,9 @@ static bool bnx2x_is_nvm_accessible(struct bnx2x *bp)
1387 u16 pm = 0; 1387 u16 pm = 0;
1388 struct net_device *dev = pci_get_drvdata(bp->pdev); 1388 struct net_device *dev = pci_get_drvdata(bp->pdev);
1389 1389
1390 if (bp->pm_cap) 1390 if (bp->pdev->pm_cap)
1391 rc = pci_read_config_word(bp->pdev, 1391 rc = pci_read_config_word(bp->pdev,
1392 bp->pm_cap + PCI_PM_CTRL, &pm); 1392 bp->pdev->pm_cap + PCI_PM_CTRL, &pm);
1393 1393
1394 if ((rc && !netif_running(dev)) || 1394 if ((rc && !netif_running(dev)) ||
1395 (!rc && ((pm & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0))) 1395 (!rc && ((pm & PCI_PM_CTRL_STATE_MASK) != (__force u16)PCI_D0)))
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 2f8dbbbd7a86..62c59eda1239 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -8652,6 +8652,7 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
8652 else if (bp->wol) { 8652 else if (bp->wol) {
8653 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 8653 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
8654 u8 *mac_addr = bp->dev->dev_addr; 8654 u8 *mac_addr = bp->dev->dev_addr;
8655 struct pci_dev *pdev = bp->pdev;
8655 u32 val; 8656 u32 val;
8656 u16 pmc; 8657 u16 pmc;
8657 8658
@@ -8668,9 +8669,9 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
8668 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val); 8669 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val);
8669 8670
8670 /* Enable the PME and clear the status */ 8671 /* Enable the PME and clear the status */
8671 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmc); 8672 pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &pmc);
8672 pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS; 8673 pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS;
8673 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, pmc); 8674 pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, pmc);
8674 8675
8675 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN; 8676 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN;
8676 8677
@@ -10399,7 +10400,7 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp)
10399 break; 10400 break;
10400 } 10401 }
10401 10402
10402 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_PMC, &pmc); 10403 pci_read_config_word(bp->pdev, bp->pdev->pm_cap + PCI_PM_PMC, &pmc);
10403 bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG; 10404 bp->flags |= (pmc & PCI_PM_CAP_PME_D3cold) ? 0 : NO_WOL_FLAG;
10404 10405
10405 BNX2X_DEV_INFO("%sWoL capable\n", 10406 BNX2X_DEV_INFO("%sWoL capable\n",
@@ -12141,8 +12142,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
12141 } 12142 }
12142 12143
12143 if (IS_PF(bp)) { 12144 if (IS_PF(bp)) {
12144 bp->pm_cap = pdev->pm_cap; 12145 if (!pdev->pm_cap) {
12145 if (bp->pm_cap == 0) {
12146 dev_err(&bp->pdev->dev, 12146 dev_err(&bp->pdev->dev,
12147 "Cannot find power management capability, aborting\n"); 12147 "Cannot find power management capability, aborting\n");
12148 rc = -EIO; 12148 rc = -EIO;