PCI: pciehp: Combine adjacent indicator updates
Combine adjacent updates of power and attention indicators into a single pciehp_set_indicators() call. This sends one command to the hotplug controller instead of two. Link: https://lore.kernel.org/r/20190903111021.1559-3-efremov@linux.com Signed-off-by: Denis Efremov <efremov@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Reviewed-by: Lukas Wunner <lukas@wunner.de>
This commit is contained in:
Родитель
688033f52d
Коммит
94719ba090
|
@ -30,7 +30,10 @@
|
|||
|
||||
static void set_slot_off(struct controller *ctrl)
|
||||
{
|
||||
/* turn off slot, turn on Amber LED, turn off Green LED if supported*/
|
||||
/*
|
||||
* Turn off slot, turn on attention indicator, turn off power
|
||||
* indicator
|
||||
*/
|
||||
if (POWER_CTRL(ctrl)) {
|
||||
pciehp_power_off_slot(ctrl);
|
||||
|
||||
|
@ -42,8 +45,8 @@ static void set_slot_off(struct controller *ctrl)
|
|||
msleep(1000);
|
||||
}
|
||||
|
||||
pciehp_green_led_off(ctrl);
|
||||
pciehp_set_attention_status(ctrl, 1);
|
||||
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF,
|
||||
PCI_EXP_SLTCTL_ATTN_IND_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,8 +93,8 @@ static int board_added(struct controller *ctrl)
|
|||
}
|
||||
}
|
||||
|
||||
pciehp_green_led_on(ctrl);
|
||||
pciehp_set_attention_status(ctrl, 0);
|
||||
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON,
|
||||
PCI_EXP_SLTCTL_ATTN_IND_OFF);
|
||||
return 0;
|
||||
|
||||
err_exit:
|
||||
|
@ -171,9 +174,9 @@ void pciehp_handle_button_press(struct controller *ctrl)
|
|||
ctrl_info(ctrl, "Slot(%s) Powering on due to button press\n",
|
||||
slot_name(ctrl));
|
||||
}
|
||||
/* blink green LED and turn off amber */
|
||||
pciehp_green_led_blink(ctrl);
|
||||
pciehp_set_attention_status(ctrl, 0);
|
||||
/* blink power indicator and turn off attention */
|
||||
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_BLINK,
|
||||
PCI_EXP_SLTCTL_ATTN_IND_OFF);
|
||||
schedule_delayed_work(&ctrl->button_work, 5 * HZ);
|
||||
break;
|
||||
case BLINKINGOFF_STATE:
|
||||
|
@ -187,12 +190,13 @@ void pciehp_handle_button_press(struct controller *ctrl)
|
|||
cancel_delayed_work(&ctrl->button_work);
|
||||
if (ctrl->state == BLINKINGOFF_STATE) {
|
||||
ctrl->state = ON_STATE;
|
||||
pciehp_green_led_on(ctrl);
|
||||
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON,
|
||||
PCI_EXP_SLTCTL_ATTN_IND_OFF);
|
||||
} else {
|
||||
ctrl->state = OFF_STATE;
|
||||
pciehp_green_led_off(ctrl);
|
||||
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF,
|
||||
PCI_EXP_SLTCTL_ATTN_IND_OFF);
|
||||
}
|
||||
pciehp_set_attention_status(ctrl, 0);
|
||||
ctrl_info(ctrl, "Slot(%s): Action canceled due to button press\n",
|
||||
slot_name(ctrl));
|
||||
break;
|
||||
|
|
|
@ -674,8 +674,8 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id)
|
|||
if ((events & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) {
|
||||
ctrl->power_fault_detected = 1;
|
||||
ctrl_err(ctrl, "Slot(%s): Power fault\n", slot_name(ctrl));
|
||||
pciehp_set_attention_status(ctrl, 1);
|
||||
pciehp_green_led_off(ctrl);
|
||||
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF,
|
||||
PCI_EXP_SLTCTL_ATTN_IND_ON);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче