diff options
author | Ben Collins <bcollins@ubuntu.com> | 2006-06-12 17:52:59 -0400 |
---|---|---|
committer | Ben Collins <bcollins@ubuntu.com> | 2006-06-12 17:52:59 -0400 |
commit | 9bb2bcdb4b6f9a04363c8ea4cf72c592d6c7af71 (patch) | |
tree | 5821a1f75856b45997856f19c0760a932d9709d0 /drivers/ieee1394 | |
parent | f54b1bdff1b470ff4461de3a73a7ceaf3a52e10a (diff) |
ieee1394: speed up of dma_region_sync_for_cpu
when attempting to find the 'last' part of the dma region continue the
search from where we left off, instead of starting the search over.
Signed-off-by: Jim Westfall <jwestfall@surrealistic.net>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/dma.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c index 9fb2769d9abc..ca5167de707d 100644 --- a/drivers/ieee1394/dma.c +++ b/drivers/ieee1394/dma.c | |||
@@ -145,12 +145,12 @@ void dma_region_free(struct dma_region *dma) | |||
145 | /* find the scatterlist index and remaining offset corresponding to a | 145 | /* find the scatterlist index and remaining offset corresponding to a |
146 | given offset from the beginning of the buffer */ | 146 | given offset from the beginning of the buffer */ |
147 | static inline int dma_region_find(struct dma_region *dma, unsigned long offset, | 147 | static inline int dma_region_find(struct dma_region *dma, unsigned long offset, |
148 | unsigned long *rem) | 148 | unsigned int start, unsigned long *rem) |
149 | { | 149 | { |
150 | int i; | 150 | int i; |
151 | unsigned long off = offset; | 151 | unsigned long off = offset; |
152 | 152 | ||
153 | for (i = 0; i < dma->n_dma_pages; i++) { | 153 | for (i = start; i < dma->n_dma_pages; i++) { |
154 | if (off < sg_dma_len(&dma->sglist[i])) { | 154 | if (off < sg_dma_len(&dma->sglist[i])) { |
155 | *rem = off; | 155 | *rem = off; |
156 | break; | 156 | break; |
@@ -170,7 +170,7 @@ dma_addr_t dma_region_offset_to_bus(struct dma_region * dma, | |||
170 | unsigned long rem = 0; | 170 | unsigned long rem = 0; |
171 | 171 | ||
172 | struct scatterlist *sg = | 172 | struct scatterlist *sg = |
173 | &dma->sglist[dma_region_find(dma, offset, &rem)]; | 173 | &dma->sglist[dma_region_find(dma, offset, 0, &rem)]; |
174 | return sg_dma_address(sg) + rem; | 174 | return sg_dma_address(sg) + rem; |
175 | } | 175 | } |
176 | 176 | ||
@@ -178,13 +178,13 @@ void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, | |||
178 | unsigned long len) | 178 | unsigned long len) |
179 | { | 179 | { |
180 | int first, last; | 180 | int first, last; |
181 | unsigned long rem; | 181 | unsigned long rem = 0; |
182 | 182 | ||
183 | if (!len) | 183 | if (!len) |
184 | len = 1; | 184 | len = 1; |
185 | 185 | ||
186 | first = dma_region_find(dma, offset, &rem); | 186 | first = dma_region_find(dma, offset, 0, &rem); |
187 | last = dma_region_find(dma, offset + len - 1, &rem); | 187 | last = dma_region_find(dma, rem + len - 1, first, &rem); |
188 | 188 | ||
189 | pci_dma_sync_sg_for_cpu(dma->dev, &dma->sglist[first], last - first + 1, | 189 | pci_dma_sync_sg_for_cpu(dma->dev, &dma->sglist[first], last - first + 1, |
190 | dma->direction); | 190 | dma->direction); |
@@ -194,13 +194,13 @@ void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, | |||
194 | unsigned long len) | 194 | unsigned long len) |
195 | { | 195 | { |
196 | int first, last; | 196 | int first, last; |
197 | unsigned long rem; | 197 | unsigned long rem = 0; |
198 | 198 | ||
199 | if (!len) | 199 | if (!len) |
200 | len = 1; | 200 | len = 1; |
201 | 201 | ||
202 | first = dma_region_find(dma, offset, &rem); | 202 | first = dma_region_find(dma, offset, 0, &rem); |
203 | last = dma_region_find(dma, offset + len - 1, &rem); | 203 | last = dma_region_find(dma, rem + len - 1, first, &rem); |
204 | 204 | ||
205 | pci_dma_sync_sg_for_device(dma->dev, &dma->sglist[first], | 205 | pci_dma_sync_sg_for_device(dma->dev, &dma->sglist[first], |
206 | last - first + 1, dma->direction); | 206 | last - first + 1, dma->direction); |