Skip to content

Commit 50d44f8

Browse files
Sebastian Andrzej SiewiorLee Jones
authored andcommitted
mfd: dln2: Use irqsave() in USB's complete callback
The USB completion callback does not disable interrupts while acquiring the lock. We want to remove the local_irq_disable() invocation from __usb_hcd_giveback_urb() and therefore it is required for the callback handler to disable the interrupts while acquiring the lock. The callback may be invoked either in IRQ or BH context depending on the USB host controller. Use the _irqsave() variant of the locking primitives. Reviewed-by: Johan Hovold <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent f99fea9 commit 50d44f8

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/mfd/dln2.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,21 @@ static bool dln2_transfer_complete(struct dln2_dev *dln2, struct urb *urb,
194194
struct device *dev = &dln2->interface->dev;
195195
struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle];
196196
struct dln2_rx_context *rxc;
197+
unsigned long flags;
197198
bool valid_slot = false;
198199

199200
if (rx_slot >= DLN2_MAX_RX_SLOTS)
200201
goto out;
201202

202203
rxc = &rxs->slots[rx_slot];
203204

204-
/*
205-
* No need to disable interrupts as this lock is not taken in interrupt
206-
* context elsewhere in this driver. This function (or its callers) are
207-
* also not exported to other modules.
208-
*/
209-
spin_lock(&rxs->lock);
205+
spin_lock_irqsave(&rxs->lock, flags);
210206
if (rxc->in_use && !rxc->urb) {
211207
rxc->urb = urb;
212208
complete(&rxc->done);
213209
valid_slot = true;
214210
}
215-
spin_unlock(&rxs->lock);
211+
spin_unlock_irqrestore(&rxs->lock, flags);
216212

217213
out:
218214
if (!valid_slot)

0 commit comments

Comments
 (0)