Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87379
b: refs/heads/master
c: bde1709
h: refs/heads/master
i:
  87377: 82e72f0
  87375: 4756aab
v: v3
  • Loading branch information
Jarod Wilson authored and Stefan Richter committed Mar 13, 2008
1 parent c2113c6 commit 87d779f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e45ef4c7aeefbf97df748866cd1b24f73b86160
refs/heads/master: bde1709aaa98f5004ab1580842c422be18eb4bc3
18 changes: 5 additions & 13 deletions trunk/drivers/firewire/fw-ohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,10 @@ static int ar_context_add_page(struct ar_context *ctx)
dma_addr_t ab_bus;
size_t offset;

ab = (struct ar_buffer *) __get_free_page(GFP_ATOMIC);
ab = dma_alloc_coherent(dev, PAGE_SIZE, &ab_bus, GFP_ATOMIC);
if (ab == NULL)
return -ENOMEM;

ab_bus = dma_map_single(dev, ab, PAGE_SIZE, DMA_BIDIRECTIONAL);
if (dma_mapping_error(ab_bus)) {
free_page((unsigned long) ab);
return -ENOMEM;
}

memset(&ab->descriptor, 0, sizeof(ab->descriptor));
ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE |
DESCRIPTOR_STATUS |
Expand All @@ -304,8 +298,6 @@ static int ar_context_add_page(struct ar_context *ctx)
ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset);
ab->descriptor.branch_address = 0;

dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);

ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1);
ctx->last_buffer->next = ab;
ctx->last_buffer = ab;
Expand Down Expand Up @@ -409,6 +401,7 @@ static void ar_context_tasklet(unsigned long data)

if (d->res_count == 0) {
size_t size, rest, offset;
dma_addr_t buffer_bus;

/*
* This descriptor is finished and we may have a
Expand All @@ -417,9 +410,7 @@ static void ar_context_tasklet(unsigned long data)
*/

offset = offsetof(struct ar_buffer, data);
dma_unmap_single(ohci->card.device,
le32_to_cpu(ab->descriptor.data_address) - offset,
PAGE_SIZE, DMA_BIDIRECTIONAL);
buffer_bus = le32_to_cpu(ab->descriptor.data_address) - offset;

buffer = ab;
ab = ab->next;
Expand All @@ -435,7 +426,8 @@ static void ar_context_tasklet(unsigned long data)
while (buffer < end)
buffer = handle_ar_packet(ctx, buffer);

free_page((unsigned long)buffer);
dma_free_coherent(ohci->card.device, PAGE_SIZE,
buffer, buffer_bus);
ar_context_add_page(ctx);
} else {
buffer = ctx->pointer;
Expand Down

0 comments on commit 87d779f

Please sign in to comment.