/** * remove_board - Turns off slot and LEDs * @p_slot: slot where board is being removed */ static int remove_board(struct slot *p_slot) { int retval = 0; struct controller *ctrl = p_slot->ctrl; retval = pciehp_unconfigure_device(p_slot); if (retval) return retval; dbg("In %s, hp_slot = %d\n", __func__, p_slot->hp_slot); if (POWER_CTRL(ctrl)) { /* power off slot */ retval = p_slot->hpc_ops->power_off_slot(p_slot); if (retval) { err("%s: Issue of Slot Disable command failed\n", __func__); return retval; } } /* * 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); if (PWR_LED(ctrl)) /* turn off Green LED */ p_slot->hpc_ops->green_led_off(p_slot); return 0; }
/** * remove_board - Turns off slot and LED's * */ static int remove_board(struct slot *p_slot) { u8 device; u8 hp_slot; int retval = 0; struct controller *ctrl = p_slot->ctrl; retval = pciehp_unconfigure_device(p_slot); if (retval) return retval; device = p_slot->device; hp_slot = p_slot->device - ctrl->slot_device_offset; p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); if (POWER_CTRL(ctrl->ctrlcap)) { /* power off slot */ retval = p_slot->hpc_ops->power_off_slot(p_slot); if (retval) { err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); return retval; } } if (PWR_LED(ctrl->ctrlcap)) /* turn off Green LED */ p_slot->hpc_ops->green_led_off(p_slot); return 0; }
/** * remove_board - Turns off slot and LEDs * @p_slot: slot where board is being removed */ static int remove_board(struct slot *p_slot) { int retval; struct controller *ctrl = p_slot->ctrl; pm_runtime_get_sync(&ctrl->pcie->port->dev); retval = pciehp_unconfigure_device(p_slot); pm_runtime_put(&ctrl->pcie->port->dev); 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); } /* turn off Green LED */ pciehp_green_led_off(p_slot); return 0; }
/** * remove_board - Turns off slot and LED's * */ static int remove_board(struct slot *p_slot) { u8 device; u8 hp_slot; int rc; struct controller *ctrl = p_slot->ctrl; if (pciehp_unconfigure_device(p_slot)) return 1; device = p_slot->device; hp_slot = p_slot->device - ctrl->slot_device_offset; p_slot = pciehp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot); /* Wait for exclusive access to hardware */ down(&ctrl->crit_sect); if (POWER_CTRL(ctrl->ctrlcap)) { /* power off slot */ rc = p_slot->hpc_ops->power_off_slot(p_slot); if (rc) { err("%s: Issue of Slot Disable command failed\n", __FUNCTION__); up(&ctrl->crit_sect); return rc; } /* Wait for the command to complete */ wait_for_ctrl_irq (ctrl); } if (PWR_LED(ctrl->ctrlcap)) { /* turn off Green LED */ p_slot->hpc_ops->green_led_off(p_slot); /* Wait for the command to complete */ wait_for_ctrl_irq (ctrl); } /* Done with exclusive hardware access */ up(&ctrl->crit_sect); return 0; }