[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/8] hw/timer/sh_timer: Switch to transaction-based ptimer AP
From: |
Richard Henderson |
Subject: |
Re: [PATCH 2/8] hw/timer/sh_timer: Switch to transaction-based ptimer API |
Date: |
Thu, 17 Oct 2019 07:49:36 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 10/17/19 6:28 AM, Peter Maydell wrote:
> Switch the sh_timer code away from bottom-half based ptimers to the
> new transaction-based ptimer API. This just requires adding
> begin/commit calls around the various places that modify the ptimer
> state, and using the new ptimer_init() function to create the timer.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> hw/timer/sh_timer.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
> @@ -168,12 +173,14 @@ static void sh_timer_start_stop(void *opaque, int
> enable)
> printf("sh_timer_start_stop %d (%d)\n", enable, s->enabled);
> #endif
>
> + ptimer_transaction_begin(s->timer);
> if (s->enabled && !enable) {
> ptimer_stop(s->timer);
> }
> if (!s->enabled && enable) {
> ptimer_run(s->timer, 0);
> }
> + ptimer_transaction_commit(s->timer);
> s->enabled = !!enable;
Ew. Future cleanup should perhaps be
- static void sh_timer_start_stop(void *opaque, int enable)
+ static void sh_timer_start_stop(void *opaque, bool enable)
if (s->enabled != enable) {
s->enabled = enable;
ptimer_transaction_begin(s->timer);
if (enable) {
ptimer_run(s->timer, 0);
} else {
ptimer_stop(s->timer);
}
ptimer_transaction_commit(s->timer);
}
r~