diff options
Diffstat (limited to 'drivers/firewire/ohci.c')
-rw-r--r-- | drivers/firewire/ohci.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index ce767a4882fb..f9f55703375e 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -2208,7 +2208,6 @@ static int ohci_set_config_rom(struct fw_card *card, | |||
2208 | { | 2208 | { |
2209 | struct fw_ohci *ohci; | 2209 | struct fw_ohci *ohci; |
2210 | unsigned long flags; | 2210 | unsigned long flags; |
2211 | int ret = -EBUSY; | ||
2212 | __be32 *next_config_rom; | 2211 | __be32 *next_config_rom; |
2213 | dma_addr_t uninitialized_var(next_config_rom_bus); | 2212 | dma_addr_t uninitialized_var(next_config_rom_bus); |
2214 | 2213 | ||
@@ -2249,22 +2248,37 @@ static int ohci_set_config_rom(struct fw_card *card, | |||
2249 | 2248 | ||
2250 | spin_lock_irqsave(&ohci->lock, flags); | 2249 | spin_lock_irqsave(&ohci->lock, flags); |
2251 | 2250 | ||
2251 | /* | ||
2252 | * If there is not an already pending config_rom update, | ||
2253 | * push our new allocation into the ohci->next_config_rom | ||
2254 | * and then mark the local variable as null so that we | ||
2255 | * won't deallocate the new buffer. | ||
2256 | * | ||
2257 | * OTOH, if there is a pending config_rom update, just | ||
2258 | * use that buffer with the new config_rom data, and | ||
2259 | * let this routine free the unused DMA allocation. | ||
2260 | */ | ||
2261 | |||
2252 | if (ohci->next_config_rom == NULL) { | 2262 | if (ohci->next_config_rom == NULL) { |
2253 | ohci->next_config_rom = next_config_rom; | 2263 | ohci->next_config_rom = next_config_rom; |
2254 | ohci->next_config_rom_bus = next_config_rom_bus; | 2264 | ohci->next_config_rom_bus = next_config_rom_bus; |
2265 | next_config_rom = NULL; | ||
2266 | } | ||
2255 | 2267 | ||
2256 | copy_config_rom(ohci->next_config_rom, config_rom, length); | 2268 | copy_config_rom(ohci->next_config_rom, config_rom, length); |
2257 | 2269 | ||
2258 | ohci->next_header = config_rom[0]; | 2270 | ohci->next_header = config_rom[0]; |
2259 | ohci->next_config_rom[0] = 0; | 2271 | ohci->next_config_rom[0] = 0; |
2260 | 2272 | ||
2261 | reg_write(ohci, OHCI1394_ConfigROMmap, | 2273 | reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); |
2262 | ohci->next_config_rom_bus); | ||
2263 | ret = 0; | ||
2264 | } | ||
2265 | 2274 | ||
2266 | spin_unlock_irqrestore(&ohci->lock, flags); | 2275 | spin_unlock_irqrestore(&ohci->lock, flags); |
2267 | 2276 | ||
2277 | /* If we didn't use the DMA allocation, delete it. */ | ||
2278 | if (next_config_rom != NULL) | ||
2279 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
2280 | next_config_rom, next_config_rom_bus); | ||
2281 | |||
2268 | /* | 2282 | /* |
2269 | * Now initiate a bus reset to have the changes take | 2283 | * Now initiate a bus reset to have the changes take |
2270 | * effect. We clean up the old config rom memory and DMA | 2284 | * effect. We clean up the old config rom memory and DMA |
@@ -2272,13 +2286,10 @@ static int ohci_set_config_rom(struct fw_card *card, | |||
2272 | * controller could need to access it before the bus reset | 2286 | * controller could need to access it before the bus reset |
2273 | * takes effect. | 2287 | * takes effect. |
2274 | */ | 2288 | */ |
2275 | if (ret == 0) | ||
2276 | fw_schedule_bus_reset(&ohci->card, true, true); | ||
2277 | else | ||
2278 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
2279 | next_config_rom, next_config_rom_bus); | ||
2280 | 2289 | ||
2281 | return ret; | 2290 | fw_schedule_bus_reset(&ohci->card, true, true); |
2291 | |||
2292 | return 0; | ||
2282 | } | 2293 | } |
2283 | 2294 | ||
2284 | static void ohci_send_request(struct fw_card *card, struct fw_packet *packet) | 2295 | static void ohci_send_request(struct fw_card *card, struct fw_packet *packet) |