From: Peter Chubb <peter.chubb@nicta.com.au>
To: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Cc: peter.maydell@linaro.org, peter.chubb@nicta.com.au,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] i.MX: Improve EPIT timer code.
Date: Tue, 28 May 2013 09:36:22 +1000 [thread overview]
Message-ID: <84d2sct2q1.wl%peter@chubb.wattle.id.au> (raw)
In-Reply-To: <1369691927-27832-1-git-send-email-jcd@tribudubois.net>
Hi Jean,
Thanks for this. Most of it appears cosmetic and an improvement.
Comments in-line below.
>
> /*
> * Update interrupt status
> */
> -static void imx_timerp_update(IMXTimerPState *s)
> +static void imx_timer_epit_update(IMXTimerEPITState *s)
> {
> - if (s->sr && (s->cr & CR_OCIEN)) {
> + if (s->sr && (s->cr & CR_OCIEN) && (s->cr & CR_EN)) {
Why not
if (s->sr && (s->cr & (CR_OCIEN|CR_EN) == (CR_OCIEN|CR_EN)))
> qemu_irq_raise(s->irq);
> } else {
> qemu_irq_lower(s->irq);
> }
> }
>
> -static void set_timerp_freq(IMXTimerPState *s)
> +static void imx_timer_epit_set_freq(IMXTimerEPITState *s)
> {
> unsigned clksrc;
> unsigned prescaler;
> - uint32_t freq;
getting rid of this variable means a pointer dereference every time
below. That's OK at some optimisation levels and for some compilers
as they'll cache the variable. But I prefer making this explicit so
less competent compilers can avoid the pointer dereference.
>
> clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, 2);
> prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, 12);
>
> - freq = imx_clock_frequency(s->ccm, imx_timerp_clocks[clksrc]) / prescaler;
> + s->freq = imx_clock_frequency(s->ccm,
> + imx_timer_epit_clocks[clksrc]) / prescaler;
>
> - s->freq = freq;
> DPRINTF("Setting ptimer frequency to %u\n", freq);
And here it's inconsistent --- s/freq/s->freq/ and as you've renamed,
maybe s/ptimer/epit/
The rest looks OK.
I'm not that keen on the longer names, though.
Maybe s/timer_epit/epit/ throughout.
--
Dr Peter Chubb peter.chubb AT nicta.com.au
http://www.ssrg.nicta.com.au Software Systems Research Group/NICTA
prev parent reply other threads:[~2013-05-27 23:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 21:58 [Qemu-devel] [PATCH] i.MX: Improve EPIT timer code Jean-Christophe DUBOIS
2013-05-27 23:36 ` Peter Chubb [this message]
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=84d2sct2q1.wl%peter@chubb.wattle.id.au \
--to=peter.chubb@nicta.com.au \
--cc=jcd@tribudubois.net \
--cc=peter.maydell@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).