Upstream: Replace sys-queue.h with qemu-queue.h

Change-Id: I5c51f54a7fe2ea702420429bbf0c789ed6d8c534
diff --git a/audio/audio_template.h b/audio/audio_template.h
index d6c1037..9f75f19 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -184,12 +184,12 @@
 
 static void glue (audio_pcm_hw_add_sw_, TYPE) (HW *hw, SW *sw)
 {
-    LIST_INSERT_HEAD (&hw->sw_head, sw, entries);
+    QLIST_INSERT_HEAD (&hw->sw_head, sw, entries);
 }
 
 static void glue (audio_pcm_hw_del_sw_, TYPE) (SW *sw)
 {
-    LIST_REMOVE (sw, entries);
+    QLIST_REMOVE (sw, entries);
 }
 
 static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
@@ -201,7 +201,7 @@
 #ifdef DAC
         audio_detach_capture (hw);
 #endif
-        LIST_REMOVE (hw, entries);
+        QLIST_REMOVE (hw, entries);
         glue (s->nb_hw_voices_, TYPE) += 1;
         glue (audio_pcm_hw_free_resources_ ,TYPE) (hw);
         BEGIN_NOSIGALRM
@@ -270,9 +270,9 @@
     }
 
     hw->pcm_ops = drv->pcm_ops;
-    LIST_INIT (&hw->sw_head);
+    QLIST_INIT (&hw->sw_head);
 #ifdef DAC
-    LIST_INIT (&hw->cap_head);
+    QLIST_INIT (&hw->cap_head);
 #endif
     BEGIN_NOSIGALRM
     err = glue (hw->pcm_ops->init_, TYPE) (hw, as);
@@ -299,7 +299,7 @@
         goto err1;
     }
 
-    LIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
+    QLIST_INSERT_HEAD (&s->glue (hw_head_, TYPE), hw, entries);
     glue (s->nb_hw_voices_, TYPE) -= 1;
 #ifdef DAC
     audio_attach_capture (hw);
@@ -409,7 +409,7 @@
     SW *sw,
     const char *name,
     void *callback_opaque ,
-    audio_callback_fn_t callback_fn,
+    audio_callback_fn callback_fn,
     struct audsettings *as
     )
 {
@@ -492,32 +492,30 @@
         }
     }
 
-    if (sw) {
-        sw->card = card;
-        sw->vol = nominal_volume;
-        sw->callback.fn = callback_fn;
-        sw->callback.opaque = callback_opaque;
+    sw->card = card;
+    sw->vol = nominal_volume;
+    sw->callback.fn = callback_fn;
+    sw->callback.opaque = callback_opaque;
 
 #ifdef DAC
-        if (live) {
-            int mixed =
-                (live << old_sw->info.shift)
-                * old_sw->info.bytes_per_second
-                / sw->info.bytes_per_second;
+    if (live) {
+        int mixed =
+            (live << old_sw->info.shift)
+            * old_sw->info.bytes_per_second
+            / sw->info.bytes_per_second;
 
 #ifdef DEBUG_PLIVE
-            dolog ("Silence will be mixed %d\n", mixed);
+        dolog ("Silence will be mixed %d\n", mixed);
 #endif
-            sw->total_hw_samples_mixed += mixed;
-        }
+        sw->total_hw_samples_mixed += mixed;
+    }
 #endif
 
 #ifdef DEBUG_AUDIO
-        dolog ("%s\n", name);
-        audio_pcm_print_info ("hw", &sw->hw->info);
-        audio_pcm_print_info ("sw", &sw->info);
+    dolog ("%s\n", name);
+    audio_pcm_print_info ("hw", &sw->hw->info);
+    audio_pcm_print_info ("sw", &sw->info);
 #endif
-    }
 
     return sw;
 
@@ -563,7 +561,7 @@
         return 0;
     }
 
-    return (delta * sw->hw->info.freq) / 1000000;
+    return muldiv64 (delta, sw->hw->info.freq, 1000000);
 }
 
 #undef TYPE