summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-04-06 02:11:22 +0300
committerLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-04-28 23:35:16 +0300
commit94c3a10b94c3ce063d6c1aed3a597f0d524594d5 (patch)
tree0e14c42c0b1ba4ce1e76cca853721b713a802a70
parent913e773241d66646eb7d292bc39e2067c08f11b1 (diff)
downloadbmcweb-94c3a10b94c3ce063d6c1aed3a597f0d524594d5.tar.xz
Cleanup pcie code
Remove unused variable pcieService, fix pciePath and use global variables pciePath and pcieDeviceInterface. Tested: tested PCIeDeviceCollection and PCIeDevice, and tested the changes with the peci-pcie commit https://gerrit.openbmc.org/c/openbmc/peci-pcie/+/62100 Change-Id: Iff8aee3f8bc43740b1885a2da584b0e6cf579dcc Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
-rw-r--r--redfish-core/lib/pcie.hpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index a715acd016..8dc922d1cc 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -31,10 +31,9 @@
namespace redfish
{
-static constexpr char const* pcieService = "xyz.openbmc_project.PCIe";
-static constexpr char const* pciePath = "/xyz/openbmc_project/PCIe";
-static constexpr char const* pcieDeviceInterface =
- "xyz.openbmc_project.Inventory.Item.PCIeDevice";
+static constexpr char const* inventoryPath = "/xyz/openbmc_project/inventory";
+static constexpr std::array<std::string_view, 1> pcieDeviceInterface = {
+ "xyz.openbmc_project.Inventory.Item.PCIeDevice"};
static inline void handlePCIeDevicePath(
const std::string& pcieDeviceId,
@@ -79,11 +78,8 @@ static inline void getValidPCIeDevicePath(
const std::function<void(const std::string& pcieDevicePath,
const std::string& service)>& callback)
{
- constexpr std::array<std::string_view, 1> interfaces{
- "xyz.openbmc_project.Inventory.Item.PCIeDevice"};
-
dbus::utility::getSubTreePaths(
- "/xyz/openbmc_project/inventory", 0, interfaces,
+ inventoryPath, 0, pcieDeviceInterface,
[pcieDeviceId, aResp,
callback](const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse&
@@ -104,7 +100,7 @@ static inline void
const std::string& name)
{
dbus::utility::getSubTreePaths(
- pciePath, 1, {},
+ inventoryPath, 1, {},
[asyncResp, name](const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse&
pcieDevicePaths) {
@@ -166,11 +162,9 @@ static inline void handlePCIeDeviceCollectionGet(
aResp->res.jsonValue["Members"] = nlohmann::json::array();
aResp->res.jsonValue["Members@odata.count"] = 0;
- constexpr std::array<std::string_view, 1> interfaces{
- "xyz.openbmc_project.Inventory.Item.PCIeDevice"};
collection_util::getCollectionMembers(
aResp, boost::urls::url("/redfish/v1/Systems/system/PCIeDevices"),
- interfaces);
+ pcieDeviceInterface);
}
inline void requestRoutesSystemPCIeDeviceCollection(App& app)