Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
[pandora-kernel.git] / drivers / virtio / virtio_ring.c
index 3a28c13..72bf8bc 100644 (file)
@@ -184,6 +184,11 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
 
        START_USE(vq);
 
+       if (unlikely(vq->broken)) {
+               END_USE(vq);
+               return NULL;
+       }
+
        if (!more_used(vq)) {
                pr_debug("No more buffers in queue\n");
                END_USE(vq);
@@ -214,10 +219,7 @@ static void vring_disable_cb(struct virtqueue *_vq)
 {
        struct vring_virtqueue *vq = to_vvq(_vq);
 
-       START_USE(vq);
-       BUG_ON(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
        vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
-       END_USE(vq);
 }
 
 static bool vring_enable_cb(struct virtqueue *_vq)
@@ -225,14 +227,12 @@ static bool vring_enable_cb(struct virtqueue *_vq)
        struct vring_virtqueue *vq = to_vvq(_vq);
 
        START_USE(vq);
-       BUG_ON(!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT));
 
        /* We optimistically turn back on interrupts, then check if there was
         * more to do. */
        vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
        mb();
        if (unlikely(more_used(vq))) {
-               vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
                END_USE(vq);
                return false;
        }
@@ -253,13 +253,6 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
        if (unlikely(vq->broken))
                return IRQ_HANDLED;
 
-       /* Other side may have missed us turning off the interrupt,
-        * but we should preserve disable semantic for virtio users. */
-       if (unlikely(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) {
-               pr_debug("virtqueue interrupt after disable for %p\n", vq);
-               return IRQ_HANDLED;
-       }
-
        pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
        if (vq->vq.callback)
                vq->vq.callback(&vq->vq);