Commit 8a8c4736 authored by Stefan Richter's avatar Stefan Richter

firewire: ohci: omit spinlock IRQ flags where possible

bus_reset_work() is only called from workqueue thread context.

ohci_set_config_rom() and ohci_allocate_iso_context() perform GFP_KERNEL
memory allocations, therefore they must be called with interrupts
enabled.

Hence these functions may disable and enable local IRQs without having
to track IRQ state.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent d713dfa7
...@@ -1823,7 +1823,6 @@ static void bus_reset_work(struct work_struct *work) ...@@ -1823,7 +1823,6 @@ static void bus_reset_work(struct work_struct *work)
container_of(work, struct fw_ohci, bus_reset_work); container_of(work, struct fw_ohci, bus_reset_work);
int self_id_count, generation, new_generation, i, j; int self_id_count, generation, new_generation, i, j;
u32 reg; u32 reg;
unsigned long flags;
void *free_rom = NULL; void *free_rom = NULL;
dma_addr_t free_rom_bus = 0; dma_addr_t free_rom_bus = 0;
bool is_new_root; bool is_new_root;
...@@ -1930,13 +1929,13 @@ static void bus_reset_work(struct work_struct *work) ...@@ -1930,13 +1929,13 @@ static void bus_reset_work(struct work_struct *work)
} }
/* FIXME: Document how the locking works. */ /* FIXME: Document how the locking works. */
spin_lock_irqsave(&ohci->lock, flags); spin_lock_irq(&ohci->lock);
ohci->generation = -1; /* prevent AT packet queueing */ ohci->generation = -1; /* prevent AT packet queueing */
context_stop(&ohci->at_request_ctx); context_stop(&ohci->at_request_ctx);
context_stop(&ohci->at_response_ctx); context_stop(&ohci->at_response_ctx);
spin_unlock_irqrestore(&ohci->lock, flags); spin_unlock_irq(&ohci->lock);
/* /*
* Per OHCI 1.2 draft, clause 7.2.3.3, hardware may leave unsent * Per OHCI 1.2 draft, clause 7.2.3.3, hardware may leave unsent
...@@ -1946,7 +1945,7 @@ static void bus_reset_work(struct work_struct *work) ...@@ -1946,7 +1945,7 @@ static void bus_reset_work(struct work_struct *work)
at_context_flush(&ohci->at_request_ctx); at_context_flush(&ohci->at_request_ctx);
at_context_flush(&ohci->at_response_ctx); at_context_flush(&ohci->at_response_ctx);
spin_lock_irqsave(&ohci->lock, flags); spin_lock_irq(&ohci->lock);
ohci->generation = generation; ohci->generation = generation;
reg_write(ohci, OHCI1394_IntEventClear, OHCI1394_busReset); reg_write(ohci, OHCI1394_IntEventClear, OHCI1394_busReset);
...@@ -1990,7 +1989,7 @@ static void bus_reset_work(struct work_struct *work) ...@@ -1990,7 +1989,7 @@ static void bus_reset_work(struct work_struct *work)
reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0); reg_write(ohci, OHCI1394_PhyReqFilterLoSet, ~0);
#endif #endif
spin_unlock_irqrestore(&ohci->lock, flags); spin_unlock_irq(&ohci->lock);
if (free_rom) if (free_rom)
dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE, dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
...@@ -2402,7 +2401,6 @@ static int ohci_set_config_rom(struct fw_card *card, ...@@ -2402,7 +2401,6 @@ static int ohci_set_config_rom(struct fw_card *card,
const __be32 *config_rom, size_t length) const __be32 *config_rom, size_t length)
{ {
struct fw_ohci *ohci; struct fw_ohci *ohci;
unsigned long flags;
__be32 *next_config_rom; __be32 *next_config_rom;
dma_addr_t uninitialized_var(next_config_rom_bus); dma_addr_t uninitialized_var(next_config_rom_bus);
...@@ -2441,7 +2439,7 @@ static int ohci_set_config_rom(struct fw_card *card, ...@@ -2441,7 +2439,7 @@ static int ohci_set_config_rom(struct fw_card *card,
if (next_config_rom == NULL) if (next_config_rom == NULL)
return -ENOMEM; return -ENOMEM;
spin_lock_irqsave(&ohci->lock, flags); spin_lock_irq(&ohci->lock);
/* /*
* If there is not an already pending config_rom update, * If there is not an already pending config_rom update,
...@@ -2467,7 +2465,7 @@ static int ohci_set_config_rom(struct fw_card *card, ...@@ -2467,7 +2465,7 @@ static int ohci_set_config_rom(struct fw_card *card,
reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus); reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus);
spin_unlock_irqrestore(&ohci->lock, flags); spin_unlock_irq(&ohci->lock);
/* If we didn't use the DMA allocation, delete it. */ /* If we didn't use the DMA allocation, delete it. */
if (next_config_rom != NULL) if (next_config_rom != NULL)
...@@ -2891,10 +2889,9 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, ...@@ -2891,10 +2889,9 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
descriptor_callback_t uninitialized_var(callback); descriptor_callback_t uninitialized_var(callback);
u64 *uninitialized_var(channels); u64 *uninitialized_var(channels);
u32 *uninitialized_var(mask), uninitialized_var(regs); u32 *uninitialized_var(mask), uninitialized_var(regs);
unsigned long flags;
int index, ret = -EBUSY; int index, ret = -EBUSY;
spin_lock_irqsave(&ohci->lock, flags); spin_lock_irq(&ohci->lock);
switch (type) { switch (type) {
case FW_ISO_CONTEXT_TRANSMIT: case FW_ISO_CONTEXT_TRANSMIT:
...@@ -2938,7 +2935,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, ...@@ -2938,7 +2935,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
ret = -ENOSYS; ret = -ENOSYS;
} }
spin_unlock_irqrestore(&ohci->lock, flags); spin_unlock_irq(&ohci->lock);
if (index < 0) if (index < 0)
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -2964,7 +2961,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, ...@@ -2964,7 +2961,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
out_with_header: out_with_header:
free_page((unsigned long)ctx->header); free_page((unsigned long)ctx->header);
out: out:
spin_lock_irqsave(&ohci->lock, flags); spin_lock_irq(&ohci->lock);
switch (type) { switch (type) {
case FW_ISO_CONTEXT_RECEIVE: case FW_ISO_CONTEXT_RECEIVE:
...@@ -2977,7 +2974,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card, ...@@ -2977,7 +2974,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
} }
*mask |= 1 << index; *mask |= 1 << index;
spin_unlock_irqrestore(&ohci->lock, flags); spin_unlock_irq(&ohci->lock);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment