From: "Volker Rümelin" <vr_qemu@t-online.de>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
qemu-devel@nongnu.org
Subject: [PATCH 6/8] hw/audio/es1370: block structure coding style fixes
Date: Sun, 17 Sep 2023 08:58:11 +0200 [thread overview]
Message-ID: <20230917065813.6692-6-vr_qemu@t-online.de> (raw)
In-Reply-To: <cfc5a196-9939-44b5-8716-9525f1a08a2a@t-online.de>
Change the block structure according to the QEMU Coding Style
documentation.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
hw/audio/es1370.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index e1ca6a4cd5..86a869d4da 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -309,8 +309,7 @@ static void es1370_update_status (ES1370State *s, uint32_t new_status)
if (level) {
s->status = new_status | STAT_INTR;
- }
- else {
+ } else {
s->status = new_status & ~STAT_INTR;
}
pci_set_irq(&s->dev, !!level);
@@ -333,8 +332,7 @@ static void es1370_reset (ES1370State *s)
if (i == ADC_CHANNEL) {
AUD_close_in (&s->card, s->adc_voice);
s->adc_voice = NULL;
- }
- else {
+ } else {
AUD_close_out (&s->card, s->dac_voice[i]);
s->dac_voice[i] = NULL;
}
@@ -421,8 +419,7 @@ static void es1370_update_voices (ES1370State *s, uint32_t ctl, uint32_t sctl)
es1370_adc_callback,
&as
);
- }
- else {
+ } else {
s->dac_voice[i] =
AUD_open_out (
&s->card,
@@ -442,8 +439,7 @@ static void es1370_update_voices (ES1370State *s, uint32_t ctl, uint32_t sctl)
if (i == ADC_CHANNEL) {
AUD_set_active_in (s->adc_voice, on);
- }
- else {
+ } else {
AUD_set_active_out (s->dac_voice[i], on);
}
}
@@ -456,8 +452,9 @@ static void es1370_update_voices (ES1370State *s, uint32_t ctl, uint32_t sctl)
static inline uint32_t es1370_fixup (ES1370State *s, uint32_t addr)
{
addr &= 0xff;
- if (addr >= 0x30 && addr <= 0x3f)
+ if (addr >= 0x30 && addr <= 0x3f) {
addr |= s->mempage << 8;
+ }
return addr;
}
@@ -630,8 +627,9 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
to_copy = MIN ((size_t) temp, sizeof (tmpbuf));
acquired = AUD_read (s->adc_voice, tmpbuf, to_copy);
- if (!acquired)
+ if (!acquired) {
break;
+ }
pci_dma_write (&s->dev, addr, tmpbuf, acquired);
@@ -639,8 +637,7 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
addr += acquired;
transferred += acquired;
}
- }
- else {
+ } else {
SWVoiceOut *voice = s->dac_voice[index];
while (temp > 0) {
@@ -649,8 +646,9 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
to_copy = MIN ((size_t) temp, sizeof (tmpbuf));
pci_dma_read (&s->dev, addr, tmpbuf, to_copy);
copied = AUD_write (voice, tmpbuf, to_copy);
- if (!copied)
+ if (!copied) {
break;
+ }
temp -= copied;
addr += copied;
transferred += copied;
@@ -660,8 +658,7 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
if (csc_bytes == transferred) {
*irq = 1;
d->scount = sc | (sc << 16);
- }
- else {
+ } else {
*irq = 0;
d->scount = sc | (((csc_bytes - transferred - 1) >> d->shift) << 16);
}
@@ -672,12 +669,12 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel,
/* Bah, how stupid is that having a 0 represent true value?
i just spent few hours on this shit */
AUD_log ("es1370: warning", "non looping mode\n");
- }
- else {
+ } else {
d->frame_cnt = size;
- if ((uint32_t) cnt <= d->frame_cnt)
+ if ((uint32_t) cnt <= d->frame_cnt) {
d->frame_cnt |= cnt << 16;
+ }
}
d->leftover = (transferred + d->leftover) & 3;
@@ -778,8 +775,7 @@ static int es1370_post_load (void *opaque, int version_id)
AUD_close_in (&s->card, s->adc_voice);
s->adc_voice = NULL;
}
- }
- else {
+ } else {
if (s->dac_voice[i]) {
AUD_close_out (&s->card, s->dac_voice[i]);
s->dac_voice[i] = NULL;
--
2.35.3
next prev parent reply other threads:[~2023-09-17 6:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-17 6:55 [PATCH 0/8] hw/audio/es1370: bug fix Volker Rümelin
2023-09-17 6:58 ` [PATCH 1/8] hw/audio/es1370: reset current sample counter Volker Rümelin
2023-09-17 6:58 ` [PATCH 2/8] hw/audio/es1370: replace bit-rotted code with tracepoints Volker Rümelin
2023-09-17 6:58 ` [PATCH 3/8] hw/audio/es1370: remove unused dolog macro Volker Rümelin
2023-09-17 6:58 ` [PATCH 4/8] hw/audio/es1370: remove #ifdef ES1370_DEBUG to avoid bit rot Volker Rümelin
2023-09-17 6:58 ` [PATCH 5/8] hw/audio/es1370: remove #ifdef ES1370_VERBOSE " Volker Rümelin
2023-09-17 6:58 ` Volker Rümelin [this message]
2023-09-17 6:58 ` [PATCH 7/8] hw/audio/es1370: change variable type and name Volker Rümelin
2023-09-17 6:58 ` [PATCH 8/8] hw/audio/es1370: trace lost interrupts Volker Rümelin
2023-09-18 11:19 ` [PATCH 0/8] hw/audio/es1370: bug fix Marc-André Lureau
2023-10-10 12:24 ` BALATON Zoltan
2023-10-11 6:30 ` Marc-André Lureau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230917065813.6692-6-vr_qemu@t-online.de \
--to=vr_qemu@t-online.de \
--cc=balaton@eik.bme.hu \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).