* [PATCH] dma-mapping: avoid potential unused data compilation warning [not found] <CGME20250415075716eucas1p1a5343f5dec617f82f5adca300eb47485@eucas1p1.samsung.com> @ 2025-04-15 7:56 ` Marek Szyprowski 2025-04-15 9:39 ` Andy Shevchenko 0 siblings, 1 reply; 3+ messages in thread From: Marek Szyprowski @ 2025-04-15 7:56 UTC (permalink / raw) To: iommu, linux-kernel Cc: Marek Szyprowski, Christoph Hellwig, Robin Murphy, netdev, Jakub Kicinski, Andy Shevchenko When CONFIG_NEED_DMA_MAP_STATE is not defined, dma-mapping clients might report unused data compilation warnings for dma_unmap_*() calls arguments. Redefine macros for those calls to let compiler to notice that it is okay when the provided arguments are not used. Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Suggested-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- include/linux/dma-mapping.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index b79925b1c433..85ab710ec0e7 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -629,10 +629,14 @@ static inline int dma_mmap_wc(struct device *dev, #else #define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) #define DEFINE_DMA_UNMAP_LEN(LEN_NAME) -#define dma_unmap_addr(PTR, ADDR_NAME) (0) -#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) -#define dma_unmap_len(PTR, LEN_NAME) (0) -#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) +#define dma_unmap_addr(PTR, ADDR_NAME) \ + ({ typeof(PTR) __p __maybe_unused = PTR; 0; }) +#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) \ + do { typeof(PTR) __p __maybe_unused = PTR; } while (0) +#define dma_unmap_len(PTR, LEN_NAME) \ + ({ typeof(PTR) __p __maybe_unused = PTR; 0; }) +#define dma_unmap_len_set(PTR, LEN_NAME, VAL) \ + do { typeof(PTR) __p __maybe_unused = PTR; } while (0) #endif #endif /* _LINUX_DMA_MAPPING_H */ -- 2.34.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dma-mapping: avoid potential unused data compilation warning 2025-04-15 7:56 ` [PATCH] dma-mapping: avoid potential unused data compilation warning Marek Szyprowski @ 2025-04-15 9:39 ` Andy Shevchenko 2025-04-18 6:19 ` Marek Szyprowski 0 siblings, 1 reply; 3+ messages in thread From: Andy Shevchenko @ 2025-04-15 9:39 UTC (permalink / raw) To: Marek Szyprowski Cc: iommu, linux-kernel, Christoph Hellwig, Robin Murphy, netdev, Jakub Kicinski On Tue, Apr 15, 2025 at 09:56:59AM +0200, Marek Szyprowski wrote: > When CONFIG_NEED_DMA_MAP_STATE is not defined, dma-mapping clients might > report unused data compilation warnings for dma_unmap_*() calls > arguments. Redefine macros for those calls to let compiler to notice that > it is okay when the provided arguments are not used. Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (GCC on default i386_defconfig with `make W=1` on v6.15-rc2) -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dma-mapping: avoid potential unused data compilation warning 2025-04-15 9:39 ` Andy Shevchenko @ 2025-04-18 6:19 ` Marek Szyprowski 0 siblings, 0 replies; 3+ messages in thread From: Marek Szyprowski @ 2025-04-18 6:19 UTC (permalink / raw) To: Andy Shevchenko Cc: iommu, linux-kernel, Christoph Hellwig, Robin Murphy, netdev, Jakub Kicinski On 15.04.2025 11:39, Andy Shevchenko wrote: > On Tue, Apr 15, 2025 at 09:56:59AM +0200, Marek Szyprowski wrote: >> When CONFIG_NEED_DMA_MAP_STATE is not defined, dma-mapping clients might >> report unused data compilation warnings for dma_unmap_*() calls >> arguments. Redefine macros for those calls to let compiler to notice that >> it is okay when the provided arguments are not used. > Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > (GCC on default i386_defconfig with `make W=1` on v6.15-rc2) Applied to dma-mapping-fixes branch. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-18 6:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20250415075716eucas1p1a5343f5dec617f82f5adca300eb47485@eucas1p1.samsung.com>
2025-04-15 7:56 ` [PATCH] dma-mapping: avoid potential unused data compilation warning Marek Szyprowski
2025-04-15 9:39 ` Andy Shevchenko
2025-04-18 6:19 ` Marek Szyprowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox