Subject: linux-next: build failure after merge of the crypto tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 12 Aug 2024 10:42:35 +1000

Hi all,

After merging the crypto tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/crypto/dwc-spacc/spacc_manager.c:5: error: "MIN" redefined [-Werror]
    5 | #define MIN(x, y) (((x) < (y)) ? (x) : (y))
      | 
In file included from include/linux/kernel.h:28,
                 from include/linux/interrupt.h:6,
                 from drivers/crypto/dwc-spacc/spacc_core.h:7,
                 from drivers/crypto/dwc-spacc/spacc_manager.c:3:
include/linux/minmax.h:329: note: this is the location of the previous definition
  329 | #define MIN(a,b) __cmp(min,a,b)
      | 
cc1: all warnings being treated as errors

Caused by commit

  c8981d9230d8 ("crypto: spacc - Add SPAcc Skcipher support")

interacting with commit

  1a251f52cfdc ("minmax: make generic MIN() and MAX() macros available everywhere")

from Linus' tree (in v6.11-rc2).

I applied the following merge fix patch.  I added the include of
minmax.h just in case it was not included implicitly for some other
build config.

From: Stephen Rothwell <[email-masked]>
Date: Mon, 12 Aug 2024 10:36:30 +1000
Subject: [PATCH] fixup for "crypto: spacc - Add SPAcc Skcipher support"

interacting with commit

  1a251f52cfdc ("minmax: make generic MIN() and MAX() macros available everywhere")

from Linus' tree.

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/crypto/dwc-spacc/spacc_manager.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/dwc-spacc/spacc_manager.c b/drivers/crypto/dwc-spacc/spacc_manager.c
index 3b26b27a998f..67c4360334e2 100644
--- a/drivers/crypto/dwc-spacc/spacc_manager.c
+++ b/drivers/crypto/dwc-spacc/spacc_manager.c
@@ -1,9 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 
+#include <linux/minmax.h>
 #include "spacc_core.h"
 
-#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-
 /* prevent reading past the end of the buffer */
 static void read_from_buf(unsigned char *dst, unsigned char *src,
 			  int off, int n, int max)
-- 
2.43.0

-- 
Cheers,
Stephen Rothwell