aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/dma.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 19:40:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-30 19:40:18 -0500
commit94ed294c20ef07fffa40817c68155fba35dd67f1 (patch)
tree672cb304bd6440e681daeff2d04f753dc43dd2e4 /drivers/ieee1394/dma.c
parent5bdeae46be6dfe9efa44a548bd622af325f4bdb4 (diff)
parent384170da9384b7bb3650c0c9b9d17ba0f7bde4ff (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: (26 commits) firewire: fw-sbp2: Use sbp2 device-provided mgt orb timeout for logins firewire: fw-sbp2: increase login orb reply timeout, fix "failed to login" firewire: replace subtraction with bitwise and firewire: fw-core: react on bus resets while the config ROM is being fetched firewire: enforce access order between generation and node ID, fix "giving up on config rom" firewire: fw-cdev: use device generation, not card generation firewire: fw-sbp2: use device generation, not card generation firewire: fw-sbp2: try to increase reconnect_hold (speed up reconnection) firewire: fw-sbp2: skip unnecessary logout firewire vs. ieee1394: clarify MAINTAINERS firewire: fw-ohci: Dynamically allocate buffers for DMA descriptors firewire: fw-ohci: CycleTooLong interrupt management firewire: Fix extraction of source node id firewire: fw-ohci: Bug fixes for packet-per-buffer support firewire: fw-ohci: Fix for dualbuffer three-or-more buffers firewire: fw-sbp2: remove unused misleading macro firewire: fw-sbp2: prepare for s/g chaining firewire: fw-sbp2: refactor workq and kref handling ieee1394: ohci1394: don't schedule IT tasklets on IR events ieee1394: sbp2: raise default transfer size limit ...
Diffstat (limited to 'drivers/ieee1394/dma.c')
-rw-r--r--drivers/ieee1394/dma.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
index 7c4eb39b7024..73685e7dc7e4 100644
--- a/drivers/ieee1394/dma.c
+++ b/drivers/ieee1394/dma.c
@@ -231,37 +231,24 @@ void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset,
231 231
232#ifdef CONFIG_MMU 232#ifdef CONFIG_MMU
233 233
234/* nopage() handler for mmap access */ 234static int dma_region_pagefault(struct vm_area_struct *vma,
235 235 struct vm_fault *vmf)
236static struct page *dma_region_pagefault(struct vm_area_struct *area,
237 unsigned long address, int *type)
238{ 236{
239 unsigned long offset; 237 struct dma_region *dma = (struct dma_region *)vma->vm_private_data;
240 unsigned long kernel_virt_addr;
241 struct page *ret = NOPAGE_SIGBUS;
242
243 struct dma_region *dma = (struct dma_region *)area->vm_private_data;
244 238
245 if (!dma->kvirt) 239 if (!dma->kvirt)
246 goto out; 240 return VM_FAULT_SIGBUS;
247 241
248 if ((address < (unsigned long)area->vm_start) || 242 if (vmf->pgoff >= dma->n_pages)
249 (address > 243 return VM_FAULT_SIGBUS;
250 (unsigned long)area->vm_start + (dma->n_pages << PAGE_SHIFT))) 244
251 goto out; 245 vmf->page = vmalloc_to_page(dma->kvirt + (vmf->pgoff << PAGE_SHIFT));
252 246 get_page(vmf->page);
253 if (type) 247 return 0;
254 *type = VM_FAULT_MINOR;
255 offset = address - area->vm_start;
256 kernel_virt_addr = (unsigned long)dma->kvirt + offset;
257 ret = vmalloc_to_page((void *)kernel_virt_addr);
258 get_page(ret);
259 out:
260 return ret;
261} 248}
262 249
263static struct vm_operations_struct dma_region_vm_ops = { 250static struct vm_operations_struct dma_region_vm_ops = {
264 .nopage = dma_region_pagefault, 251 .fault = dma_region_pagefault,
265}; 252};
266 253
267/** 254/**
@@ -275,7 +262,7 @@ int dma_region_mmap(struct dma_region *dma, struct file *file,
275 if (!dma->kvirt) 262 if (!dma->kvirt)
276 return -EINVAL; 263 return -EINVAL;
277 264
278 /* must be page-aligned */ 265 /* must be page-aligned (XXX: comment is wrong, we could allow pgoff) */
279 if (vma->vm_pgoff != 0) 266 if (vma->vm_pgoff != 0)
280 return -EINVAL; 267 return -EINVAL;
281 268