From patchwork Sun Apr 16 20:27:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 97470 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1086961qgf; Sun, 16 Apr 2017 13:29:00 -0700 (PDT) X-Received: by 10.98.111.129 with SMTP id k123mr8493432pfc.18.1492374540745; Sun, 16 Apr 2017 13:29:00 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r75si8917811pfa.171.2017.04.16.13.29.00; Sun, 16 Apr 2017 13:29:00 -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 S1757037AbdDPU2n (ORCPT + 15 others); Sun, 16 Apr 2017 16:28:43 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:37090 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756945AbdDPU22 (ORCPT ); Sun, 16 Apr 2017 16:28:28 -0400 Received: by mail-wm0-f46.google.com with SMTP id u2so22405845wmu.0 for ; Sun, 16 Apr 2017 13:28:22 -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:in-reply-to:references; bh=gh2WjEnYAmC9r3IacH8MJaJew8Qi0AMxzjmrY1RRn0g=; b=EVcUt4O+9+g8KkXsJrYKm66LtV5B5yqVQPQ/0U1sS8fXUkaR+0PTGvo7xIcj33/fZf 2txxE+tEPzG3kl9AOtmhXUmcsy5F5VvnqbIFr+S/cnuUzCB3CqoL8PwhkN50fJ7QpEOS kACksHg3/HRIcWJ98h66uV8jUhXwkFR+HT+LI= 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:in-reply-to :references; bh=gh2WjEnYAmC9r3IacH8MJaJew8Qi0AMxzjmrY1RRn0g=; b=baCkJreiRjjv+VJgBqnNYsFHp8OCln9iC2IMug/TITDnLuVImpaRaHfamNJc/CEOlH YCRNMZ8VauhndELcJvCvqjj6yu7taKNIq2uhV1x04Aqg9H7GJK6GJKLdRqtA2jP0EKKB Qbcw8qc5t0+I163TL/NJiE871FR3HiBeETfG87ATL19oqLE2e7H//KfHfDTlqcGKYFJi 5qOUUGAgsi7HWMsc+TRGt4NhqdyQtVdvjnyGP++j6SqoHEr6OmAK65kEZkfKk7u7PeMX 0F4SWoXkfUfUVLhWLsVC1iQwlXCfzfGq8JS1fvlItLG/QqWtDCQAQ2+arlS9t78IBDAI kxcA== X-Gm-Message-State: AN3rC/6JeV6Y/GhIm80pRuyXj0eFcxpe+gi88Cdtokp2mpCydqD87Pe+ CieaW+S1/dGqOMKKLwM2tw== X-Received: by 10.28.203.132 with SMTP id b126mr6639422wmg.90.1492374496732; Sun, 16 Apr 2017 13:28:16 -0700 (PDT) Received: from mai.lan ([2001:41d0:fe90:b800:20c0:6248:a385:db35]) by smtp.gmail.com with ESMTPSA id 81sm7732196wmj.9.2017.04.16.13.28.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 16 Apr 2017 13:28:16 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, Marc Zyngier , Mark Rutland , linux-arm-kernel@lists.infradead.org (moderated list:ARM ARCHITECTED TIMER DRIVER) Subject: [PATCH 13/29] arm64: arch_timer: Move clocksource_counter and co around Date: Sun, 16 Apr 2017 22:27:03 +0200 Message-Id: <1492374441-23336-13-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492374441-23336-1-git-send-email-daniel.lezcano@linaro.org> References: <20170416202542.GV2078@mai> <1492374441-23336-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Zyngier In order to access clocksource_counter from the errata handling code, move it (together with the related structures and functions) towards the top of the file. Acked-by: Thomas Gleixner Signed-off-by: Marc Zyngier --- drivers/clocksource/arm_arch_timer.c | 62 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) -- 2.7.4 diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 4551587..395f5d9 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -158,6 +158,37 @@ u32 arch_timer_reg_read(int access, enum arch_timer_reg reg, return val; } +/* + * Default to cp15 based access because arm64 uses this function for + * sched_clock() before DT is probed and the cp15 method is guaranteed + * to exist on arm64. arm doesn't use this before DT is probed so even + * if we don't have the cp15 accessors we won't have a problem. + */ +u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct; + +static u64 arch_counter_read(struct clocksource *cs) +{ + return arch_timer_read_counter(); +} + +static u64 arch_counter_read_cc(const struct cyclecounter *cc) +{ + return arch_timer_read_counter(); +} + +static struct clocksource clocksource_counter = { + .name = "arch_sys_counter", + .rating = 400, + .read = arch_counter_read, + .mask = CLOCKSOURCE_MASK(56), + .flags = CLOCK_SOURCE_IS_CONTINUOUS, +}; + +static struct cyclecounter cyclecounter __ro_after_init = { + .read = arch_counter_read_cc, + .mask = CLOCKSOURCE_MASK(56), +}; + #ifdef CONFIG_FSL_ERRATUM_A008585 /* * The number of retries is an arbitrary value well beyond the highest number @@ -742,37 +773,6 @@ static u64 arch_counter_get_cntvct_mem(void) return ((u64) vct_hi << 32) | vct_lo; } -/* - * Default to cp15 based access because arm64 uses this function for - * sched_clock() before DT is probed and the cp15 method is guaranteed - * to exist on arm64. arm doesn't use this before DT is probed so even - * if we don't have the cp15 accessors we won't have a problem. - */ -u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct; - -static u64 arch_counter_read(struct clocksource *cs) -{ - return arch_timer_read_counter(); -} - -static u64 arch_counter_read_cc(const struct cyclecounter *cc) -{ - return arch_timer_read_counter(); -} - -static struct clocksource clocksource_counter = { - .name = "arch_sys_counter", - .rating = 400, - .read = arch_counter_read, - .mask = CLOCKSOURCE_MASK(56), - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - -static struct cyclecounter cyclecounter __ro_after_init = { - .read = arch_counter_read_cc, - .mask = CLOCKSOURCE_MASK(56), -}; - static struct arch_timer_kvm_info arch_timer_kvm_info; struct arch_timer_kvm_info *arch_timer_get_kvm_info(void)