[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 10/16] pcie: pcie_cap_slot_enable_power() use correct helper
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v4 10/16] pcie: pcie_cap_slot_enable_power() use correct helper |
Date: |
Mon, 13 Feb 2023 17:00:57 +0300 |
*_by_mask() helpers shouldn't be used here (and that's the only one).
*_by_mask() helpers do shift their value argument, but in pcie.c code
we use values that are already shifted appropriately.
Happily, PCI_EXP_SLTCTL_PWR_ON is zero, so shift doesn't matter. But if
we apply same helper for PCI_EXP_SLTCTL_PWR_OFF constant it will do
wrong thing.
So, let's use instead pci_word_test_and_clear_mask() which is already
used in the file to clear PCI_EXP_SLTCTL_PWR_OFF bit in
pcie_cap_slot_init() and pcie_cap_slot_reset().
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
hw/pci/pcie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index ccdb2377e1..db8360226f 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -373,8 +373,8 @@ void pcie_cap_slot_enable_power(PCIDevice *dev)
uint32_t sltcap = pci_get_long(exp_cap + PCI_EXP_SLTCAP);
if (sltcap & PCI_EXP_SLTCAP_PCP) {
- pci_set_word_by_mask(exp_cap + PCI_EXP_SLTCTL,
- PCI_EXP_SLTCTL_PCC, PCI_EXP_SLTCTL_PWR_ON);
+ pci_word_test_and_clear_mask(exp_cap + PCI_EXP_SLTCTL,
+ PCI_EXP_SLTCTL_PCC);
}
}
--
2.34.1
- [PATCH v4 00/16] pci hotplug tracking, Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 02/16] pci/shpc: change shpc_get_status() return type to uint8_t, Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 06/16] pci/shpc: refactor shpc_device_plug_common(), Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 03/16] pci/shpc: shpc_slot_command(): handle PWRONLY -> ENABLED transition, Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 07/16] pcie: pcie_cap_slot_write_config(): use correct macro, Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 10/16] pcie: pcie_cap_slot_enable_power() use correct helper,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v4 01/16] pci/shpc: set attention led to OFF on reset, Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 04/16] pci/shpc: more generic handle hot-unplug in shpc_slot_command(), Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 05/16] pci/shpc: pass PCIDevice pointer to shpc_slot_command(), Vladimir Sementsov-Ogievskiy, 2023/02/13
- [PATCH v4 14/16] qapi: deprecate "device" field of DEVICE_* events, Vladimir Sementsov-Ogievskiy, 2023/02/13