From nobody Tue Nov 4 11:04:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530098510007644.5604164572417; Wed, 27 Jun 2018 04:21:50 -0700 (PDT) Received: from localhost ([::1]:58184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY8WD-0002A6-9M for importer@patchew.org; Wed, 27 Jun 2018 07:21:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fY8UF-0001CK-Lv for qemu-devel@nongnu.org; Wed, 27 Jun 2018 07:19:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fY8U9-0004LJ-6Q for qemu-devel@nongnu.org; Wed, 27 Jun 2018 07:19:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41386 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fY8U9-0004L2-0u for qemu-devel@nongnu.org; Wed, 27 Jun 2018 07:19:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A081CF68BC for ; Wed, 27 Jun 2018 11:19:40 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-216.ams2.redhat.com [10.36.116.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DF5E1C5AD; Wed, 27 Jun 2018 11:19:38 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F1D053EBB8; Wed, 27 Jun 2018 13:19:37 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 27 Jun 2018 13:19:36 +0200 Message-Id: <20180627111936.31019-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 11:19:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 27 Jun 2018 11:19:40 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] audio/hda: drop atomics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Doesn't build on 32bit clang. And because we run under qemu mutex anyway they are not needed. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/hda-codec.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 8a8214de74..a4e24b919d 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -18,7 +18,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/atomic.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "intel-hda.h" @@ -212,7 +211,7 @@ static inline void hda_timer_sync_adjust(HDAAudioStream= *st, int64_t target_pos) } =20 trace_hda_audio_adjust(st->node->name, target_pos); - atomic_fetch_add(&st->buft_start, corr); + st->buft_start +=3D corr; } =20 static void hda_audio_input_timer(void *opaque) @@ -221,9 +220,9 @@ static void hda_audio_input_timer(void *opaque) =20 int64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); =20 - int64_t buft_start =3D atomic_fetch_add(&st->buft_start, 0); - int64_t wpos =3D atomic_fetch_add(&st->wpos, 0); - int64_t rpos =3D atomic_fetch_add(&st->rpos, 0); + int64_t buft_start =3D st->buft_start; + int64_t wpos =3D st->wpos; + int64_t rpos =3D st->rpos; =20 int64_t wanted_rpos =3D hda_bytes_per_second(st) * (now - buft_start) / NANOSECONDS_PER_SECOND; @@ -245,7 +244,7 @@ static void hda_audio_input_timer(void *opaque) } rpos +=3D chunk; to_transfer -=3D chunk; - atomic_fetch_add(&st->rpos, chunk); + st->rpos +=3D chunk; } =20 out_timer: @@ -259,8 +258,8 @@ static void hda_audio_input_cb(void *opaque, int avail) { HDAAudioStream *st =3D opaque; =20 - int64_t wpos =3D atomic_fetch_add(&st->wpos, 0); - int64_t rpos =3D atomic_fetch_add(&st->rpos, 0); + int64_t wpos =3D st->wpos; + int64_t rpos =3D st->rpos; =20 int64_t to_transfer =3D audio_MIN(B_SIZE - (wpos - rpos), avail); =20 @@ -272,7 +271,7 @@ static void hda_audio_input_cb(void *opaque, int avail) uint32_t read =3D AUD_read(st->voice.in, st->buf + start, chunk); wpos +=3D read; to_transfer -=3D read; - atomic_fetch_add(&st->wpos, read); + st->wpos +=3D read; if (chunk !=3D read) { break; } @@ -285,9 +284,9 @@ static void hda_audio_output_timer(void *opaque) =20 int64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); =20 - int64_t buft_start =3D atomic_fetch_add(&st->buft_start, 0); - int64_t wpos =3D atomic_fetch_add(&st->wpos, 0); - int64_t rpos =3D atomic_fetch_add(&st->rpos, 0); + int64_t buft_start =3D st->buft_start; + int64_t wpos =3D st->wpos; + int64_t rpos =3D st->rpos; =20 int64_t wanted_wpos =3D hda_bytes_per_second(st) * (now - buft_start) / NANOSECONDS_PER_SECOND; @@ -309,7 +308,7 @@ static void hda_audio_output_timer(void *opaque) } wpos +=3D chunk; to_transfer -=3D chunk; - atomic_fetch_add(&st->wpos, chunk); + st->wpos +=3D chunk; } =20 out_timer: @@ -323,8 +322,8 @@ static void hda_audio_output_cb(void *opaque, int avail) { HDAAudioStream *st =3D opaque; =20 - int64_t wpos =3D atomic_fetch_add(&st->wpos, 0); - int64_t rpos =3D atomic_fetch_add(&st->rpos, 0); + int64_t wpos =3D st->wpos; + int64_t rpos =3D st->rpos; =20 int64_t to_transfer =3D audio_MIN(wpos - rpos, avail); =20 @@ -345,7 +344,7 @@ static void hda_audio_output_cb(void *opaque, int avail) uint32_t written =3D AUD_write(st->voice.out, st->buf + start, chu= nk); rpos +=3D written; to_transfer -=3D written; - atomic_fetch_add(&st->rpos, written); + st->rpos +=3D written; if (chunk !=3D written) { break; } --=20 2.9.3