}
}
-static void gdm_usb_send_complete(struct urb *urb)
+static void gdm_usb_send_complete_impl(struct urb *urb, bool need_lock)
{
struct usb_tx *t = urb->context;
struct tx_cxt *tx = t->tx_cxt;
if (urb->status == -ECONNRESET)
return;
- spin_lock_irqsave(&tx->lock, flags);
+ if (need_lock)
+ spin_lock_irqsave(&tx->lock, flags);
if (t->callback)
t->callback(t->cb_data);
else
free_tx_struct(t);
- spin_unlock_irqrestore(&tx->lock, flags);
+ if (need_lock)
+ spin_unlock_irqrestore(&tx->lock, flags);
+}
+
+static void gdm_usb_send_complete(struct urb *urb)
+{
+ gdm_usb_send_complete_impl(urb, true);
+}
+
+static void gdm_usb_send_complete_no_lock(struct urb *urb)
+{
+ gdm_usb_send_complete_impl(urb, false);
}
static int gdm_usb_send(void *priv_dev, void *data, int len,
send_fail:
t->callback = NULL;
- gdm_usb_send_complete(t->urb);
+ gdm_usb_send_complete_no_lock(t->urb);
spin_unlock_irqrestore(&tx->lock, flags);
return ret;
}
if (ret) {
t->callback = NULL;
- gdm_usb_send_complete(t->urb);
+ gdm_usb_send_complete_no_lock(t->urb);
}
}
}
if (ret) {
t->callback = NULL;
- gdm_usb_send_complete(t->urb);
+ gdm_usb_send_complete_no_lock(t->urb);
}
}