History

PCI: pciehp: Remove pciehp_set_attention_status()

Remove pciehp_set_attention_status() and use pciehp_set_indicators() instead, since the code is mostly the same.

Denis Efremov committed 7 years ago

Commit 106feb21 parent 94719ba4 files · +8 −28Browse files

Unified · Split

4 files
  1. drivers/pci/hotplug/pciehp.h +0 −1
  2. drivers/pci/hotplug/pciehp_core.c +7 −2
  3. drivers/pci/hotplug/pciehp_hpc.c +0 −25
  4. include/uapi/linux/pci_regs.h +1 −0
drivers/pci/hotplug/pciehp.h+0−1
@@ -170,7 +170,6 @@ void pciehp_get_power_status(struct controller *ctrl, u8 *status); · 169 unmodified lines
170170 #define INDICATOR_NOOP -1 /* Leave indicator unchanged */
171171 void pciehp_set_indicators(struct controller *ctrl, int pwr, int attn);
172172
173−void pciehp_set_attention_status(struct controller *ctrl, u8 status);
174173 void pciehp_get_latch_status(struct controller *ctrl, u8 *status);
175174 int pciehp_query_power_fault(struct controller *ctrl);
176175 void pciehp_green_led_on(struct controller *ctrl);
drivers/pci/hotplug/pciehp_core.c+7−2
@@ -95,15 +95,20 @@ static void cleanup_slot(struct controller *ctrl) · 94 unmodified lines
9595 }
9696
9797 /*
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
9999 */
100100 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
101101 {
102102 struct controller *ctrl = to_ctrl(hotplug_slot);
103103 struct pci_dev *pdev = ctrl->pcie->port;
104104
105+ if (status)
106+ status <<= PCI_EXP_SLTCTL_ATTN_IND_SHIFT;
107+ else
108+ status = PCI_EXP_SLTCTL_ATTN_IND_OFF;
109+
105110 pci_config_pm_runtime_get(pdev);
106− pciehp_set_attention_status(ctrl, status);
111+ pciehp_set_indicators(ctrl, INDICATOR_NOOP, status);
107112 pci_config_pm_runtime_put(pdev);
108113 return 0;
109114 }
drivers/pci/hotplug/pciehp_hpc.c+0−25
@@ -418,31 +418,6 @@ int pciehp_set_raw_indicator_status(struct hotplug_slot *hotplug_slot, · 417 unmodified lines
418418 return 0;
419419 }
420420
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−
446421 /**
447422 * pciehp_set_indicators() - set attention indicator, power indicator, or both
448423 * @ctrl: PCIe hotplug controller
include/uapi/linux/pci_regs.h+1−0
@@ -591,6 +591,7 @@ · 590 unmodified lines
591591 #define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */
592592 #define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */
593593 #define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */
594+#define PCI_EXP_SLTCTL_ATTN_IND_SHIFT 6 /* Attention Indicator shift */
594595 #define PCI_EXP_SLTCTL_ATTN_IND_ON 0x0040 /* Attention Indicator on */
595596 #define PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */
596597 #define PCI_EXP_SLTCTL_ATTN_IND_OFF 0x00c0 /* Attention Indicator off */