hwpstate_amd(4): Fix BITS_WITH_VALUE()/SET_BITS_VALUE() to obey the mask
While here, rename an argument of BITS_VALUE() to be consistent with the other macros. Reviewed by: aokblast Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54997
This commit is contained in:
@@ -115,9 +115,11 @@
|
||||
|
||||
#define HWP_AMD_CLASSNAME "hwpstate_amd"
|
||||
|
||||
#define BITS_VALUE(bits, num) (((num) & (bits)) >> (ffsll((bits)) - 1))
|
||||
#define BITS_WITH_VALUE(bits, val) ((uintmax_t)(val) << (ffsll((bits)) - 1))
|
||||
#define SET_BITS_VALUE(var, bits, val) \
|
||||
#define BITS_VALUE(bits, val) \
|
||||
(((val) & (bits)) >> (ffsll((bits)) - 1))
|
||||
#define BITS_WITH_VALUE(bits, val) \
|
||||
(((uintmax_t)(val) << (ffsll((bits)) - 1)) & (bits))
|
||||
#define SET_BITS_VALUE(var, bits, val) \
|
||||
((var) = ((var) & ~(bits)) | BITS_WITH_VALUE((bits), (val)))
|
||||
|
||||
#define HWPSTATE_DEBUG(dev, msg...) \
|
||||
|
||||
Reference in New Issue
Block a user