[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2318694.E4xdUbedMD@ws-stein>
Date: Tue, 13 Jun 2017 10:19:47 +0200
From: Alexander Stein <alexander.stein@...tec-electronic.com>
To: linux-kernel@...r.kernel.org
Cc: Dong Aisheng <aisheng.dong@....com>,
linux-arm-kernel@...ts.infradead.org, daniel.lezcano@...aro.org,
tglx@...utronix.de, shawnguo@...nel.org, ping.bai@....com,
anson.huang@....com, dongas86@...il.com, kernel@...gutronix.de,
arnd@...db.de, Anson Huang <Anson.Huang@....com>
Subject: Re: [PATCH V2 2/2] timer: imx-tpm: add imx tpm timer support
On Tuesday 13 June 2017 15:58:45, Dong Aisheng wrote:
> diff --git a/drivers/clocksource/timer-imx-tpm.c
> b/drivers/clocksource/timer-imx-tpm.c new file mode 100644
> index 0000000..940a4f75
> --- /dev/null
> +++ b/drivers/clocksource/timer-imx-tpm.c
> @@ -0,0 +1,227 @@
> [...]
> +static int tpm_set_next_event(unsigned long delta,
> + struct clock_event_device *evt)
> +{
> + unsigned long next, now;
> +
> + next = readl(timer_base + TPM_CNT) + delta;
> + writel(next, timer_base + TPM_C0V);
> + now = readl(timer_base + TPM_CNT);
What about:
> now = readl(timer_base + TPM_CNT);
> next = now + delta;
> writel(next, timer_base + TPM_C0V);
> return 0;
> + return (int)((next - now) <= 0) ? -ETIME : 0;
Can this error actually happen, even with your implementation?
Best regards,
Alexander
Powered by blists - more mailing lists