From patchwork Tue Jun 13 21:48:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 105429 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp6512qgd; Tue, 13 Jun 2017 14:48:35 -0700 (PDT) X-Received: by 10.36.80.138 with SMTP id m132mr2697666itb.40.1497390515040; Tue, 13 Jun 2017 14:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497390515; cv=none; d=google.com; s=arc-20160816; b=x8Km9nzVyCEmpt8y4wf29SsKOk89e14qrqbe85QwfcH6xC5n21D0xVROFOi6VZgVQK gyQjgtXuRsscL+6eTcYnQw6SDDg7u4QiD7030/P/k4kj2h/qWRawkO5QAgDlKIncicVd s/5E7UoaNH6IXiVd/bqm54taMa2Y+PQWo/c2J8rArDpVQTGnJTtlnpOvJVI1L0MgymiA SFzqXUsVtoWhwXAwsGEBdLzIk4nXRNtFfS38MaPQ5+xnzHAmWUUE4tv+kHgqkrU7vWwL BvliqmisUhoiEjmgC5sd3SctS52QlacfFIRM8mEkh23ZwujRewfypXiCiW9tEH8uJTMw TViQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Eye5yAYxjbleiUaB2+CWr36BRwWJTUp0rhLWzLUSRi0=; b=r94w2c07mFUi9Y1eLlZh8pQh5qo4/l8bdQq3KBZsWJRb+jAskpQ8b9AHhh/AdMLvxP WDajMg26dCGe0fm/xYjqnpEzkgFT+HlSoS4BSzJwxCV6nrdhpWkwT2bkrinF7eR1bCO8 8rlo3270FaY8zZA7Tb7jYO9llYIsLxfV4upfk2fnFQyylr3W6BnJBUORuyLo9gK9eCW6 NvT41sr9W31R/pOclmc3Kdaw6EytZfbxYzX/1C+gqWlSPRoGlmcrTz2hT1vBJz4UW+h7 l6Tv2ZS7GHvEjJqgouuH+gAq6wuts+yQ91ruHM5y1b8DSVwdA+JKV6ku5TXNZTJMXXj2 +RNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 89si1450057ioj.53.2017.06.13.14.48.34; Tue, 13 Jun 2017 14:48:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753874AbdFMVsV (ORCPT + 25 others); Tue, 13 Jun 2017 17:48:21 -0400 Received: from mail-lf0-f44.google.com ([209.85.215.44]:33648 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752456AbdFMVsU (ORCPT ); Tue, 13 Jun 2017 17:48:20 -0400 Received: by mail-lf0-f44.google.com with SMTP id m77so55722651lfe.0 for ; Tue, 13 Jun 2017 14:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Eye5yAYxjbleiUaB2+CWr36BRwWJTUp0rhLWzLUSRi0=; b=WB3dFW7d+IVINnoKJNrZG2cuD3TkLcsjZXBKNm4udcJIZlT14S/4ceIcpkLuOLcn63 0ZIej2T2+bur7tZp+tIYsdFM9PBt5TAaHb9EZ8TkP8KcSEezGaM2tjWdqOcblbjWrpj9 8R4qrf8j5WuvenGivdWWlHT6tBTXcyI2AaKG0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Eye5yAYxjbleiUaB2+CWr36BRwWJTUp0rhLWzLUSRi0=; b=mKrCp3SdkJ5hnBbzJRKQVZRUPsRpKgTr9o7FSRvKVVhZdeEVK0tE2WN3JnrZcAontT uPjYOA+QDiu58/Dz1lav+okhYgUjgpf9Y2DHvDQ9PSY2B8OY8smq9plTFAzXsg1qMuSr 8zv/nlyyzl78CB57Prvqyc/1vlIgVAX5T84iJ29LSJMlZgrHziAKXOiOckyRMPXr7fYn HHucre0RTjyzsDjrmzKAVvJF5RZ08VRVp9OI9byx1yp4Vg0LMC3U7FNts4PEqy4uMcec PfM89GzYCzYu1aiF6ENHLWBDgjfgaeyFp5Fy8KfirFHU8rmOedaxYueXMoUfcZwXXfry Js/A== X-Gm-Message-State: AKS2vOxKQueuutgT7vUaU4wHEFJp3dydy3ZLL2dIKdq+vtyZCHezvD/w P6z6pcZbtK8PErIH X-Received: by 10.25.210.133 with SMTP id j127mr582262lfg.21.1497390498716; Tue, 13 Jun 2017 14:48:18 -0700 (PDT) Received: from fabina.bredbandsbolaget.se (c-797771d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.119.121]) by smtp.gmail.com with ESMTPSA id v21sm3705313ljd.9.2017.06.13.14.48.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 14:48:16 -0700 (PDT) From: Linus Walleij To: Daniel Lezcano , Thomas Gleixner , Joel Stanley , Jonas Jensen Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , linux-kernel@vger.kernel.org, Linus Walleij , Andrew Jeffery Subject: [PATCH] drivers/clocksource/fttmr010: Factor clock read code Date: Tue, 13 Jun 2017 23:48:13 +0200 Message-Id: <20170613214813.11406-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sched_clock() and delay timer callbacks can just call each other and we can save an #ifdef. Suggested-by: Daniel Lezcano Cc: Andrew Jeffery Cc: Joel Stanley Cc: Jonas Jensen Signed-off-by: Linus Walleij --- Daniel: feel free to apply as-is or squash into the other patch as you like. --- drivers/clocksource/timer-fttmr010.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) -- 2.9.4 diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c index 0074d89cd2ce..bb07787229b6 100644 --- a/drivers/clocksource/timer-fttmr010.c +++ b/drivers/clocksource/timer-fttmr010.c @@ -98,30 +98,26 @@ static inline struct fttmr010 *to_fttmr010(struct clock_event_device *evt) return container_of(evt, struct fttmr010, clkevt); } -static u64 notrace fttmr010_read_sched_clock_up(void) +static unsigned long fttmr010_read_current_timer_up(void) { return readl(local_fttmr->base + TIMER2_COUNT); } -static u64 notrace fttmr010_read_sched_clock_down(void) +static unsigned long fttmr010_read_current_timer_down(void) { return ~readl(local_fttmr->base + TIMER2_COUNT); } -#ifdef CONFIG_ARM - -static unsigned long fttmr010_read_current_timer_up(void) +static u64 notrace fttmr010_read_sched_clock_up(void) { - return readl(local_fttmr->base + TIMER2_COUNT); + return fttmr010_read_current_timer_up(); } -static unsigned long fttmr010_read_current_timer_down(void) +static u64 notrace fttmr010_read_sched_clock_down(void) { - return ~readl(local_fttmr->base + TIMER2_COUNT); + return fttmr010_read_current_timer_down(); } -#endif - static int fttmr010_timer_set_next_event(unsigned long cycles, struct clock_event_device *evt) {