Skip to content

Commit

Permalink
dma-mapping: move arch_dma_set_mask() declaration to header
Browse files Browse the repository at this point in the history
This function has a __weak definition and an override that is only used on
freescale powerpc chips. The powerpc definition however does not see the
declaration that is in a .c file:

arch/powerpc/kernel/dma-mask.c:7:6: error: no previous prototype for 'arch_dma_set_mask' [-Werror=missing-prototypes]

Move it into the linux/dma-map-ops.h header where the other arch_dma_* functions
are declared.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Arnd Bergmann authored and Christoph Hellwig committed Jul 31, 2023
1 parent 42e584a commit 3d6f126
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/kernel/dma-mask.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0

#include <linux/dma-mapping.h>
#include <linux/dma-map-ops.h>
#include <linux/export.h>
#include <asm/machdep.h>

Expand Down
6 changes: 6 additions & 0 deletions include/linux/dma-map-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t dma_addr, unsigned long attrs);

#ifdef CONFIG_ARCH_HAS_DMA_SET_MASK
void arch_dma_set_mask(struct device *dev, u64 mask);
#else
#define arch_dma_set_mask(dev, mask) do { } while (0)
#endif

#ifdef CONFIG_MMU
/*
* Page protection so that devices that can't snoop CPU caches can use the
Expand Down
6 changes: 0 additions & 6 deletions kernel/dma/mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,12 +760,6 @@ bool dma_pci_p2pdma_supported(struct device *dev)
}
EXPORT_SYMBOL_GPL(dma_pci_p2pdma_supported);

#ifdef CONFIG_ARCH_HAS_DMA_SET_MASK
void arch_dma_set_mask(struct device *dev, u64 mask);
#else
#define arch_dma_set_mask(dev, mask) do { } while (0)
#endif

int dma_set_mask(struct device *dev, u64 mask)
{
/*
Expand Down

0 comments on commit 3d6f126

Please sign in to comment.