GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / sparc / include / asm / dma-mapping.h
blob8c0e4f7bb20484a674f663f30bf34789be6877d9
1 #ifndef ___ASM_SPARC_DMA_MAPPING_H
2 #define ___ASM_SPARC_DMA_MAPPING_H
4 #include <linux/scatterlist.h>
5 #include <linux/mm.h>
6 #include <linux/dma-debug.h>
8 #define DMA_ERROR_CODE (~(dma_addr_t)0x0)
10 extern int dma_supported(struct device *dev, u64 mask);
12 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
13 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
15 extern struct dma_map_ops *dma_ops, pci32_dma_ops;
16 extern struct bus_type pci_bus_type;
18 static inline struct dma_map_ops *get_dma_ops(struct device *dev)
20 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
21 if (dev->bus == &pci_bus_type)
22 return &pci32_dma_ops;
23 #endif
24 return dma_ops;
27 #include <asm-generic/dma-mapping-common.h>
29 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
30 dma_addr_t *dma_handle, gfp_t flag)
32 struct dma_map_ops *ops = get_dma_ops(dev);
33 void *cpu_addr;
35 cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag);
36 debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);
37 return cpu_addr;
40 static inline void dma_free_coherent(struct device *dev, size_t size,
41 void *cpu_addr, dma_addr_t dma_handle)
43 struct dma_map_ops *ops = get_dma_ops(dev);
45 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
46 ops->free_coherent(dev, size, cpu_addr, dma_handle);
49 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
51 return (dma_addr == DMA_ERROR_CODE);
54 static inline int dma_set_mask(struct device *dev, u64 mask)
56 #ifdef CONFIG_PCI
57 if (dev->bus == &pci_bus_type) {
58 if (!dev->dma_mask || !dma_supported(dev, mask))
59 return -EINVAL;
60 *dev->dma_mask = mask;
61 return 0;
63 #endif
64 return -EINVAL;
67 #endif