summaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_hpc.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-12-15 17:23:54 -0700
committerBjorn Helgaas <bhelgaas@google.com>2013-12-15 18:00:00 -0700
commitaf9ab791e34147952a8b97c998fa257d8292c5d6 (patch)
treeb449d89e5635d37cc310edce104511b847547dcb /drivers/pci/hotplug/pciehp_hpc.c
parente7b4f0d7841b188423b641cab71d20b1a05234e9 (diff)
downloadop-kernel-dev-af9ab791e34147952a8b97c998fa257d8292c5d6.zip
op-kernel-dev-af9ab791e34147952a8b97c998fa257d8292c5d6.tar.gz
PCI: pciehp: Move Attention & Power Indicator support tests to accessors
Previously, the caller checked ATTN_LED() or PWR_LED() to see whether the slot has indicators before setting the indicator state. That clutters the caller unnecessarily, so this moves the test inside the callees. The test may not even be necessary; per spec it should be harmless to try to turn on a non-existent LED. But checking first does avoid unnecessary hotplug commands. No functional change. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 05d421c..14acfcc 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -418,6 +418,9 @@ void pciehp_set_attention_status(struct slot *slot, u8 value)
struct controller *ctrl = slot->ctrl;
u16 slot_cmd;
+ if (!ATTN_LED(ctrl))
+ return;
+
switch (value) {
case 0 : /* turn off */
slot_cmd = PCI_EXP_SLTCTL_ATTN_IND_OFF;
@@ -440,6 +443,9 @@ void pciehp_green_led_on(struct slot *slot)
{
struct controller *ctrl = slot->ctrl;
+ if (!PWR_LED(ctrl))
+ return;
+
pcie_write_cmd(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON, PCI_EXP_SLTCTL_PIC);
ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL,
@@ -450,6 +456,9 @@ void pciehp_green_led_off(struct slot *slot)
{
struct controller *ctrl = slot->ctrl;
+ if (!PWR_LED(ctrl))
+ return;
+
pcie_write_cmd(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, PCI_EXP_SLTCTL_PIC);
ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL,
@@ -460,6 +469,9 @@ void pciehp_green_led_blink(struct slot *slot)
{
struct controller *ctrl = slot->ctrl;
+ if (!PWR_LED(ctrl))
+ return;
+
pcie_write_cmd(ctrl, PCI_EXP_SLTCTL_PWR_IND_BLINK, PCI_EXP_SLTCTL_PIC);
ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__,
pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL,
OpenPOWER on IntegriCloud