Skip to content

Commit f29ab49

Browse files
geertuChristoph Hellwig
authored andcommitted
dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy
If NO_DMA=y, get_dma_ops() returns a reference to the non-existing symbol bad_dma_ops, thus causing a link failure if it is ever used. Make get_dma_ops() return NULL instead, to avoid the link failure. This allows to improve compile-testing, and limits the need to keep on sprinkling dependencies on HAS_DMA all over the place. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Mark Brown <[email protected]> Acked-by: Robin Murphy <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 0c8efd6 commit f29ab49

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/linux/dma-mapping.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ static inline void set_dma_ops(struct device *dev,
212212
}
213213
#else
214214
/*
215-
* Define the dma api to allow compilation but not linking of
216-
* dma dependent code. Code that depends on the dma-mapping
217-
* API needs to set 'depends on HAS_DMA' in its Kconfig
215+
* Define the dma api to allow compilation of dma dependent code.
216+
* Code that depends on the dma-mapping API needs to set 'depends on HAS_DMA'
217+
* in its Kconfig, unless it already depends on <something> || COMPILE_TEST,
218+
* where <something> guarantuees the availability of the dma-mapping API.
218219
*/
219-
extern const struct dma_map_ops bad_dma_ops;
220220
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
221221
{
222-
return &bad_dma_ops;
222+
return NULL;
223223
}
224224
#endif
225225

0 commit comments

Comments
 (0)