From patchwork Mon May 9 12:32:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 9046111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1BD22BF29F for ; Mon, 9 May 2016 12:36:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 498302010B for ; Mon, 9 May 2016 12:36:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A9CC2011E for ; Mon, 9 May 2016 12:36:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1azkO6-0004my-Cy; Mon, 09 May 2016 12:34:14 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1azkNP-0003jo-0R for linux-arm-kernel@lists.infradead.org; Mon, 09 May 2016 12:33:33 +0000 Received: by mail-pa0-x231.google.com with SMTP id r5so74177226pag.1 for ; Mon, 09 May 2016 05:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YG21zFnKyt//SVm5vC2EgoLZ0C68Q9LX32QZ9rDvPlU=; b=iJ0MUtXfT9v2Cz1ezcY9AWKipJMCIQgZxtXS5MFv+/eGuiF1eLWXGXM3CrYdQTzPKb 3M3C+4IS2noKeBlRhp47Zb/bu9yMSnRgL1fvVu4G4pFQEZQthgq+SXRLHZiTOKMHyQh3 gV+lAoe5Xh0JXvC6zi/z/8ciDAWNUXaPorzM8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YG21zFnKyt//SVm5vC2EgoLZ0C68Q9LX32QZ9rDvPlU=; b=mcSINK7qKMv0ayetIX9TuZI7LGKqYV0+S4QYkQI0J7WWcOX9l+08ET9+lsJ4RCQUWH o/wif1njhS7C5h/UPo091OtOe8yQfz6i+3NnQbM53Aw69spxNY8S9rWc3S1uvgSEVk9U wAPK8oBJz9Hht7efjGE7YRLnvMp2bniLnqN5AEXxcJt9KQcv3kvubWwDd7ldu4NFX/ti /vBmb3FxALsWMUMCsS84dzrjHx2zv7rQ7n2/Tmkaq4aaXvYM4ShoYzZSMRZJIyllnX9D OHnaPfAzs1/qunkW5vChW9YelcVJnrQTVCnXaQxMDpS/KgcX+cZbIXosi6fqrsPyy9wD SgpQ== X-Gm-Message-State: AOPr4FUl5flYU59QhtzAIdUCxbf8v3G3BPr3UQa2qFbJL1fFdLdfr++9E39aLoqlfs3hfA== X-Received: by 10.66.78.73 with SMTP id z9mr49550670paw.4.1462797190126; Mon, 09 May 2016 05:33:10 -0700 (PDT) Received: from icarus.au.ibm.com ([2403:480:11:10:3400:b218:cbe9:48cb]) by smtp.gmail.com with ESMTPSA id e2sm34452101pfd.20.2016.05.09.05.33.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 May 2016 05:33:09 -0700 (PDT) From: Joel Stanley To: daniel.lezcano@linaro.org, tglx@linutronix.de, jonas.jensen@gmail.com Subject: [PATCH 2/4] drivers/clocksource/moxart: Refactor enable/disable Date: Mon, 9 May 2016 22:02:47 +0930 Message-Id: <1462797169-14512-3-git-send-email-joel@jms.id.au> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1462797169-14512-1-git-send-email-joel@jms.id.au> References: <1462797169-14512-1-git-send-email-joel@jms.id.au> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160509_053331_411410_AE8B9551 X-CRM114-Status: GOOD ( 12.60 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, arnd@arndb.de, jk@ozlabs.org, linux-arm-kernel@lists.infradead.org, benh@kernel.crashing.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Joel Stanley --- drivers/clocksource/moxart_timer.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/clocksource/moxart_timer.c b/drivers/clocksource/moxart_timer.c index 19857af651c1..b00b2b21e8b3 100644 --- a/drivers/clocksource/moxart_timer.c +++ b/drivers/clocksource/moxart_timer.c @@ -58,15 +58,25 @@ static void __iomem *base; static unsigned int clock_count_per_tick; -static int moxart_shutdown(struct clock_event_device *evt) +static inline void moxart_disable(struct clock_event_device *evt) { writel(TIMER1_DISABLE, base + TIMER_CR); +} + +static inline void moxart_enable(struct clock_event_device *evt) +{ + writel(TIMER1_ENABLE, base + TIMER_CR); +} + +static int moxart_shutdown(struct clock_event_device *evt) +{ + moxart_disable(evt); return 0; } static int moxart_set_oneshot(struct clock_event_device *evt) { - writel(TIMER1_DISABLE, base + TIMER_CR); + moxart_disable(evt); writel(~0, base + TIMER1_BASE + REG_LOAD); return 0; } @@ -74,21 +84,21 @@ static int moxart_set_oneshot(struct clock_event_device *evt) static int moxart_set_periodic(struct clock_event_device *evt) { writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); - writel(TIMER1_ENABLE, base + TIMER_CR); + moxart_enable(evt); return 0; } static int moxart_clkevt_next_event(unsigned long cycles, - struct clock_event_device *unused) + struct clock_event_device *evt) { u32 u; - writel(TIMER1_DISABLE, base + TIMER_CR); + moxart_disable(evt); u = readl(base + TIMER1_BASE + REG_COUNT) - cycles; writel(u, base + TIMER1_BASE + REG_MATCH1); - writel(TIMER1_ENABLE, base + TIMER_CR); + moxart_enable(evt); return 0; }