helpers: Define MIN()

We already have MAX() defined, add MIN() to the common helpers header.

Using the common helper also fixes a bug in tpmdrivers's MIN() where
it was reverted.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* updated the comment about a fixed bug
This commit is contained in:
Alexey Kardashevskiy 2021-01-27 19:36:37 +11:00
parent b7ea243afd
commit b2176a9ce6
3 changed files with 1 additions and 4 deletions

View File

@ -53,5 +53,6 @@ extern unsigned long SLOF_get_vtpm_unit(void);
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define ROUNDUP(x,v) ((((x) + ((v) - 1)) / (v)) * (v))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#endif

View File

@ -43,8 +43,6 @@
#define dprintf(_x ...)
#endif
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static struct {
unsigned tpm_probed:1;
unsigned tpm_found:1;

View File

@ -30,8 +30,6 @@
#define dprintf(_x ...)
#endif
#define MIN(a, b) ((a) > (b) ? (b) : (a))
/* layout of the command request queue for vTPM; all fields are big endian */
struct crq {
uint8_t valid;