Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: can: shell: use shell_fprintf_normal instead of shell_fprintf #77165

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions drivers/can/can_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,41 +90,41 @@

#ifdef CONFIG_CAN_RX_TIMESTAMP
/* Timestamp */
shell_fprintf(sh, SHELL_NORMAL, "(%05d) ", frame->timestamp);
shell_fprintf_normal(sh, "(%05d) ", frame->timestamp);
#endif /* CONFIG_CAN_RX_TIMESTAMP */

shell_fprintf(sh, SHELL_NORMAL, "%s ", dev->name);
shell_fprintf_normal(sh, "%s ", dev->name);

#ifdef CONFIG_CAN_FD_MODE
/* Flags */
shell_fprintf(sh, SHELL_NORMAL, "%c%c ",
(frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B',
(frame->flags & CAN_FRAME_ESI) == 0 ? '-' : 'P');
shell_fprintf_normal(sh, "%c%c ",
(frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B',
(frame->flags & CAN_FRAME_ESI) == 0 ? '-' : 'P');
#endif /* CONFIG_CAN_FD_MODE */

/* CAN ID */
shell_fprintf(sh, SHELL_NORMAL, "%*s%0*x ",
(frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "",
(frame->flags & CAN_FRAME_IDE) != 0 ? 8 : 3,
(frame->flags & CAN_FRAME_IDE) != 0 ?
frame->id & CAN_EXT_ID_MASK : frame->id & CAN_STD_ID_MASK);
shell_fprintf_normal(sh, "%*s%0*x ",
(frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "",
(frame->flags & CAN_FRAME_IDE) != 0 ? 8 : 3,
(frame->flags & CAN_FRAME_IDE) != 0 ?
frame->id & CAN_EXT_ID_MASK : frame->id & CAN_STD_ID_MASK);

/* DLC as number of bytes */
shell_fprintf(sh, SHELL_NORMAL, "%s[%0*d] ",
(frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ",
(frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1,
nbytes);
shell_fprintf_normal(sh, "%s[%0*d] ",
(frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ",
(frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1,
nbytes);

Check notice on line 117 in drivers/can/can_shell.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/can/can_shell.c:117 - shell_fprintf_normal(sh, "%c%c ", - (frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B', + shell_fprintf_normal(sh, "%c%c ", (frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B', (frame->flags & CAN_FRAME_ESI) == 0 ? '-' : 'P'); #endif /* CONFIG_CAN_FD_MODE */ /* CAN ID */ - shell_fprintf_normal(sh, "%*s%0*x ", - (frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "", + shell_fprintf_normal(sh, "%*s%0*x ", (frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "", (frame->flags & CAN_FRAME_IDE) != 0 ? 8 : 3, - (frame->flags & CAN_FRAME_IDE) != 0 ? - frame->id & CAN_EXT_ID_MASK : frame->id & CAN_STD_ID_MASK); + (frame->flags & CAN_FRAME_IDE) != 0 ? frame->id & CAN_EXT_ID_MASK + : frame->id & CAN_STD_ID_MASK); /* DLC as number of bytes */ - shell_fprintf_normal(sh, "%s[%0*d] ", - (frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ", - (frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1, - nbytes); + shell_fprintf_normal(sh, "%s[%0*d] ", (frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ", + (frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1, nbytes);

Check notice on line 117 in drivers/can/can_shell.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/can/can_shell.c:117 - shell_fprintf_normal(sh, "%c%c ", - (frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B', + shell_fprintf_normal(sh, "%c%c ", (frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B', (frame->flags & CAN_FRAME_ESI) == 0 ? '-' : 'P'); #endif /* CONFIG_CAN_FD_MODE */ /* CAN ID */ - shell_fprintf_normal(sh, "%*s%0*x ", - (frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "", + shell_fprintf_normal(sh, "%*s%0*x ", (frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "", (frame->flags & CAN_FRAME_IDE) != 0 ? 8 : 3, - (frame->flags & CAN_FRAME_IDE) != 0 ? - frame->id & CAN_EXT_ID_MASK : frame->id & CAN_STD_ID_MASK); + (frame->flags & CAN_FRAME_IDE) != 0 ? frame->id & CAN_EXT_ID_MASK + : frame->id & CAN_STD_ID_MASK); /* DLC as number of bytes */ - shell_fprintf_normal(sh, "%s[%0*d] ", - (frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ", - (frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1, - nbytes); + shell_fprintf_normal(sh, "%s[%0*d] ", (frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ", + (frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1, nbytes);

Check notice on line 117 in drivers/can/can_shell.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/can/can_shell.c:117 - shell_fprintf_normal(sh, "%c%c ", - (frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B', + shell_fprintf_normal(sh, "%c%c ", (frame->flags & CAN_FRAME_BRS) == 0 ? '-' : 'B', (frame->flags & CAN_FRAME_ESI) == 0 ? '-' : 'P'); #endif /* CONFIG_CAN_FD_MODE */ /* CAN ID */ - shell_fprintf_normal(sh, "%*s%0*x ", - (frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "", + shell_fprintf_normal(sh, "%*s%0*x ", (frame->flags & CAN_FRAME_IDE) != 0 ? 0 : 5, "", (frame->flags & CAN_FRAME_IDE) != 0 ? 8 : 3, - (frame->flags & CAN_FRAME_IDE) != 0 ? - frame->id & CAN_EXT_ID_MASK : frame->id & CAN_STD_ID_MASK); + (frame->flags & CAN_FRAME_IDE) != 0 ? frame->id & CAN_EXT_ID_MASK + : frame->id & CAN_STD_ID_MASK); /* DLC as number of bytes */ - shell_fprintf_normal(sh, "%s[%0*d] ", - (frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ", - (frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1, - nbytes); + shell_fprintf_normal(sh, "%s[%0*d] ", (frame->flags & CAN_FRAME_FDF) != 0 ? "" : " ", + (frame->flags & CAN_FRAME_FDF) != 0 ? 2 : 1, nbytes);
/* Data payload */
if ((frame->flags & CAN_FRAME_RTR) != 0) {
shell_fprintf(sh, SHELL_NORMAL, "remote transmission request");
shell_fprintf_normal(sh, "remote transmission request");
} else {
for (i = 0; i < nbytes; i++) {
shell_fprintf(sh, SHELL_NORMAL, "%02x ", frame->data[i]);
shell_fprintf_normal(sh, "%02x ", frame->data[i]);
}
}

shell_fprintf(sh, SHELL_NORMAL, "\n");
shell_fprintf_normal(sh, "\n");

#ifdef CONFIG_CAN_SHELL_SCRIPTING_FRIENDLY
shell_set_bypass(sh, NULL);
Expand Down Expand Up @@ -262,14 +262,14 @@
/* Lookup symbolic mode name */
for (i = 0; i < ARRAY_SIZE(can_shell_mode_map); i++) {
if (BIT(bit) == can_shell_mode_map[i].mode) {
shell_fprintf(sh, SHELL_NORMAL, "%s ", can_shell_mode_map[i].name);
shell_fprintf_normal(sh, "%s ", can_shell_mode_map[i].name);
break;
}
}

if (i == ARRAY_SIZE(can_shell_mode_map)) {
/* Symbolic name not found, use raw mode */
shell_fprintf(sh, SHELL_NORMAL, "0x%08x ", (can_mode_t)BIT(bit));
shell_fprintf_normal(sh, "0x%08x ", (can_mode_t)BIT(bit));
}
}
}
Expand Down Expand Up @@ -373,13 +373,13 @@
shell_print(sh, "max std filters: %d", max_std_filters);
shell_print(sh, "max ext filters: %d", max_ext_filters);

shell_fprintf(sh, SHELL_NORMAL, "capabilities: normal ");
shell_fprintf_normal(sh, "capabilities: normal ");
can_shell_print_extended_modes(sh, cap);
shell_fprintf(sh, SHELL_NORMAL, "\n");
shell_fprintf_normal(sh, "\n");

shell_fprintf(sh, SHELL_NORMAL, "mode: normal ");
shell_fprintf_normal(sh, "mode: normal ");
can_shell_print_extended_modes(sh, can_get_mode(dev));
shell_fprintf(sh, SHELL_NORMAL, "\n");
shell_fprintf_normal(sh, "\n");

shell_print(sh, "state: %s", can_shell_state_to_string(state));
shell_print(sh, "rx errors: %d", err_cnt.rx_err_cnt);
Expand Down
Loading