Re: [PATCH v4 3/5] efi/cper: Add a new helper function to print bitmasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 05 Aug 2025 11:35:40 -0700
Daniel Ferguson <danielf@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> From: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> 

oops.  That was probably my mess up.  Please fix that ; to : and
put it in the right place.

> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
> Acked-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux