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>] [day] [month] [year] [list]
Date:   Thu, 23 Feb 2017 13:37:47 -0800
From:   Yinghai Lu <yinghai@...nel.org>
To:     Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     Ashok Raj <ashok.raj@...el.com>,
        james puthukattukaran <james.puthukattukaran@...cle.com>,
        Yinghai Lu <yinghai.lu@...cle.com>, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org, Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH -v2] PCI,pciehp: Not write linkctrl register if val is not changed

Most system have port link enabled by default, and should not
have confusing printout.

Also move printout before actully write, so could make debug print in order.

-v2: inline __pciehp_link_set into pciehp_link_enable

Signed-off-by: Yinghai Lu <yinghai@...nel.org>

---
 drivers/pci/hotplug/pciehp_hpc.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
@@ -333,28 +333,23 @@ int pciehp_check_link_status(struct cont
 	return 0;
 }
 
-static int __pciehp_link_set(struct controller *ctrl, bool enable)
+static int pciehp_link_enable(struct controller *ctrl)
 {
 	struct pci_dev *pdev = ctrl_dev(ctrl);
-	u16 lnk_ctrl;
+	u16 lnk_ctrl, old_lnk_ctrl;
 
 	pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &lnk_ctrl);
+	old_lnk_ctrl = lnk_ctrl;
 
-	if (enable)
-		lnk_ctrl &= ~PCI_EXP_LNKCTL_LD;
-	else
-		lnk_ctrl |= PCI_EXP_LNKCTL_LD;
+	lnk_ctrl &= ~PCI_EXP_LNKCTL_LD;
+	if (old_lnk_ctrl == lnk_ctrl)
+		return 0;
 
-	pcie_capability_write_word(pdev, PCI_EXP_LNKCTL, lnk_ctrl);
 	ctrl_dbg(ctrl, "%s: lnk_ctrl = %x\n", __func__, lnk_ctrl);
+	pcie_capability_write_word(pdev, PCI_EXP_LNKCTL, lnk_ctrl);
 	return 0;
 }
 
-static int pciehp_link_enable(struct controller *ctrl)
-{
-	return __pciehp_link_set(ctrl, true);
-}
-
 int pciehp_get_raw_indicator_status(struct hotplug_slot *hotplug_slot,
 				    u8 *status)
 {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ