static int hdm_poison_channel(struct most_interface *iface, int channel)
{
struct most_dev *mdev;
+ unsigned long flags;
+ spinlock_t *lock; /* temp. lock */
mdev = to_mdev(iface);
if (unlikely(!iface)) {
return -ECHRNG;
}
+ lock = mdev->anchor_list_lock + channel;
+ spin_lock_irqsave(lock, flags);
mdev->is_channel_healthy[channel] = false;
+ spin_unlock_irqrestore(lock, flags);
cancel_work_sync(&mdev->clear_work[channel].ws);
dev = &mdev->usb_device->dev;
lock = mdev->anchor_list_lock + channel;
+ spin_lock_irqsave(lock, flags);
if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) ||
(!mdev->is_channel_healthy[channel])) {
+ spin_unlock_irqrestore(lock, flags);
complete(&anchor->urb_compl);
return;
}
case -EPIPE:
dev_warn(dev, "Broken OUT pipe detected\n");
mdev->is_channel_healthy[channel] = false;
+ spin_unlock_irqrestore(lock, flags);
mbo->status = MBO_E_INVAL;
mdev->clear_work[channel].pipe = urb->pipe;
schedule_work(&mdev->clear_work[channel].ws);
mbo->processed_length = urb->actual_length;
}
- spin_lock_irqsave(lock, flags);
list_del(&anchor->list);
spin_unlock_irqrestore(lock, flags);
kfree(anchor);
dev = &mdev->usb_device->dev;
lock = mdev->anchor_list_lock + channel;
+ spin_lock_irqsave(lock, flags);
if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) ||
(!mdev->is_channel_healthy[channel])) {
+ spin_unlock_irqrestore(lock, flags);
complete(&anchor->urb_compl);
return;
}
case -EPIPE:
dev_warn(dev, "Broken IN pipe detected\n");
mdev->is_channel_healthy[channel] = false;
+ spin_unlock_irqrestore(lock, flags);
mbo->status = MBO_E_INVAL;
mdev->clear_work[channel].pipe = urb->pipe;
schedule_work(&mdev->clear_work[channel].ws);
mbo->status = MBO_E_INVAL;
}
}
- spin_lock_irqsave(lock, flags);
+
list_del(&anchor->list);
spin_unlock_irqrestore(lock, flags);
kfree(anchor);