pldm: Remove unnecessary type casting in logs

This commit removes the unnecessary type casting of values of the
journal logs based on supported types mentioned in LG2 documentation
[1].

Testing: Verified the debug traces to correct.

'''
For Instance:
Earlier -
error(”TYPE = {TYPE} “, “TYPE”, static_cast<unsigned>(PLDM_STATE_EFFECTER_PDR));
Journal trace -
May 27 08:16:51 p10bmc pldmd[931]: TYPE = 11

After Correction -
error(”TYPE = {TYPE}“, “TYPE”, PLDM_STATE_EFFECTER_PDR);
Journal trace -
May 27 08:16:51 p10bmc pldmd[931]: TYPE = Enum(11)
'''

[1]: https://github.com/openbmc/phosphor-logging/blob/master/docs/structured-logging.md#lg2

Change-Id: Ia649ecd4ecbb73c421f7844885f58a6835805719
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/fw-update/device_updater.cpp b/fw-update/device_updater.cpp
index 738b4af..49b6326 100644
--- a/fw-update/device_updater.cpp
+++ b/fw-update/device_updater.cpp
@@ -52,7 +52,7 @@
         updateManager->instanceIdDb.free(eid, instanceId);
         error(
             "Failed to encode request update request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 
     rc = updateManager->handler.registerRequest(
@@ -63,7 +63,7 @@
         // Handle error scenario
         error(
             "Failed to send request update for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 }
 
@@ -74,7 +74,7 @@
     {
         // Handle error scenario
         error("No response received for request update for endpoint ID '{EID}'",
-              "EID", unsigned(eid));
+              "EID", eid);
         return;
     }
 
@@ -88,14 +88,14 @@
     {
         error(
             "Failed to decode request update response for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return;
     }
     if (completionCode)
     {
         error(
             "Failure in request update response for endpoint ID '{EID}', completion code '{CC}'",
-            "EID", unsigned(eid), "CC", unsigned(completionCode));
+            "EID", eid, "CC", completionCode);
         return;
     }
 
@@ -180,7 +180,7 @@
         updateManager->instanceIdDb.free(eid, instanceId);
         error(
             "Failed to encode pass component table req for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 
     rc = updateManager->handler.registerRequest(
@@ -192,7 +192,7 @@
         // Handle error scenario
         error(
             "Failed to send pass component table request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 }
 
@@ -204,7 +204,7 @@
         // Handle error scenario
         error(
             "No response received for pass component table for endpoint ID '{EID}'",
-            "EID", unsigned(eid));
+            "EID", eid);
         return;
     }
 
@@ -220,7 +220,7 @@
         // Handle error scenario
         error(
             "Failed to decode pass component table response for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return;
     }
     if (completionCode)
@@ -228,7 +228,7 @@
         // Handle error scenario
         error(
             "Failed to pass component table response for endpoint ID '{EID}', completion code '{CC}'",
-            "EID", unsigned(eid), "CC", unsigned(completionCode));
+            "EID", eid, "CC", completionCode);
         return;
     }
     // Handle ComponentResponseCode
@@ -312,7 +312,7 @@
         updateManager->instanceIdDb.free(eid, instanceId);
         error(
             "Failed to encode update component req for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 
     rc = updateManager->handler.registerRequest(
@@ -323,7 +323,7 @@
         // Handle error scenario
         error(
             "Failed to send update request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 }
 
@@ -335,7 +335,7 @@
         // Handle error scenario
         error(
             "No response received for update component with endpoint ID {EID}",
-            "EID", unsigned(eid));
+            "EID", eid);
         return;
     }
 
@@ -353,14 +353,14 @@
     {
         error(
             "Failed to decode update request response for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return;
     }
     if (completionCode)
     {
         error(
             "Failed to update request response for endpoint ID '{EID}', completion code '{CC}'",
-            "EID", unsigned(eid), "CC", unsigned(completionCode));
+            "EID", eid, "CC", completionCode);
         return;
     }
 }
@@ -379,7 +379,7 @@
     {
         error(
             "Failed to decode request firmware date request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         rc = encode_request_firmware_data_resp(
             request->hdr.instance_id, PLDM_ERROR_INVALID_DATA, responseMsg,
             sizeof(completionCode));
@@ -387,7 +387,7 @@
         {
             error(
                 "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
         }
         return response;
     }
@@ -398,7 +398,7 @@
     auto compOffset = std::get<5>(comp);
     auto compSize = std::get<6>(comp);
     info("Decoded fw request data at offset '{OFFSET}' and length '{LENGTH}' ",
-         "OFFSET", unsigned(offset), "LENGTH", unsigned(length));
+         "OFFSET", offset, "LENGTH", length);
     if (length < PLDM_FWUP_BASELINE_TRANSFER_SIZE || length > maxTransferSize)
     {
         rc = encode_request_firmware_data_resp(
@@ -408,7 +408,7 @@
         {
             error(
                 "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
         }
         return response;
     }
@@ -422,7 +422,7 @@
         {
             error(
                 "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
         }
         return response;
     }
@@ -447,7 +447,7 @@
     {
         error(
             "Failed to encode request firmware date response for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return response;
     }
 
@@ -468,7 +468,7 @@
     {
         error(
             "Failed to decode TransferComplete request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         rc = encode_transfer_complete_resp(request->hdr.instance_id,
                                            PLDM_ERROR_INVALID_DATA, responseMsg,
                                            sizeof(completionCode));
@@ -476,7 +476,7 @@
         {
             error(
                 "Failed to encode TransferComplete response for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
         }
         return response;
     }
@@ -490,14 +490,14 @@
     {
         info(
             "Component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' transfer complete.",
-            "EID", unsigned(eid), "COMPONENT_VERSION", compVersion);
+            "EID", eid, "COMPONENT_VERSION", compVersion);
     }
     else
     {
         error(
             "Failure in transfer of the component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' with transfer result - {RESULT}",
-            "EID", unsigned(eid), "COMPONENT_VERSION", compVersion, "RESULT",
-            unsigned(transferResult));
+            "EID", eid, "COMPONENT_VERSION", compVersion, "RESULT",
+            transferResult);
     }
 
     rc = encode_transfer_complete_resp(request->hdr.instance_id, completionCode,
@@ -506,7 +506,7 @@
     {
         error(
             "Failed to encode transfer complete response of endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return response;
     }
 
@@ -526,7 +526,7 @@
     {
         error(
             "Failed to decode verify complete request of endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         rc = encode_verify_complete_resp(request->hdr.instance_id,
                                          PLDM_ERROR_INVALID_DATA, responseMsg,
                                          sizeof(completionCode));
@@ -534,7 +534,7 @@
         {
             error(
                 "Failed to encode verify complete response of endpoint ID '{EID}', response code '{RC}'.",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
         }
         return response;
     }
@@ -548,14 +548,14 @@
     {
         info(
             "Component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' verification complete.",
-            "EID", unsigned(eid), "COMPONENT_VERSION", compVersion);
+            "EID", eid, "COMPONENT_VERSION", compVersion);
     }
     else
     {
         error(
             "Failed to verify component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' with transfer result - '{RESULT}'",
-            "EID", unsigned(eid), "COMPONENT_VERSION", compVersion, "RESULT",
-            unsigned(verifyResult));
+            "EID", eid, "COMPONENT_VERSION", compVersion, "RESULT",
+            verifyResult);
     }
 
     rc = encode_verify_complete_resp(request->hdr.instance_id, completionCode,
@@ -564,7 +564,7 @@
     {
         error(
             "Failed to encode verify complete response for endpoint ID '{EID}', response code - {RC}",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return response;
     }
 
@@ -586,7 +586,7 @@
     {
         error(
             "Failed to decode apply complete request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         rc = encode_apply_complete_resp(request->hdr.instance_id,
                                         PLDM_ERROR_INVALID_DATA, responseMsg,
                                         sizeof(completionCode));
@@ -594,7 +594,7 @@
         {
             error(
                 "Failed to encode apply complete response for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
         }
         return response;
     }
@@ -609,15 +609,14 @@
     {
         info(
             "Component endpoint ID '{EID}' with '{COMPONENT_VERSION}' apply complete.",
-            "EID", unsigned(eid), "COMPONENT_VERSION", compVersion);
+            "EID", eid, "COMPONENT_VERSION", compVersion);
         updateManager->updateActivationProgress();
     }
     else
     {
         error(
             "Failed to apply component endpoint ID '{EID}' and version '{COMPONENT_VERSION}', error - {ERROR}",
-            "EID", unsigned(eid), "COMPONENT_VERSION", compVersion, "ERROR",
-            unsigned(applyResult));
+            "EID", eid, "COMPONENT_VERSION", compVersion, "ERROR", applyResult);
     }
 
     rc = encode_apply_complete_resp(request->hdr.instance_id, completionCode,
@@ -626,7 +625,7 @@
     {
         error(
             "Failed to encode apply complete response for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return response;
     }
 
@@ -665,7 +664,7 @@
         updateManager->instanceIdDb.free(eid, instanceId);
         error(
             "Failed to encode activate firmware req for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 
     rc = updateManager->handler.registerRequest(
@@ -675,7 +674,7 @@
     {
         error(
             "Failed to send activate firmware request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 }
 
diff --git a/fw-update/inventory_manager.cpp b/fw-update/inventory_manager.cpp
index b8f86ea..f341f28 100644
--- a/fw-update/inventory_manager.cpp
+++ b/fw-update/inventory_manager.cpp
@@ -30,7 +30,7 @@
             instanceIdDb.free(eid, instanceId);
             error(
                 "Failed to encode query device identifiers req for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
             continue;
         }
 
@@ -43,7 +43,7 @@
         {
             error(
                 "Failed to send query device identifiers request for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
         }
     }
 }
@@ -56,7 +56,7 @@
     {
         error(
             "No response received for query device identifiers for endpoint ID '{EID}'",
-            "EID", unsigned(eid));
+            "EID", eid);
         return;
     }
 
@@ -72,8 +72,7 @@
     {
         error(
             "Failed to decode query device identifiers response for endpoint ID '{EID}' and descriptor count '{DESCRIPTOR_COUNT}', response code '{RC}'",
-            "EID", unsigned(eid), "DESCRIPTOR_COUNT", descriptorCount, "RC",
-            rc);
+            "EID", eid, "DESCRIPTOR_COUNT", descriptorCount, "RC", rc);
         return;
     }
 
@@ -81,7 +80,7 @@
     {
         error(
             "Failed to query device identifiers response for endpoint ID '{EID}', completion code '{CC}'",
-            "EID", unsigned(eid), "CC", unsigned(completionCode));
+            "EID", eid, "CC", completionCode);
         return;
     }
 
@@ -99,7 +98,7 @@
             error(
                 "Failed to decode descriptor type {TYPE}, length {LENGTH} and value for endpoint ID '{EID}', response code '{RC}'",
                 "TYPE", descriptorType, "LENGTH", deviceIdentifiersLen, "EID",
-                unsigned(eid), "RC", rc);
+                eid, "RC", rc);
             return;
         }
 
@@ -123,7 +122,7 @@
             {
                 error(
                     "Failed to decode vendor-defined descriptor value for endpoint ID '{EID}', response code '{RC}'",
-                    "EID", unsigned(eid), "RC", rc);
+                    "EID", eid, "RC", rc);
                 return;
             }
 
@@ -164,7 +163,7 @@
         instanceIdDb.free(eid, instanceId);
         error(
             "Failed to encode get firmware parameters req for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return;
     }
 
@@ -177,7 +176,7 @@
     {
         error(
             "Failed to send get firmware parameters request for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
     }
 }
 
@@ -189,7 +188,7 @@
     {
         error(
             "No response received for get firmware parameters for endpoint ID '{EID}'",
-            "EID", unsigned(eid));
+            "EID", eid);
         descriptorMap.erase(eid);
         return;
     }
@@ -206,15 +205,16 @@
     {
         error(
             "Failed to decode get firmware parameters response for endpoint ID '{EID}', response code '{RC}'",
-            "EID", unsigned(eid), "RC", rc);
+            "EID", eid, "RC", rc);
         return;
     }
 
     if (fwParams.completion_code)
     {
+        auto fw_param_cc = fwParams.completion_code;
         error(
             "Failed to get firmware parameters response for endpoint ID '{EID}', completion code '{CC}'",
-            "EID", unsigned(eid), "CC", unsigned(fwParams.completion_code));
+            "EID", eid, "CC", fw_param_cc);
         return;
     }
 
@@ -234,7 +234,7 @@
         {
             error(
                 "Failed to decode component parameter table entry for endpoint ID '{EID}', response code '{RC}'",
-                "EID", unsigned(eid), "RC", rc);
+                "EID", eid, "RC", rc);
             return;
         }
 
diff --git a/fw-update/update_manager.cpp b/fw-update/update_manager.cpp
index 428613b..2567996 100644
--- a/fw-update/update_manager.cpp
+++ b/fw-update/update_manager.cpp
@@ -57,7 +57,7 @@
     {
         error(
             "Failed to open the PLDM fw update package file '{FILE}', error - {ERROR}.",
-            "ERROR", unsigned(errno), "FILE", packageFilePath.c_str());
+            "ERROR", errno, "FILE", packageFilePath);
         package.close();
         std::filesystem::remove(packageFilePath);
         return -1;