diff mbox series

[01/13] helpers: Define MIN()

Message ID 20210127085752.120571-2-aik@ozlabs.ru
State Superseded
Headers show
Series Compile with -Wextra | expand

Commit Message

Alexey Kardashevskiy Jan. 27, 2021, 8:57 a.m. UTC
We already have MAX() defined, add MIN() to the common helpers header.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 include/helpers.h        | 1 +
 lib/libtpm/tcgbios.c     | 2 --
 lib/libtpm/tpm_drivers.c | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)

Comments

Thomas Huth Jan. 27, 2021, 12:35 p.m. UTC | #1
On 27/01/2021 09.57, Alexey Kardashevskiy wrote:
> We already have MAX() defined, add MIN() to the common helpers header.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>   include/helpers.h        | 1 +
>   lib/libtpm/tcgbios.c     | 2 --
>   lib/libtpm/tpm_drivers.c | 2 --
>   3 files changed, 1 insertion(+), 4 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>
David Gibson Jan. 28, 2021, 12:25 a.m. UTC | #2
On Wed, Jan 27, 2021 at 07:57:40PM +1100, Alexey Kardashevskiy wrote:
> We already have MAX() defined, add MIN() to the common helpers header.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  include/helpers.h        | 1 +
>  lib/libtpm/tcgbios.c     | 2 --
>  lib/libtpm/tpm_drivers.c | 2 --
>  3 files changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/include/helpers.h b/include/helpers.h
> index 112184f203f0..898c02cf524b 100644
> --- a/include/helpers.h
> +++ b/include/helpers.h
> @@ -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
> diff --git a/lib/libtpm/tcgbios.c b/lib/libtpm/tcgbios.c
> index ee052e102092..8e808115bc59 100644
> --- a/lib/libtpm/tcgbios.c
> +++ b/lib/libtpm/tcgbios.c
> @@ -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;
> diff --git a/lib/libtpm/tpm_drivers.c b/lib/libtpm/tpm_drivers.c
> index 50051767a13a..0e13561d0fa0 100644
> --- a/lib/libtpm/tpm_drivers.c
> +++ b/lib/libtpm/tpm_drivers.c
> @@ -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;
diff mbox series

Patch

diff --git a/include/helpers.h b/include/helpers.h
index 112184f203f0..898c02cf524b 100644
--- a/include/helpers.h
+++ b/include/helpers.h
@@ -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
diff --git a/lib/libtpm/tcgbios.c b/lib/libtpm/tcgbios.c
index ee052e102092..8e808115bc59 100644
--- a/lib/libtpm/tcgbios.c
+++ b/lib/libtpm/tcgbios.c
@@ -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;
diff --git a/lib/libtpm/tpm_drivers.c b/lib/libtpm/tpm_drivers.c
index 50051767a13a..0e13561d0fa0 100644
--- a/lib/libtpm/tpm_drivers.c
+++ b/lib/libtpm/tpm_drivers.c
@@ -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;