diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-10-26 17:22:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 19:52:12 -0400 |
commit | d911202e3f722c29065942400ea108b7096bdac7 (patch) | |
tree | 17c0a4c8d2fa36db4469ddb21e7edee29184df74 /arch/um | |
parent | 98c532ecbe582586e204688c6cde7e27580cc43f (diff) |
uml: define CONFIG_NO_DMA
I think that it's better to detect DMA misuse at build time rather than
calling BUG_ON. Architectures that can't do DMA need to define
CONFIG_NO_DMA.
Thanks to Sam Ravnborg for explaining how CONFIG_NO_DMA and CONFIG_HAS_DMA
work:
http://marc.info/?l=linux-kernel&m=128359913825550&w=2
HAS_DMA is defined like this:
config HAS_DMA
boolean
depends on !NO_DMA
default y
So to set HAS_DMA to true an arch should do:
1) Do not define NO_DMA
2) Define NO_DMA abd set it to 'n'
Must archs - including um - used principle 1).
In the um case we want to say that we do NOT have any DMA.
This can be done in two ways.
a) define NO_DMA and set it to 'y'
b) redefine HAS_DMA and set it to 'n'.
The patch you provided used principle b) where other archs use principle a).
So I suggest you should use principle a) for um too.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig.um | 3 | ||||
-rw-r--r-- | arch/um/defconfig | 1 | ||||
-rw-r--r-- | arch/um/include/asm/dma-mapping.h | 112 |
3 files changed, 3 insertions, 113 deletions
diff --git a/arch/um/Kconfig.um b/arch/um/Kconfig.um index ec2b8da1aba4..ffe0934a3ccf 100644 --- a/arch/um/Kconfig.um +++ b/arch/um/Kconfig.um | |||
@@ -147,3 +147,6 @@ config KERNEL_STACK_ORDER | |||
147 | This option determines the size of UML kernel stacks. They will | 147 | This option determines the size of UML kernel stacks. They will |
148 | be 1 << order pages. The default is OK unless you're running Valgrind | 148 | be 1 << order pages. The default is OK unless you're running Valgrind |
149 | on UML, in which case, set this to 3. | 149 | on UML, in which case, set this to 3. |
150 | |||
151 | config NO_DMA | ||
152 | def_bool y | ||
diff --git a/arch/um/defconfig b/arch/um/defconfig index 6bd456f96f90..564f3de65b4a 100644 --- a/arch/um/defconfig +++ b/arch/um/defconfig | |||
@@ -566,7 +566,6 @@ CONFIG_CRC32=m | |||
566 | # CONFIG_CRC7 is not set | 566 | # CONFIG_CRC7 is not set |
567 | # CONFIG_LIBCRC32C is not set | 567 | # CONFIG_LIBCRC32C is not set |
568 | CONFIG_PLIST=y | 568 | CONFIG_PLIST=y |
569 | CONFIG_HAS_DMA=y | ||
570 | 569 | ||
571 | # | 570 | # |
572 | # SCSI device support | 571 | # SCSI device support |
diff --git a/arch/um/include/asm/dma-mapping.h b/arch/um/include/asm/dma-mapping.h deleted file mode 100644 index 1f469e80fdd3..000000000000 --- a/arch/um/include/asm/dma-mapping.h +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | #ifndef _ASM_DMA_MAPPING_H | ||
2 | #define _ASM_DMA_MAPPING_H | ||
3 | |||
4 | #include <asm/scatterlist.h> | ||
5 | |||
6 | static inline int | ||
7 | dma_supported(struct device *dev, u64 mask) | ||
8 | { | ||
9 | BUG(); | ||
10 | return(0); | ||
11 | } | ||
12 | |||
13 | static inline int | ||
14 | dma_set_mask(struct device *dev, u64 dma_mask) | ||
15 | { | ||
16 | BUG(); | ||
17 | return(0); | ||
18 | } | ||
19 | |||
20 | static inline void * | ||
21 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | ||
22 | gfp_t flag) | ||
23 | { | ||
24 | BUG(); | ||
25 | return((void *) 0); | ||
26 | } | ||
27 | |||
28 | static inline void | ||
29 | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | ||
30 | dma_addr_t dma_handle) | ||
31 | { | ||
32 | BUG(); | ||
33 | } | ||
34 | |||
35 | static inline dma_addr_t | ||
36 | dma_map_single(struct device *dev, void *cpu_addr, size_t size, | ||
37 | enum dma_data_direction direction) | ||
38 | { | ||
39 | BUG(); | ||
40 | return(0); | ||
41 | } | ||
42 | |||
43 | static inline void | ||
44 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
45 | enum dma_data_direction direction) | ||
46 | { | ||
47 | BUG(); | ||
48 | } | ||
49 | |||
50 | static inline dma_addr_t | ||
51 | dma_map_page(struct device *dev, struct page *page, | ||
52 | unsigned long offset, size_t size, | ||
53 | enum dma_data_direction direction) | ||
54 | { | ||
55 | BUG(); | ||
56 | return(0); | ||
57 | } | ||
58 | |||
59 | static inline void | ||
60 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
61 | enum dma_data_direction direction) | ||
62 | { | ||
63 | BUG(); | ||
64 | } | ||
65 | |||
66 | static inline int | ||
67 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
68 | enum dma_data_direction direction) | ||
69 | { | ||
70 | BUG(); | ||
71 | return(0); | ||
72 | } | ||
73 | |||
74 | static inline void | ||
75 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
76 | enum dma_data_direction direction) | ||
77 | { | ||
78 | BUG(); | ||
79 | } | ||
80 | |||
81 | static inline void | ||
82 | dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
83 | enum dma_data_direction direction) | ||
84 | { | ||
85 | BUG(); | ||
86 | } | ||
87 | |||
88 | static inline void | ||
89 | dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, | ||
90 | enum dma_data_direction direction) | ||
91 | { | ||
92 | BUG(); | ||
93 | } | ||
94 | |||
95 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | ||
96 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | ||
97 | |||
98 | static inline void | ||
99 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, | ||
100 | enum dma_data_direction direction) | ||
101 | { | ||
102 | BUG(); | ||
103 | } | ||
104 | |||
105 | static inline int | ||
106 | dma_mapping_error(struct device *dev, dma_addr_t dma_handle) | ||
107 | { | ||
108 | BUG(); | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | #endif | ||