Subject: [PATCH] PCI, pciehp: clean and reuse set_slot_off Move out led setting, and reuse it in remove_board. Signed-off-by: Yinghai Lu --- drivers/pci/hotplug/pciehp_ctrl.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 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 @@ -60,7 +60,7 @@ void pciehp_queue_interrupt_event(struct static void set_slot_off(struct controller *ctrl, struct slot *pslot) { - /* turn off slot, turn on Amber LED, turn off Green LED if supported*/ + /* turn off slot if supported*/ if (POWER_CTRL(ctrl)) { pciehp_power_off_slot(pslot); @@ -71,9 +71,6 @@ static void set_slot_off(struct controll */ msleep(1000); } - - pciehp_green_led_off(pslot); - pciehp_set_attention_status(pslot, 1); } /** @@ -129,6 +126,9 @@ static int board_added(struct slot *p_sl err_exit: pm_runtime_put(&ctrl->pcie->port->dev); set_slot_off(ctrl, p_slot); + /* turn on Amber LED, turn off Green LED */ + pciehp_green_led_off(p_slot); + pciehp_set_attention_status(p_slot, 1); return retval; } @@ -147,16 +147,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);