lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 24 Feb 2014 15:34:03 -0700
From:	Jon Mason <jdmason@...zu.us>
To:	netdev@...r.kernel.org
Cc:	Tristram Ha <Tristram.Ha@...rel.com>
Subject: [RFC 1/3] ksz884x: Use pci_set_power_state() for setting PM states

Use the existing infrastructure of pci_set_power_state() instead of
setting the relevant bits via PCI config read/write in the driver.
Also, use pci_pme_active() to set the PCI_PM_CTRL_PME_ENABLE bit in PCI
PM control register.  pci_set_power_state() and pci_pme_active() perform
the same operations as the driver did before, so there should be no
functional change.  That being said, this has not been tested.

Signed-off-by: Jon Mason <jdmason@...zu.us>
Cc: Tristram Ha <Tristram.Ha@...rel.com>
---
 drivers/net/ethernet/micrel/ksz884x.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index ce84dc2..d658231 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -3524,17 +3524,17 @@ static void hw_cfg_wol_pme(struct ksz_hw *hw, int set)
 {
 	struct dev_info *hw_priv = container_of(hw, struct dev_info, hw);
 	struct pci_dev *pdev = hw_priv->pdev;
-	u16 data;
 
 	if (!pdev->pm_cap)
 		return;
-	pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &data);
-	data &= ~PCI_PM_CTRL_STATE_MASK;
-	if (set)
-		data |= PCI_PM_CTRL_PME_ENABLE | PCI_D3hot;
-	else
-		data &= ~PCI_PM_CTRL_PME_ENABLE;
-	pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, data);
+
+	if (set) {
+		pci_pme_active(pdev, true);
+		pci_set_power_state(pdev, PCI_D3hot);
+	} else {
+		pci_pme_active(pdev, false);
+		pci_set_power_state(pdev, PCI_D0);
+	}
 }
 
 /**
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ