Commit 5054133a authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: pciehp: Simplify Attention Button logging

Previously, pressing the Attention Button always logged two lines, the
first from pciehp_ist() and the second from pciehp_handle_button_press():

  Attention button pressed
  Powering on due to button press

Since pciehp_handle_button_press() always logs the more detailed message,
remove the generic "Attention button pressed" message.  Reword the
pciehp_handle_button_press() to be of the form:

  Button press: will power on in 5 sec
  Button press: will power off in 5 sec
  Button press: canceling request to power on
  Button press: canceling request to power off
  Button press: ignoring invalid state %#x

Link: https://lore.kernel.org/r/20230522214051.619337-1-helgaas@kernel.orgSigned-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarLukas Wunner <lukas@wunner.de>
parent ac9a7868
...@@ -166,11 +166,11 @@ void pciehp_handle_button_press(struct controller *ctrl) ...@@ -166,11 +166,11 @@ void pciehp_handle_button_press(struct controller *ctrl)
case ON_STATE: case ON_STATE:
if (ctrl->state == ON_STATE) { if (ctrl->state == ON_STATE) {
ctrl->state = BLINKINGOFF_STATE; ctrl->state = BLINKINGOFF_STATE;
ctrl_info(ctrl, "Slot(%s): Powering off due to button press\n", ctrl_info(ctrl, "Slot(%s): Button press: will power off in 5 sec\n",
slot_name(ctrl)); slot_name(ctrl));
} else { } else {
ctrl->state = BLINKINGON_STATE; ctrl->state = BLINKINGON_STATE;
ctrl_info(ctrl, "Slot(%s) Powering on due to button press\n", ctrl_info(ctrl, "Slot(%s): Button press: will power on in 5 sec\n",
slot_name(ctrl)); slot_name(ctrl));
} }
/* blink power indicator and turn off attention */ /* blink power indicator and turn off attention */
...@@ -185,22 +185,23 @@ void pciehp_handle_button_press(struct controller *ctrl) ...@@ -185,22 +185,23 @@ void pciehp_handle_button_press(struct controller *ctrl)
* press the attention again before the 5 sec. limit * press the attention again before the 5 sec. limit
* expires to cancel hot-add or hot-remove * expires to cancel hot-add or hot-remove
*/ */
ctrl_info(ctrl, "Slot(%s): Button cancel\n", slot_name(ctrl));
cancel_delayed_work(&ctrl->button_work); cancel_delayed_work(&ctrl->button_work);
if (ctrl->state == BLINKINGOFF_STATE) { if (ctrl->state == BLINKINGOFF_STATE) {
ctrl->state = ON_STATE; ctrl->state = ON_STATE;
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON, pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON,
PCI_EXP_SLTCTL_ATTN_IND_OFF); PCI_EXP_SLTCTL_ATTN_IND_OFF);
ctrl_info(ctrl, "Slot(%s): Button press: canceling request to power off\n",
slot_name(ctrl));
} else { } else {
ctrl->state = OFF_STATE; ctrl->state = OFF_STATE;
pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF,
PCI_EXP_SLTCTL_ATTN_IND_OFF); PCI_EXP_SLTCTL_ATTN_IND_OFF);
ctrl_info(ctrl, "Slot(%s): Button press: canceling request to power on\n",
slot_name(ctrl));
} }
ctrl_info(ctrl, "Slot(%s): Action canceled due to button press\n",
slot_name(ctrl));
break; break;
default: default:
ctrl_err(ctrl, "Slot(%s): Ignoring invalid state %#x\n", ctrl_err(ctrl, "Slot(%s): Button press: ignoring invalid state %#x\n",
slot_name(ctrl), ctrl->state); slot_name(ctrl), ctrl->state);
break; break;
} }
......
...@@ -722,11 +722,8 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) ...@@ -722,11 +722,8 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id)
} }
/* Check Attention Button Pressed */ /* Check Attention Button Pressed */
if (events & PCI_EXP_SLTSTA_ABP) { if (events & PCI_EXP_SLTSTA_ABP)
ctrl_info(ctrl, "Slot(%s): Attention button pressed\n",
slot_name(ctrl));
pciehp_handle_button_press(ctrl); pciehp_handle_button_press(ctrl);
}
/* Check Power Fault Detected */ /* Check Power Fault Detected */
if (events & PCI_EXP_SLTSTA_PFD) { if (events & PCI_EXP_SLTSTA_PFD) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment