From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] clocksource: armada-370-xp: Use atomic access for shared registers
Date: Thu, 20 Feb 2014 08:59:34 +0100 [thread overview]
Message-ID: <5305B5E6.2060906@linaro.org> (raw)
In-Reply-To: <1392840326-29417-3-git-send-email-ezequiel.garcia@free-electrons.com>
On 02/19/2014 09:05 PM, Ezequiel Garcia wrote:
> Replace the driver-specific thread-safe shared register API
> by the recently introduced atomic_io_clear_set().
Hi Ezequiel,
AFAICS, the code is lockless, your change adds a lock.
What race is it supposed to fix ?
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> drivers/clocksource/time-armada-370-xp.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
> index ee8691b..0451e62 100644
> --- a/drivers/clocksource/time-armada-370-xp.c
> +++ b/drivers/clocksource/time-armada-370-xp.c
> @@ -85,12 +85,6 @@ static u32 ticks_per_jiffy;
>
> static struct clock_event_device __percpu *armada_370_xp_evt;
>
> -static void timer_ctrl_clrset(u32 clr, u32 set)
> -{
> - writel((readl(timer_base + TIMER_CTRL_OFF) & ~clr) | set,
> - timer_base + TIMER_CTRL_OFF);
> -}
> -
> static void local_timer_ctrl_clrset(u32 clr, u32 set)
> {
> writel((readl(local_base + TIMER_CTRL_OFF) & ~clr) | set,
> @@ -245,7 +239,7 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
> clr = TIMER0_25MHZ;
> enable_mask = TIMER0_EN | TIMER0_DIV(TIMER_DIVIDER_SHIFT);
> }
> - timer_ctrl_clrset(clr, set);
> + atomic_io_modify(timer_base + TIMER_CTRL_OFF, clr | set, set);
> local_timer_ctrl_clrset(clr, set);
>
> /*
> @@ -263,7 +257,9 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
> writel(0xffffffff, timer_base + TIMER0_VAL_OFF);
> writel(0xffffffff, timer_base + TIMER0_RELOAD_OFF);
>
> - timer_ctrl_clrset(0, TIMER0_RELOAD_EN | enable_mask);
> + atomic_io_modify(timer_base + TIMER_CTRL_OFF,
> + TIMER0_RELOAD_EN | enable_mask,
> + TIMER0_RELOAD_EN | enable_mask);
>
> /*
> * Set scale and timer for sched_clock.
>
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2014-02-20 7:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 20:05 [PATCH 0/2] Make Armada 370/XP and Orion clocksource use atomic I/O API Ezequiel Garcia
2014-02-19 20:05 ` [PATCH 1/2] clocksource: orion: Use atomic access for shared registers Ezequiel Garcia
2014-02-20 7:51 ` Daniel Lezcano
2014-02-19 20:05 ` [PATCH 2/2] clocksource: armada-370-xp: " Ezequiel Garcia
2014-02-20 7:59 ` Daniel Lezcano [this message]
2014-02-20 8:02 ` Daniel Lezcano
2014-02-20 8:39 ` Daniel Lezcano
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=5305B5E6.2060906@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).