app: Optimize ipmi complete code
Encapsulate the custom status return code into an ipmi method and
then use it in cpp.
Change-Id: If1ce2bbb1a234c574bc89832dbb87004937d1d38
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/app/channel.cpp b/app/channel.cpp
index efed5c1..ea737d5 100644
--- a/app/channel.cpp
+++ b/app/channel.cpp
@@ -17,6 +17,16 @@
using namespace phosphor::logging;
using namespace sdbusplus::error::xyz::openbmc_project::common;
+namespace ipmi
+{
+constexpr Cc ccPayloadTypeNotSupported = 0x80;
+
+static inline auto responsePayloadTypeNotSupported()
+{
+ return response(ccPayloadTypeNotSupported);
+}
+} // namespace ipmi
+
namespace cipher
{
@@ -131,8 +141,7 @@
if (!ipmi::isValidPayloadType(static_cast<ipmi::PayloadType>(payloadType)))
{
lg2::debug("Get channel cipher suites - Invalid payload type");
- constexpr uint8_t ccPayloadTypeNotSupported = 0x80;
- return ipmi::response(ccPayloadTypeNotSupported);
+ return ipmi::responsePayloadTypeNotSupported();
}
if (!recordInit)