]> git.proxmox.com Git - qemu.git/blobdiff - async.c
usb-bt: Return NAK instead of STALL when interrupt ep has no data
[qemu.git] / async.c
diff --git a/async.c b/async.c
index 564526f57fb1d25d829f8688713851e64a43143d..3f0e8f367c277c760efbb2c53498c958355bc1e3 100644 (file)
--- a/async.c
+++ b/async.c
@@ -117,8 +117,10 @@ void qemu_bh_delete(QEMUBH *bh)
     bh->deleted = 1;
 }
 
-void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout)
+static gboolean
+aio_ctx_prepare(GSource *source, gint    *timeout)
 {
+    AioContext *ctx = (AioContext *) source;
     QEMUBH *bh;
 
     for (bh = ctx->first_bh; bh; bh = bh->next) {
@@ -126,28 +128,15 @@ void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout)
             if (bh->idle) {
                 /* idle bottom halves will be polled at least
                  * every 10ms */
-                *timeout = MIN(10, *timeout);
+                *timeout = 10;
             } else {
                 /* non-idle bottom halves will be executed
                  * immediately */
                 *timeout = 0;
-                break;
+                return true;
             }
         }
     }
-}
-
-static gboolean
-aio_ctx_prepare(GSource *source, gint    *timeout)
-{
-    AioContext *ctx = (AioContext *) source;
-    uint32_t wait = -1;
-    aio_bh_update_timeout(ctx, &wait);
-
-    if (wait != -1) {
-        *timeout = MIN(*timeout, wait);
-        return wait == 0;
-    }
 
     return false;
 }