From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: "Sarah Harris" <S.E.Harris@kent.ac.uk>,
"Thomas Huth" <huth@tuxfamily.org>,
"Joaquin de Andres" <me@xcancerberox.com.ar>,
"Michael Rolnik" <mrolnik@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 5/5] hw/char/avr_usart: Trace baudrate changes
Date: Fri, 14 Aug 2020 10:33:20 -0700 [thread overview]
Message-ID: <5933ecba-3c2f-be0e-6652-c4546f0363ff@linaro.org> (raw)
In-Reply-To: <20200814163924.11662-6-f4bug@amsat.org>
On 8/14/20 9:39 AM, Philippe Mathieu-Daudé wrote:
> +static void avr_usart_update_baudrate(AVRUsartState *s)
> +{
> + unsigned baudrate = (clock_get_hz(s->clkin) / USART_CLOCK_DIVISOR)
> + / (((s->brrh << 8) | s->brrl) + 1);
> +
> + trace_avr_usart_update_baudrate((s->brrh << 8) | s->brrl, baudrate);
Would you pull that brrh|brrl expression out and give it a name?
I do wonder if one division would be better, e.g.
baudrate = clock_get_hz / (DIVISOR * (regval + 1))
r~
next prev parent reply other threads:[~2020-08-14 17:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-14 16:39 [PATCH 0/5] hw/avr: Start using the Clock API Philippe Mathieu-Daudé
2020-08-14 16:39 ` [PATCH 1/5] hw/avr/atmega: Introduce the I/O clock Philippe Mathieu-Daudé
2020-08-14 16:39 ` [PATCH 2/5] hw/timer/avr_timer16: Use the Clock API Philippe Mathieu-Daudé
2020-08-14 16:39 ` [PATCH 3/5] hw/char/avr_usart: Restrict register definitions to source Philippe Mathieu-Daudé
2020-08-14 16:39 ` [PATCH 4/5] hw/char/avr_usart: Use the Clock API Philippe Mathieu-Daudé
2020-08-14 16:39 ` [PATCH 5/5] hw/char/avr_usart: Trace baudrate changes Philippe Mathieu-Daudé
2020-08-14 17:33 ` Richard Henderson [this message]
2020-08-26 20:19 ` [PATCH 0/5] hw/avr: Start using the Clock API Michael Rolnik
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=5933ecba-3c2f-be0e-6652-c4546f0363ff@linaro.org \
--to=richard.henderson@linaro.org \
--cc=S.E.Harris@kent.ac.uk \
--cc=f4bug@amsat.org \
--cc=huth@tuxfamily.org \
--cc=marcandre.lureau@redhat.com \
--cc=me@xcancerberox.com.ar \
--cc=mrolnik@gmail.com \
--cc=pbonzini@redhat.com \
--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).