Skip to content

Commit 7da017e

Browse files
visitorckwakpm00
authored andcommitted
test_firmware: use str_true_false() helper
Replace ternary (condition ? "true" : "false") expressions with the str_true_false() helper from string_choices.h. This improves readability by replacing the three-operand ternary with a single function call, ensures consistent string output, and allows potential string deduplication by the linker, resulting in a slightly smaller binary. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kuan-Wei Chiu <[email protected]> Cc: Kuan-Wei Chiu <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9a0ee37 commit 7da017e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/test_firmware.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/kthread.h>
2727
#include <linux/vmalloc.h>
2828
#include <linux/efi_embedded_fw.h>
29+
#include <linux/string_choices.h>
2930

3031
MODULE_IMPORT_NS("TEST_FIRMWARE");
3132

@@ -304,17 +305,17 @@ static ssize_t config_show(struct device *dev,
304305
"FW_ACTION_NOUEVENT");
305306
len += scnprintf(buf + len, PAGE_SIZE - len,
306307
"into_buf:\t\t%s\n",
307-
test_fw_config->into_buf ? "true" : "false");
308+
str_true_false(test_fw_config->into_buf));
308309
len += scnprintf(buf + len, PAGE_SIZE - len,
309310
"buf_size:\t%zu\n", test_fw_config->buf_size);
310311
len += scnprintf(buf + len, PAGE_SIZE - len,
311312
"file_offset:\t%zu\n", test_fw_config->file_offset);
312313
len += scnprintf(buf + len, PAGE_SIZE - len,
313314
"partial:\t\t%s\n",
314-
test_fw_config->partial ? "true" : "false");
315+
str_true_false(test_fw_config->partial));
315316
len += scnprintf(buf + len, PAGE_SIZE - len,
316317
"sync_direct:\t\t%s\n",
317-
test_fw_config->sync_direct ? "true" : "false");
318+
str_true_false(test_fw_config->sync_direct));
318319
len += scnprintf(buf + len, PAGE_SIZE - len,
319320
"read_fw_idx:\t%u\n", test_fw_config->read_fw_idx);
320321
if (test_fw_config->upload_name)

0 commit comments

Comments
 (0)