Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/20250814095033.244034-1-visitorckw@gmail.com
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Cc: Kuan-Wei Chiu <visitorckw@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kuan-Wei Chiu and committed by
Andrew Morton
7da017ea 9a0ee378

+4 -3
+4 -3
lib/test_firmware.c
··· 26 26 #include <linux/kthread.h> 27 27 #include <linux/vmalloc.h> 28 28 #include <linux/efi_embedded_fw.h> 29 + #include <linux/string_choices.h> 29 30 30 31 MODULE_IMPORT_NS("TEST_FIRMWARE"); 31 32 ··· 305 304 "FW_ACTION_NOUEVENT"); 306 305 len += scnprintf(buf + len, PAGE_SIZE - len, 307 306 "into_buf:\t\t%s\n", 308 - test_fw_config->into_buf ? "true" : "false"); 307 + str_true_false(test_fw_config->into_buf)); 309 308 len += scnprintf(buf + len, PAGE_SIZE - len, 310 309 "buf_size:\t%zu\n", test_fw_config->buf_size); 311 310 len += scnprintf(buf + len, PAGE_SIZE - len, 312 311 "file_offset:\t%zu\n", test_fw_config->file_offset); 313 312 len += scnprintf(buf + len, PAGE_SIZE - len, 314 313 "partial:\t\t%s\n", 315 - test_fw_config->partial ? "true" : "false"); 314 + str_true_false(test_fw_config->partial)); 316 315 len += scnprintf(buf + len, PAGE_SIZE - len, 317 316 "sync_direct:\t\t%s\n", 318 - test_fw_config->sync_direct ? "true" : "false"); 317 + str_true_false(test_fw_config->sync_direct)); 319 318 len += scnprintf(buf + len, PAGE_SIZE - len, 320 319 "read_fw_idx:\t%u\n", test_fw_config->read_fw_idx); 321 320 if (test_fw_config->upload_name)