Skip to content

Commit

Permalink
wdc: Review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: jeff-lien-wdc <[email protected]>
  • Loading branch information
jeff-lien-sndk committed Mar 13, 2024
1 parent d21dc8d commit 07982bd
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions plugins/wdc/wdc-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -5606,14 +5606,14 @@ static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries,

uint64_t timestamp = (0x0000FFFFFFFFFFFF &
le64_to_cpu(fw_act_history_entry->entry[entryIdx].timestamp));
__u64 timestamp_sec = le64_to_cpu(timestamp) / 1000;
__u64 timestamp_sec = timestamp / 1000;
if (cust_id == WDC_CUSTOMER_ID_0x1005) {
printf(" ");
memset((void *)time_str, 0, 9);
sprintf((char *)time_str, "%04d:%02d:%02d",
(int)(le64_to_cpu(timestamp_sec)/3600),
(int)((le64_to_cpu(timestamp_sec%3600)/60)),
(int)(le64_to_cpu(timestamp_sec%60)));
(int)(timestamp_sec/3600),
(int)(timestamp_sec%3600/60),
(int)(timestamp_sec%60));

printf("%s", time_str);
printf(" ");
Expand All @@ -5622,9 +5622,9 @@ static void wdc_print_fw_act_history_log_normal(__u8 *data, int num_entries,

memset((void *)time_str, 0, 9);
sprintf((char *)time_str, "%04d:%02d:%02d",
(int)((le64_to_cpu(timestamp_sec)/3600)%24),
(int)((le64_to_cpu(timestamp_sec)/60)%60),
(int)(le64_to_cpu(timestamp_sec)%60));
(int)((timestamp_sec/3600)%24),
(int)((timestamp_sec/60)%60),
(int)(timestamp_sec%60));
printf("%s", time_str);
printf(" ");
} else {
Expand Down Expand Up @@ -5781,20 +5781,20 @@ static void wdc_print_fw_act_history_log_json(__u8 *data, int num_entries,

uint64_t timestamp = (0x0000FFFFFFFFFFFF &
le64_to_cpu(fw_act_history_entry->entry[entryIdx].timestamp));
__u64 timestamp_sec = le64_to_cpu(timestamp)/1000;
__u64 timestamp_sec = timestamp / 1000;
if (cust_id == WDC_CUSTOMER_ID_0x1005) {
sprintf((char *)time_str, "%04d:%02d:%02d",
(int)(le64_to_cpu(timestamp_sec)/3600),
(int)((le64_to_cpu(timestamp_sec)%3600/60)),
(int)(le64_to_cpu(timestamp_sec)%60));
(int)(timestamp_sec/3600),
(int)(timestamp_sec%3600/60),
(int)(timestamp_sec%60));

json_object_add_value_string(root, "Power on Hour", time_str);

} else if (vendor_id == WDC_NVME_SNDK_VID) {
sprintf((char *)time_str, "%04d:%02d:%02d",
(int)((le64_to_cpu(timestamp_sec)/3600)%24),
(int)((le64_to_cpu(timestamp_sec)/60)%60),
(int)(le64_to_cpu(timestamp_sec)%60));
(int)((timestamp_sec/3600)%24),
(int)((timestamp_sec/60)%60),
(int)(timestamp_sec%60));
json_object_add_value_string(root, "Power on Hour", time_str);
} else {
json_object_add_value_uint64(root, "Timestamp", timestamp);
Expand Down Expand Up @@ -9063,7 +9063,6 @@ static int wdc_get_fw_act_history_C2(nvme_root_t r, struct nvme_dev *dev,
enum nvme_print_flags fmt;
__u8 *data;
int ret;
int i;
bool c2GuidMatch = false;

if (!wdc_check_device(r, dev))
Expand Down Expand Up @@ -9096,15 +9095,7 @@ static int wdc_get_fw_act_history_C2(nvme_root_t r, struct nvme_dev *dev,
/* Get the log page data and verify the GUID */
fw_act_history_log = (struct wdc_fw_act_history_log_format_c2 *)(data);

for (i = 0; i < 16; i++) {
if (ocp_C2_guid[i] != fw_act_history_log->log_page_guid[i]) {
c2GuidMatch = false;
break;
}
}

if (i == 16)
c2GuidMatch = true;
c2GuidMatch = !memcmp(ocp_C2_guid, fw_act_history_log->log_page_guid, WDC_C2_GUID_LENGTH);

Check failure on line 9098 in plugins/wdc/wdc-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 106 exceeds 100 columns

if (c2GuidMatch) {
/* parse the data */
Expand Down Expand Up @@ -9195,7 +9186,7 @@ static int wdc_vs_fw_activate_history(int argc, char **argv, struct command *com
ret = wdc_get_fw_act_history_C2(r, dev, cfg.output_format);
else
ret = wdc_get_fw_act_history(r, dev, cfg.output_format);
} else if (capabilities & WDC_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2 {
} else if (capabilities & WDC_DRIVE_CAP_FW_ACTIVATE_HISTORY_C2) {
ret = wdc_get_fw_act_history_C2(r, dev, cfg.output_format);
}

Expand Down

0 comments on commit 07982bd

Please sign in to comment.