[PATCH] PCI: pciehp_hpc: Fix set raw indicator status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Set raw indicator status interface has been designed to respect bits
responsible for Attention and Power Indicator Control [1]. But since
abaaac4845a0 ("PCI: hotplug: Use FIELD_GET/PREP()") only processes
Attention Indicator Control bits.

Mentioned change replace direct bit shift, via macro FIELD_PREP, which
additionally performs an AND operation with the passed bitmask. The
regression results from an incorrect bitmask, the mask should include bits
responsible for Attention and Power Indicator Control, but only Attention
Indicator Control was passed. This lead to a loss of passed bits
responsible for Power Indicator control.

This fix restores Power Indicator Control bits support.

[1] 576243b3f9ea ("PCI: pciehp: Allow exclusive userspace control of indicators")

Fixes: abaaac4845a0 ("PCI: hotplug: Use FIELD_GET/PREP()")
Signed-off-by: Blazej Kucman <blazej.kucman@xxxxxxxxx>
---
 drivers/pci/hotplug/pciehp_hpc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 061f01f60db4..736ad8baa2a5 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -485,7 +485,9 @@ int pciehp_set_raw_indicator_status(struct hotplug_slot *hotplug_slot,
 	struct pci_dev *pdev = ctrl_dev(ctrl);
 
 	pci_config_pm_runtime_get(pdev);
-	pcie_write_cmd_nowait(ctrl, FIELD_PREP(PCI_EXP_SLTCTL_AIC, status),
+
+	/* Attention and Power Indicator Control bits are supported */
+	pcie_write_cmd_nowait(ctrl, FIELD_PREP(PCI_EXP_SLTCTL_AIC | PCI_EXP_SLTCTL_PIC, status),
 			      PCI_EXP_SLTCTL_AIC | PCI_EXP_SLTCTL_PIC);
 	pci_config_pm_runtime_put(pdev);
 	return 0;
-- 
2.35.3





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux