Remove pciehp_set_attention_status() and use pciehp_set_indicators() instead, since the code is mostly the same.
Unified · Split
| @@ -170,7 +170,6 @@ void pciehp_get_power_status(struct controller *ctrl, u8 *status); · 169 unmodified lines | ||
| 170 | 170 | #define INDICATOR_NOOP -1 /* Leave indicator unchanged */ |
| 171 | 171 | void pciehp_set_indicators(struct controller *ctrl, int pwr, int attn); |
| 172 | 172 | |
| 173 | −void pciehp_set_attention_status(struct controller *ctrl, u8 status); | |
| 174 | 173 | void pciehp_get_latch_status(struct controller *ctrl, u8 *status); |
| 175 | 174 | int pciehp_query_power_fault(struct controller *ctrl); |
| 176 | 175 | void pciehp_green_led_on(struct controller *ctrl); |
| @@ -95,15 +95,20 @@ static void cleanup_slot(struct controller *ctrl) · 94 unmodified lines | ||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | − * set_attention_status - Turns the Amber LED for a slot on, off or blink | |
| 98 | + * set_attention_status - Turns the Attention Indicator on, off or blinking | |
| 99 | 99 | */ |
| 100 | 100 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) |
| 101 | 101 | { |
| 102 | 102 | struct controller *ctrl = to_ctrl(hotplug_slot); |
| 103 | 103 | struct pci_dev *pdev = ctrl->pcie->port; |
| 104 | 104 | |
| 105 | + if (status) | |
| 106 | + status <<= PCI_EXP_SLTCTL_ATTN_IND_SHIFT; | |
| 107 | + else | |
| 108 | + status = PCI_EXP_SLTCTL_ATTN_IND_OFF; | |
| 109 | + | |
| 105 | 110 | pci_config_pm_runtime_get(pdev); |
| 106 | − pciehp_set_attention_status(ctrl, status); | |
| 111 | + pciehp_set_indicators(ctrl, INDICATOR_NOOP, status); | |
| 107 | 112 | pci_config_pm_runtime_put(pdev); |
| 108 | 113 | return 0; |
| 109 | 114 | } |
| @@ -418,31 +418,6 @@ int pciehp_set_raw_indicator_status(struct hotplug_slot *hotplug_slot, · 417 unmodified lines | ||
| 418 | 418 | return 0; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | −void pciehp_set_attention_status(struct controller *ctrl, u8 value) | |
| 422 | −{ | |
| 423 | − u16 slot_cmd; | |
| 424 | − | |
| 425 | − if (!ATTN_LED(ctrl)) | |
| 426 | − return; | |
| 427 | − | |
| 428 | − switch (value) { | |
| 429 | − case 0: /* turn off */ | |
| 430 | − slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF; | |
| 431 | − break; | |
| 432 | − case 1: /* turn on */ | |
| 433 | − slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_ON; | |
| 434 | − break; | |
| 435 | − case 2: /* turn blink */ | |
| 436 | − slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_BLINK; | |
| 437 | − break; | |
| 438 | − default: | |
| 439 | − return; | |
| 440 | − } | |
| 441 | − pcie_write_cmd_nowait(ctrl, slot_cmd, PCI_EXP_SLTCTL_AIC); | |
| 442 | − ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, | |
| 443 | − pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, slot_cmd); | |
| 444 | −} | |
| 445 | − | |
| 446 | 421 | /** |
| 447 | 422 | * pciehp_set_indicators() - set attention indicator, power indicator, or both |
| 448 | 423 | * @ctrl: PCIe hotplug controller |
| @@ -591,6 +591,7 @@ · 590 unmodified lines | ||
| 591 | 591 | #define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */ |
| 592 | 592 | #define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */ |
| 593 | 593 | #define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */ |
| 594 | +#define PCI_EXP_SLTCTL_ATTN_IND_SHIFT 6 /* Attention Indicator shift */ | |
| 594 | 595 | #define PCI_EXP_SLTCTL_ATTN_IND_ON 0x0040 /* Attention Indicator on */ |
| 595 | 596 | #define PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */ |
| 596 | 597 | #define PCI_EXP_SLTCTL_ATTN_IND_OFF 0x00c0 /* Attention Indicator off */ |