aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/dma.h
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2006-07-03 12:02:28 -0400
committerBen Collins <bcollins@ubuntu.com>2006-07-03 12:02:28 -0400
commite1d118f16dca0f54faba3e8dd5b6adbbf7ac68c8 (patch)
treefffc9d2b1fbe3fe6bb55758e2a6951ad9c581e63 /drivers/ieee1394/dma.h
parent2b01b80b944b3abf623c8acc2b5537a85b5ebd3c (diff)
[PATCH] ieee1394: coding style and comment fixes in midlayer header files
Adjust tabulators, line wraps, empty lines, and comment style. Update comments in ieee1394_transactions.h and highlevel.h. Fix typo in comment in csr.h. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Diffstat (limited to 'drivers/ieee1394/dma.h')
-rw-r--r--drivers/ieee1394/dma.h81
1 files changed, 50 insertions, 31 deletions
diff --git a/drivers/ieee1394/dma.h b/drivers/ieee1394/dma.h
index 061550a6fb99..b0f0885c4551 100644
--- a/drivers/ieee1394/dma.h
+++ b/drivers/ieee1394/dma.h
@@ -13,66 +13,85 @@
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <asm/scatterlist.h> 14#include <asm/scatterlist.h>
15 15
16/* struct dma_prog_region 16/**
17 17 * struct dma_prog_region - small contiguous DMA buffer
18 a small, physically-contiguous DMA buffer with random-access, 18 * @kvirt: kernel virtual address
19 synchronous usage characteristics 19 * @dev: PCI device
20*/ 20 * @n_pages: number of kernel pages
21 21 * @bus_addr: base bus address
22 *
23 * a small, physically contiguous DMA buffer with random-access, synchronous
24 * usage characteristics
25 */
22struct dma_prog_region { 26struct dma_prog_region {
23 unsigned char *kvirt; /* kernel virtual address */ 27 unsigned char *kvirt;
24 struct pci_dev *dev; /* PCI device */ 28 struct pci_dev *dev;
25 unsigned int n_pages; /* # of kernel pages */ 29 unsigned int n_pages;
26 dma_addr_t bus_addr; /* base bus address */ 30 dma_addr_t bus_addr;
27}; 31};
28 32
29/* clear out all fields but do not allocate any memory */ 33/* clear out all fields but do not allocate any memory */
30void dma_prog_region_init(struct dma_prog_region *prog); 34void dma_prog_region_init(struct dma_prog_region *prog);
31int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, struct pci_dev *dev); 35int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
36 struct pci_dev *dev);
32void dma_prog_region_free(struct dma_prog_region *prog); 37void dma_prog_region_free(struct dma_prog_region *prog);
33 38
34static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *prog, unsigned long offset) 39static inline dma_addr_t dma_prog_region_offset_to_bus(
40 struct dma_prog_region *prog, unsigned long offset)
35{ 41{
36 return prog->bus_addr + offset; 42 return prog->bus_addr + offset;
37} 43}
38 44
39/* struct dma_region 45/**
40 46 * struct dma_region - large non-contiguous DMA buffer
41 a large, non-physically-contiguous DMA buffer with streaming, 47 * @virt: kernel virtual address
42 asynchronous usage characteristics 48 * @dev: PCI device
43*/ 49 * @n_pages: number of kernel pages
44 50 * @n_dma_pages: number of IOMMU pages
51 * @sglist: IOMMU mapping
52 * @direction: PCI_DMA_TODEVICE, etc.
53 *
54 * a large, non-physically-contiguous DMA buffer with streaming, asynchronous
55 * usage characteristics
56 */
45struct dma_region { 57struct dma_region {
46 unsigned char *kvirt; /* kernel virtual address */ 58 unsigned char *kvirt;
47 struct pci_dev *dev; /* PCI device */ 59 struct pci_dev *dev;
48 unsigned int n_pages; /* # of kernel pages */ 60 unsigned int n_pages;
49 unsigned int n_dma_pages; /* # of IOMMU pages */ 61 unsigned int n_dma_pages;
50 struct scatterlist *sglist; /* IOMMU mapping */ 62 struct scatterlist *sglist;
51 int direction; /* PCI_DMA_TODEVICE, etc */ 63 int direction;
52}; 64};
53 65
54/* clear out all fields but do not allocate anything */ 66/* clear out all fields but do not allocate anything */
55void dma_region_init(struct dma_region *dma); 67void dma_region_init(struct dma_region *dma);
56 68
57/* allocate the buffer and map it to the IOMMU */ 69/* allocate the buffer and map it to the IOMMU */
58int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_dev *dev, int direction); 70int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
71 struct pci_dev *dev, int direction);
59 72
60/* unmap and free the buffer */ 73/* unmap and free the buffer */
61void dma_region_free(struct dma_region *dma); 74void dma_region_free(struct dma_region *dma);
62 75
63/* sync the CPU's view of the buffer */ 76/* sync the CPU's view of the buffer */
64void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, unsigned long len); 77void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset,
78 unsigned long len);
79
65/* sync the IO bus' view of the buffer */ 80/* sync the IO bus' view of the buffer */
66void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, unsigned long len); 81void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset,
82 unsigned long len);
67 83
68/* map the buffer into a user space process */ 84/* map the buffer into a user space process */
69int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma); 85int dma_region_mmap(struct dma_region *dma, struct file *file,
86 struct vm_area_struct *vma);
70 87
71/* macro to index into a DMA region (or dma_prog_region) */ 88/* macro to index into a DMA region (or dma_prog_region) */
72#define dma_region_i(_dma, _type, _index) ( ((_type*) ((_dma)->kvirt)) + (_index) ) 89#define dma_region_i(_dma, _type, _index) \
90 ( ((_type*) ((_dma)->kvirt)) + (_index) )
73 91
74/* return the DMA bus address of the byte with the given offset 92/* return the DMA bus address of the byte with the given offset
75 relative to the beginning of the dma_region */ 93 * relative to the beginning of the dma_region */
76dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset); 94dma_addr_t dma_region_offset_to_bus(struct dma_region *dma,
95 unsigned long offset);
77 96
78#endif /* IEEE1394_DMA_H */ 97#endif /* IEEE1394_DMA_H */