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:   Thu, 23 Feb 2017 22:54:35 -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] PCI, pciehp: Reuse set_slot_off()

Now set_slot_off() is used in board_added() err path.

We could reuse in remove_board.

Also need to move green_led and attention_status out it.
and make code more readable.

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

---
 drivers/pci/hotplug/pciehp_ctrl.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Index: linux-2.6/drivers/pci/hotplug/pciehp_ctrl.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_ctrl.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_ctrl.c
@@ -71,9 +71,6 @@ static void set_slot_off(struct controll
 		 */
 		msleep(1000);
 	}
-
-	pciehp_green_led_off(pslot);
-	pciehp_set_attention_status(pslot, 1);
 }
 
 /**
@@ -126,6 +123,8 @@ static int board_added(struct slot *p_sl
 
 err_exit:
 	set_slot_off(ctrl, p_slot);
+	pciehp_green_led_off(p_slot);
+	pciehp_set_attention_status(p_slot, 1);
 	return retval;
 }
 
@@ -142,16 +141,7 @@ static int remove_board(struct slot *p_s
 	if (retval)
 		return retval;
 
-	if (POWER_CTRL(ctrl)) {
-		pciehp_power_off_slot(p_slot);
-
-		/*
-		 * After turning power off, we must wait for at least 1 second
-		 * before taking any action that relies on power having been
-		 * removed from the slot/adapter.
-		 */
-		msleep(1000);
-	}
+	set_slot_off(ctrl, p_slot);
 
 	/* turn off Green LED */
 	pciehp_green_led_off(p_slot);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ