diff options
| author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2025-08-14 09:52:54 -0700 |
|---|---|---|
| committer | Ard Biesheuvel <ardb@kernel.org> | 2025-11-21 09:42:02 +0100 |
| commit | a976d790f49499ccaa0f991788ad8ebf92e7fd5c (patch) | |
| tree | a8d49c59286bdb51e8e50dc86c2cd4b19d5212bb /rust/helpers/helpers.c | |
| parent | 8ad2c72e21efb3dc76c5b14089fa7984cdd87898 (diff) | |
efi/cper: Add a new helper function to print bitmasks
Add a helper function to print a string with names associated
to each bit field.
A typical example is:
const char * const bits[] = {
"bit 3 name",
"bit 4 name",
"bit 5 name",
};
char str[120];
unsigned int bitmask = BIT(3) | BIT(5);
#define MASK GENMASK(5,3)
cper_bits_to_str(str, sizeof(str), FIELD_GET(MASK, bitmask),
bits, ARRAY_SIZE(bits));
The above code fills string "str" with "bit 3 name|bit 5 name".
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions
