linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spinand: Fix build with gcc < 7.5
@ 2025-04-01 13:36 Miquel Raynal
  2025-04-03 10:52 ` Jean Delvare
  2025-04-07  7:16 ` Miquel Raynal
  0 siblings, 2 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-04-01 13:36 UTC (permalink / raw)
  To: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus,
	Pratyush Yadav, Michael Walle, linux-mtd
  Cc: Thomas Petazzoni, linux-kernel, Steam Lin, Jean Delvare,
	Miquel Raynal, kernel test robot, stable

__VA_OPT__ is a macro that is useful when some arguments can be present
or not to entirely skip some part of a definition. Unfortunately, it
is a too recent addition that some of the still supported old GCC
versions do not know about, and is anyway not part of C11 that is the
version used in the kernel.

Find a trick to remove this macro, typically '__VA_ARGS__ + 0' is a
workaround used in netlink.h which works very well here, as we either
expect:
- 0
- A positive value
- No value, which means the field should be 0.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202503181330.YcDXGy7F-lkp@intel.com/
Fixes: 7ce0d16d5802 ("mtd: spinand: Add an optional frequency to read from cache macros")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 include/linux/mtd/spinand.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 83301ef11aa9..0bb06aeffa62 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -67,7 +67,7 @@
 		   SPI_MEM_OP_ADDR(2, addr, 1),				\
 		   SPI_MEM_OP_DUMMY(ndummy, 1),				\
 		   SPI_MEM_OP_DATA_IN(len, buf, 1),			\
-		   __VA_OPT__(SPI_MEM_OP_MAX_FREQ(__VA_ARGS__)))
+		   SPI_MEM_OP_MAX_FREQ(__VA_ARGS__ + 0))
 
 #define SPINAND_PAGE_READ_FROM_CACHE_FAST_1S_1S_1S_OP(addr, ndummy, buf, len) \
 	SPI_MEM_OP(SPI_MEM_OP_CMD(0x0b, 1),				\
-- 
2.48.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spinand: Fix build with gcc < 7.5
  2025-04-01 13:36 [PATCH] mtd: spinand: Fix build with gcc < 7.5 Miquel Raynal
@ 2025-04-03 10:52 ` Jean Delvare
  2025-04-07  7:16 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2025-04-03 10:52 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Vignesh Raghavendra, Tudor Ambarus,
	Pratyush Yadav, Michael Walle, linux-mtd, Thomas Petazzoni,
	linux-kernel, Steam Lin, kernel test robot, stable

On Tue,  1 Apr 2025 15:36:37 +0200, Miquel Raynal wrote:
> __VA_OPT__ is a macro that is useful when some arguments can be present
> or not to entirely skip some part of a definition. Unfortunately, it
> is a too recent addition that some of the still supported old GCC
> versions do not know about, and is anyway not part of C11 that is the
> version used in the kernel.
> 
> Find a trick to remove this macro, typically '__VA_ARGS__ + 0' is a
> workaround used in netlink.h which works very well here, as we either
> expect:
> - 0
> - A positive value
> - No value, which means the field should be 0.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202503181330.YcDXGy7F-lkp@intel.com/
> Fixes: 7ce0d16d5802 ("mtd: spinand: Add an optional frequency to read from cache macros")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Tested-by: Jean Delvare <jdelvare@suse.de>

Thanks Miquel!

-- 
Jean Delvare
SUSE L3 Support

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spinand: Fix build with gcc < 7.5
  2025-04-01 13:36 [PATCH] mtd: spinand: Fix build with gcc < 7.5 Miquel Raynal
  2025-04-03 10:52 ` Jean Delvare
@ 2025-04-07  7:16 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2025-04-07  7:16 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Vignesh Raghavendra, Tudor Ambarus, Pratyush Yadav, Michael Walle,
	linux-mtd, Thomas Petazzoni, linux-kernel, Steam Lin,
	Jean Delvare, kernel test robot, stable

Hello,

On 01/04/2025 at 15:36:37 +02, Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> __VA_OPT__ is a macro that is useful when some arguments can be present
> or not to entirely skip some part of a definition. Unfortunately, it
> is a too recent addition that some of the still supported old GCC
> versions do not know about, and is anyway not part of C11 that is the
> version used in the kernel.
>
> Find a trick to remove this macro, typically '__VA_ARGS__ + 0' is a
> workaround used in netlink.h which works very well here, as we either
> expect:
> - 0
> - A positive value
> - No value, which means the field should be 0.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202503181330.YcDXGy7F-lkp@intel.com/
> Fixes: 7ce0d16d5802 ("mtd: spinand: Add an optional frequency to read from cache macros")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied on top of mtd/fixes with an unrelated conflict resolved.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-07  7:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 13:36 [PATCH] mtd: spinand: Fix build with gcc < 7.5 Miquel Raynal
2025-04-03 10:52 ` Jean Delvare
2025-04-07  7:16 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).