diff options
Diffstat (limited to 'drivers/firewire/fw-ohci.c')
-rw-r--r-- | drivers/firewire/fw-ohci.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index db703758db98..7e427b4c74b5 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -907,6 +907,8 @@ static void bus_reset_tasklet(unsigned long data) | |||
907 | int self_id_count, i, j, reg; | 907 | int self_id_count, i, j, reg; |
908 | int generation, new_generation; | 908 | int generation, new_generation; |
909 | unsigned long flags; | 909 | unsigned long flags; |
910 | void *free_rom = NULL; | ||
911 | dma_addr_t free_rom_bus = 0; | ||
910 | 912 | ||
911 | reg = reg_read(ohci, OHCI1394_NodeID); | 913 | reg = reg_read(ohci, OHCI1394_NodeID); |
912 | if (!(reg & OHCI1394_NodeID_idValid)) { | 914 | if (!(reg & OHCI1394_NodeID_idValid)) { |
@@ -970,8 +972,8 @@ static void bus_reset_tasklet(unsigned long data) | |||
970 | */ | 972 | */ |
971 | 973 | ||
972 | if (ohci->next_config_rom != NULL) { | 974 | if (ohci->next_config_rom != NULL) { |
973 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | 975 | free_rom = ohci->config_rom; |
974 | ohci->config_rom, ohci->config_rom_bus); | 976 | free_rom_bus = ohci->config_rom_bus; |
975 | ohci->config_rom = ohci->next_config_rom; | 977 | ohci->config_rom = ohci->next_config_rom; |
976 | ohci->config_rom_bus = ohci->next_config_rom_bus; | 978 | ohci->config_rom_bus = ohci->next_config_rom_bus; |
977 | ohci->next_config_rom = NULL; | 979 | ohci->next_config_rom = NULL; |
@@ -990,6 +992,10 @@ static void bus_reset_tasklet(unsigned long data) | |||
990 | 992 | ||
991 | spin_unlock_irqrestore(&ohci->lock, flags); | 993 | spin_unlock_irqrestore(&ohci->lock, flags); |
992 | 994 | ||
995 | if (free_rom) | ||
996 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
997 | free_rom, free_rom_bus); | ||
998 | |||
993 | fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, | 999 | fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation, |
994 | self_id_count, ohci->self_id_buffer); | 1000 | self_id_count, ohci->self_id_buffer); |
995 | } | 1001 | } |
@@ -1186,7 +1192,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1186 | { | 1192 | { |
1187 | struct fw_ohci *ohci; | 1193 | struct fw_ohci *ohci; |
1188 | unsigned long flags; | 1194 | unsigned long flags; |
1189 | int retval = 0; | 1195 | int retval = -EBUSY; |
1190 | __be32 *next_config_rom; | 1196 | __be32 *next_config_rom; |
1191 | dma_addr_t next_config_rom_bus; | 1197 | dma_addr_t next_config_rom_bus; |
1192 | 1198 | ||
@@ -1240,10 +1246,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1240 | 1246 | ||
1241 | reg_write(ohci, OHCI1394_ConfigROMmap, | 1247 | reg_write(ohci, OHCI1394_ConfigROMmap, |
1242 | ohci->next_config_rom_bus); | 1248 | ohci->next_config_rom_bus); |
1243 | } else { | 1249 | retval = 0; |
1244 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
1245 | next_config_rom, next_config_rom_bus); | ||
1246 | retval = -EBUSY; | ||
1247 | } | 1250 | } |
1248 | 1251 | ||
1249 | spin_unlock_irqrestore(&ohci->lock, flags); | 1252 | spin_unlock_irqrestore(&ohci->lock, flags); |
@@ -1257,6 +1260,9 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1257 | */ | 1260 | */ |
1258 | if (retval == 0) | 1261 | if (retval == 0) |
1259 | fw_core_initiate_bus_reset(&ohci->card, 1); | 1262 | fw_core_initiate_bus_reset(&ohci->card, 1); |
1263 | else | ||
1264 | dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, | ||
1265 | next_config_rom, next_config_rom_bus); | ||
1260 | 1266 | ||
1261 | return retval; | 1267 | return retval; |
1262 | } | 1268 | } |