From 4c4054b4506f95a26fb47cc9f7260bad6ff1649e Mon Sep 17 00:00:00 2001 From: Jay Fenlason Date: Wed, 22 Oct 2008 15:59:42 -0400 Subject: [PATCH] --- yaml --- r: 117887 b: refs/heads/master c: a55709ba9d27053471f9fca8ee76b41ecefc14cd h: refs/heads/master i: 117885: 243c2fa4d07ef339d26faf1ef8898b3976901b30 117883: 81aac23f9b950746b28eea700445f8163cccfda8 117879: bdfc8ea8d9ff20fa5aa3e24b74537373bb79c21d 117871: b3ab058e3bfca5a80e0c6d45737d134081a863e5 117855: 1ec4a0d2b60fb3c8338ef4ea0fda119599957ea2 117823: deea774df8f43fc0fe923c06e2627f687da7e3ea 117759: 4a083c3466eda6a0d3de979cd17c9c1a784c8d83 v: v3 --- [refs] | 2 +- trunk/drivers/firewire/fw-ohci.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index db9d8c9e3616..c17b51ed32f7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 77e557191701afa55ae7320d42ad6458a2ad292e +refs/heads/master: a55709ba9d27053471f9fca8ee76b41ecefc14cd diff --git a/trunk/drivers/firewire/fw-ohci.c b/trunk/drivers/firewire/fw-ohci.c index 251416f2148f..5a5685f8f5f7 100644 --- a/trunk/drivers/firewire/fw-ohci.c +++ b/trunk/drivers/firewire/fw-ohci.c @@ -476,6 +476,7 @@ static int ar_context_add_page(struct ar_context *ctx) if (ab == NULL) return -ENOMEM; + ab->next = NULL; memset(&ab->descriptor, 0, sizeof(ab->descriptor)); ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | DESCRIPTOR_STATUS | @@ -496,6 +497,21 @@ static int ar_context_add_page(struct ar_context *ctx) return 0; } +static void ar_context_release(struct ar_context *ctx) +{ + struct ar_buffer *ab, *ab_next; + size_t offset; + dma_addr_t ab_bus; + + for (ab = ctx->current_buffer; ab; ab = ab_next) { + ab_next = ab->next; + offset = offsetof(struct ar_buffer, data); + ab_bus = le32_to_cpu(ab->descriptor.data_address) - offset; + dma_free_coherent(ctx->ohci->card.device, PAGE_SIZE, + ab, ab_bus); + } +} + #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) #define cond_le32_to_cpu(v) \ (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v)) @@ -2491,8 +2507,19 @@ static void pci_remove(struct pci_dev *dev) software_reset(ohci); free_irq(dev->irq, ohci); + + if (ohci->next_config_rom && ohci->next_config_rom != ohci->config_rom) + dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, + ohci->next_config_rom, ohci->next_config_rom_bus); + if (ohci->config_rom) + dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, + ohci->config_rom, ohci->config_rom_bus); dma_free_coherent(ohci->card.device, SELF_ID_BUF_SIZE, ohci->self_id_cpu, ohci->self_id_bus); + ar_context_release(&ohci->ar_request_ctx); + ar_context_release(&ohci->ar_response_ctx); + context_release(&ohci->at_request_ctx); + context_release(&ohci->at_response_ctx); kfree(ohci->it_context_list); kfree(ohci->ir_context_list); pci_iounmap(dev, ohci->registers);