commonlib/clamp.h: Relicense file to be BSD-compatible
I added this header in commit a6c8b4becb
(nb/intel/sandybridge: Rewrite get_FRQ). Relicense it as "BSD-3-Clause
OR GPL-2.0-or-later" and move it into the BSD-licensed commonlib part.
Change-Id: I89ebdcdf8d06e78e624e37a443696981b3b17b7d
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66711
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
03f6820194
commit
c826ba419f
2 changed files with 5 additions and 5 deletions
22
src/commonlib/bsd/include/commonlib/bsd/clamp.h
Normal file
22
src/commonlib/bsd/include/commonlib/bsd/clamp.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
|
||||
|
||||
#ifndef COMMONLIB_BSD_CLAMP_H
|
||||
#define COMMONLIB_BSD_CLAMP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Clamp a value, so that it is between a lower and an upper bound.
|
||||
*/
|
||||
static inline u32 clamp_u32(const u32 min, const u32 val, const u32 max)
|
||||
{
|
||||
if (val > max)
|
||||
return max;
|
||||
|
||||
if (val < min)
|
||||
return min;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
#endif /* COMMONLIB_BSD_CLAMP_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue