From: James Clark <james.clark@linaro.org>
To: hch@lst.de
Cc: olteanv@gmail.com, broonie@kernel.org,
oe-kbuild-all@lists.linux.dev, arnd@arndb.de,
larisa.grigore@nxp.com, Frank.li@nxp.com,
linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org,
James Clark <james.clark@linaro.org>,
kernel test robot <lkp@intel.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
iommu@lists.linux.dev
Subject: [PATCH] dma-mapping: Stub out dma_{alloc,free,map}_pages() API
Date: Mon, 16 Jun 2025 12:17:49 +0100 [thread overview]
Message-ID: <20250616111749.316413-1-james.clark@linaro.org> (raw)
In-Reply-To: <202506160036.t9VDxF6p-lkp@intel.com>
The implementations are in mapping.c which requires HAS_DMA so stub them
out if not present. This is required for some drivers to pass randconfig
builds.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506160036.t9VDxF6p-lkp@intel.com/
Signed-off-by: James Clark <james.clark@linaro.org>
---
include/linux/dma-mapping.h | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 55c03e5fe8cb..766f28a0e11f 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -161,6 +161,12 @@ void *dma_vmap_noncontiguous(struct device *dev, size_t size,
void dma_vunmap_noncontiguous(struct device *dev, void *vaddr);
int dma_mmap_noncontiguous(struct device *dev, struct vm_area_struct *vma,
size_t size, struct sg_table *sgt);
+struct page *dma_alloc_pages(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp);
+void dma_free_pages(struct device *dev, size_t size, struct page *page,
+ dma_addr_t dma_handle, enum dma_data_direction dir);
+int dma_mmap_pages(struct device *dev, struct vm_area_struct *vma,
+ size_t size, struct page *page);
#else /* CONFIG_HAS_DMA */
static inline dma_addr_t dma_map_page_attrs(struct device *dev,
struct page *page, size_t offset, size_t size,
@@ -291,6 +297,21 @@ static inline int dma_mmap_noncontiguous(struct device *dev,
{
return -EINVAL;
}
+static inline struct page *dma_alloc_pages(struct device *dev, size_t size,
+ dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp)
+{
+ return NULL;
+}
+static inline void dma_free_pages(struct device *dev, size_t size,
+ struct page *page, dma_addr_t dma_handle,
+ enum dma_data_direction dir)
+{
+}
+static inline int dma_mmap_pages(struct device *dev, struct vm_area_struct *vma,
+ size_t size, struct page *page)
+{
+ return -EINVAL;
+}
#endif /* CONFIG_HAS_DMA */
#ifdef CONFIG_IOMMU_DMA
@@ -438,13 +459,6 @@ static inline bool dma_need_unmap(struct device *dev)
}
#endif /* !CONFIG_HAS_DMA || !CONFIG_DMA_NEED_SYNC */
-struct page *dma_alloc_pages(struct device *dev, size_t size,
- dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp);
-void dma_free_pages(struct device *dev, size_t size, struct page *page,
- dma_addr_t dma_handle, enum dma_data_direction dir);
-int dma_mmap_pages(struct device *dev, struct vm_area_struct *vma,
- size_t size, struct page *page);
-
static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp)
{
--
2.34.1
next prev parent reply other threads:[~2025-06-16 11:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 9:28 [PATCH v2 0/5] spi: spi-fsl-dspi: Target mode improvements James Clark
2025-06-13 9:28 ` [PATCH v2 1/5] spi: spi-fsl-dspi: Clear completion counter before initiating transfer James Clark
2025-06-13 9:28 ` [PATCH v2 2/5] spi: spi-fsl-dspi: Use non-coherent memory for DMA James Clark
2025-06-15 16:31 ` kernel test robot
2025-06-16 11:17 ` James Clark [this message]
2025-06-16 11:21 ` [PATCH] dma-mapping: Stub out dma_{alloc,free,map}_pages() API James Clark
2025-06-16 11:28 ` Arnd Bergmann
2025-06-16 11:29 ` Christoph Hellwig
2025-06-16 12:06 ` Mark Brown
2025-06-16 12:08 ` Christoph Hellwig
2025-06-16 12:11 ` Mark Brown
2025-06-16 12:14 ` Christoph Hellwig
2025-06-16 13:05 ` Mark Brown
2025-06-16 13:12 ` Christoph Hellwig
2025-06-16 13:10 ` James Clark
2025-06-16 13:13 ` Christoph Hellwig
2025-06-16 13:14 ` James Clark
2025-06-16 13:15 ` James Clark
2025-06-16 13:19 ` Christoph Hellwig
2025-06-16 13:23 ` James Clark
2025-06-16 13:48 ` Arnd Bergmann
2025-06-16 18:33 ` Arnd Bergmann
2025-06-17 4:48 ` Christoph Hellwig
2025-06-17 7:53 ` Arnd Bergmann
2025-06-17 8:26 ` Arnd Bergmann
2025-06-17 15:55 ` Jason Gunthorpe
2025-06-16 11:56 ` [PATCH v2 2/5] spi: spi-fsl-dspi: Use non-coherent memory for DMA Robin Murphy
2025-06-16 13:06 ` James Clark
2025-06-13 9:28 ` [PATCH v2 3/5] spi: spi-fsl-dspi: Increase DMA buffer size James Clark
2025-06-13 9:28 ` [PATCH v2 4/5] spi: spi-fsl-dspi: Store status directly in cur_msg->status James Clark
2025-06-13 9:29 ` [PATCH v2 5/5] spi: spi-fsl-dspi: Report FIFO overflows as errors James Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250616111749.316413-1-james.clark@linaro.org \
--to=james.clark@linaro.org \
--cc=Frank.li@nxp.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=hch@lst.de \
--cc=imx@lists.linux.dev \
--cc=iommu@lists.linux.dev \
--cc=larisa.grigore@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lkp@intel.com \
--cc=m.szyprowski@samsung.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=olteanv@gmail.com \
--cc=robin.murphy@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox