aboutsummaryrefslogtreecommitdiff
path: root/hw/audio/hda-codec.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-06-27 13:19:36 +0200
committerPeter Maydell <peter.maydell@linaro.org>2018-07-02 10:48:49 +0100
commit3b84967c192fba485340f7c34ceb4f877d27b36d (patch)
treef410ba5733ac42b40e9c3baf4022660b038688a4 /hw/audio/hda-codec.c
parent281bd281222776229d5dbf84d1a5c6d8d9d2a34b (diff)
downloadqemu-3b84967c192fba485340f7c34ceb4f877d27b36d.zip
qemu-3b84967c192fba485340f7c34ceb4f877d27b36d.tar.gz
qemu-3b84967c192fba485340f7c34ceb4f877d27b36d.tar.bz2
audio/hda: drop atomics
Doesn't build on 32bit clang. And because we run under qemu mutex anyway they are not needed. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20180627111936.31019-1-kraxel@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/audio/hda-codec.c')
-rw-r--r--hw/audio/hda-codec.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index fc49450..31c66d4 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
-#include "qemu/atomic.h"
#include "hw/hw.h"
#include "hw/pci/pci.h"
#include "intel-hda.h"
@@ -209,7 +208,7 @@ static inline void hda_timer_sync_adjust(HDAAudioStream *st, int64_t target_pos)
}
trace_hda_audio_adjust(st->node->name, target_pos);
- atomic_fetch_add(&st->buft_start, corr);
+ st->buft_start += corr;
}
static void hda_audio_input_timer(void *opaque)
@@ -218,9 +217,9 @@ static void hda_audio_input_timer(void *opaque)
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- int64_t buft_start = atomic_fetch_add(&st->buft_start, 0);
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t buft_start = st->buft_start;
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t wanted_rpos = hda_bytes_per_second(st) * (now - buft_start)
/ NANOSECONDS_PER_SECOND;
@@ -242,7 +241,7 @@ static void hda_audio_input_timer(void *opaque)
}
rpos += chunk;
to_transfer -= chunk;
- atomic_fetch_add(&st->rpos, chunk);
+ st->rpos += chunk;
}
out_timer:
@@ -256,8 +255,8 @@ static void hda_audio_input_cb(void *opaque, int avail)
{
HDAAudioStream *st = opaque;
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t to_transfer = audio_MIN(B_SIZE - (wpos - rpos), avail);
@@ -269,7 +268,7 @@ static void hda_audio_input_cb(void *opaque, int avail)
uint32_t read = AUD_read(st->voice.in, st->buf + start, chunk);
wpos += read;
to_transfer -= read;
- atomic_fetch_add(&st->wpos, read);
+ st->wpos += read;
if (chunk != read) {
break;
}
@@ -282,9 +281,9 @@ static void hda_audio_output_timer(void *opaque)
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- int64_t buft_start = atomic_fetch_add(&st->buft_start, 0);
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t buft_start = st->buft_start;
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t wanted_wpos = hda_bytes_per_second(st) * (now - buft_start)
/ NANOSECONDS_PER_SECOND;
@@ -306,7 +305,7 @@ static void hda_audio_output_timer(void *opaque)
}
wpos += chunk;
to_transfer -= chunk;
- atomic_fetch_add(&st->wpos, chunk);
+ st->wpos += chunk;
}
out_timer:
@@ -320,8 +319,8 @@ static void hda_audio_output_cb(void *opaque, int avail)
{
HDAAudioStream *st = opaque;
- int64_t wpos = atomic_fetch_add(&st->wpos, 0);
- int64_t rpos = atomic_fetch_add(&st->rpos, 0);
+ int64_t wpos = st->wpos;
+ int64_t rpos = st->rpos;
int64_t to_transfer = audio_MIN(wpos - rpos, avail);
@@ -342,7 +341,7 @@ static void hda_audio_output_cb(void *opaque, int avail)
uint32_t written = AUD_write(st->voice.out, st->buf + start, chunk);
rpos += written;
to_transfer -= written;
- atomic_fetch_add(&st->rpos, written);
+ st->rpos += written;
if (chunk != written) {
break;
}