Skip to content

Commit 6aca050

Browse files
borntraegermstsirkin
authored andcommitted
alpha/dma: use common noop dma ops
Some of the alpha pci noop dma ops are identical to the common ones. Use them. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent a8463d4 commit 6aca050

File tree

1 file changed

+4
-42
lines changed

1 file changed

+4
-42
lines changed

arch/alpha/kernel/pci-noop.c

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -123,55 +123,17 @@ static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
123123
return ret;
124124
}
125125

126-
static void alpha_noop_free_coherent(struct device *dev, size_t size,
127-
void *cpu_addr, dma_addr_t dma_addr,
128-
struct dma_attrs *attrs)
129-
{
130-
free_pages((unsigned long)cpu_addr, get_order(size));
131-
}
132-
133-
static dma_addr_t alpha_noop_map_page(struct device *dev, struct page *page,
134-
unsigned long offset, size_t size,
135-
enum dma_data_direction dir,
136-
struct dma_attrs *attrs)
137-
{
138-
return page_to_pa(page) + offset;
139-
}
140-
141-
static int alpha_noop_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
142-
enum dma_data_direction dir, struct dma_attrs *attrs)
143-
{
144-
int i;
145-
struct scatterlist *sg;
146-
147-
for_each_sg(sgl, sg, nents, i) {
148-
void *va;
149-
150-
BUG_ON(!sg_page(sg));
151-
va = sg_virt(sg);
152-
sg_dma_address(sg) = (dma_addr_t)virt_to_phys(va);
153-
sg_dma_len(sg) = sg->length;
154-
}
155-
156-
return nents;
157-
}
158-
159-
static int alpha_noop_mapping_error(struct device *dev, dma_addr_t dma_addr)
160-
{
161-
return 0;
162-
}
163-
164126
static int alpha_noop_supported(struct device *dev, u64 mask)
165127
{
166128
return mask < 0x00ffffffUL ? 0 : 1;
167129
}
168130

169131
struct dma_map_ops alpha_noop_ops = {
170132
.alloc = alpha_noop_alloc_coherent,
171-
.free = alpha_noop_free_coherent,
172-
.map_page = alpha_noop_map_page,
173-
.map_sg = alpha_noop_map_sg,
174-
.mapping_error = alpha_noop_mapping_error,
133+
.free = dma_noop_free_coherent,
134+
.map_page = dma_noop_map_page,
135+
.map_sg = dma_noop_map_sg,
136+
.mapping_error = dma_noop_mapping_error,
175137
.dma_supported = alpha_noop_supported,
176138
};
177139

0 commit comments

Comments
 (0)