From patchwork Fri Dec 18 14:18:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 58694 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp1060031lbb; Fri, 18 Dec 2015 06:26:01 -0800 (PST) X-Received: by 10.98.67.148 with SMTP id l20mr5625548pfi.109.1450448761085; Fri, 18 Dec 2015 06:26:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cj5si24346970pad.65.2015.12.18.06.26.00; Fri, 18 Dec 2015 06:26:01 -0800 (PST) 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; 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753914AbbLROZ7 (ORCPT + 29 others); Fri, 18 Dec 2015 09:25:59 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:32942 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753729AbbLROTu (ORCPT ); Fri, 18 Dec 2015 09:19:50 -0500 Received: by mail-wm0-f47.google.com with SMTP id p187so66848031wmp.0 for ; Fri, 18 Dec 2015 06:19:50 -0800 (PST) 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=Fi08gXctfdo3AUa8OcoUZMbCQmda4Bv2Nz9o2Lanj9c=; b=Yo1S+oQ3UYUTcxWHi/RFzq5C4EIzK8uIwYWFrW99wNWbcVwux4vsCEHijWc2moaxAR KusDilPKW3MTWqeXncEquwoFtPh8yqDAg54dW/QNU5VlXIJtjQMlLmverVsiRVZ2jYvE nsa9xHdD0RZGmlaB1E0iZSnsCSYgAcEn0+Zg8= 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=Fi08gXctfdo3AUa8OcoUZMbCQmda4Bv2Nz9o2Lanj9c=; b=BJFLfT0Jzy7mQMKyeCccgpuLkWDjjbmwH0SXVVkRNmU7oB9Qq6iQSCYfpnwGfIKoXL lsIrsHHk/ojYzOdOwoWqZDCvyFmoEoC5DFQYfddpjBtCYiOSMslxIJX6H8rGMNJzd9BD Khzm8HoEzpPgrmIuA9LQv/aOUvbkw8Nnnjl2Q0rFd0jeIh5bDtQgCamDV1mRlnxAYQKR ZqUwNGO6WMCFW0fU0zQOKyUrtu0hLteYRxlrW/XlYzsHasAmi3PPepWutDDD73llSQ5I zBdbbGQjWosOBHcX5M6rXgcKqtIazov5ZjEfpFvJIUj0TbXtCGSAgp863lukin0zcoah s0fA== X-Gm-Message-State: ALoCoQnnewIiBEXexH/AZixEMXNXeuzcGs96HkfZb7d8Yil0JObk5ZoE6qkRjObOr5IRzwvx7JlnkA/RUfVgrHstdpVqYLaDCQ== X-Received: by 10.194.246.132 with SMTP id xw4mr4427329wjc.75.1450448389595; Fri, 18 Dec 2015 06:19:49 -0800 (PST) Received: from localhost.localdomain ([78.210.255.2]) by smtp.gmail.com with ESMTPSA id ql10sm15010027wjc.23.2015.12.18.06.19.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 06:19:49 -0800 (PST) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mingo@kernel.org Subject: [PATCH 57/69] clocksource/drivers/tango-xtal: Replace code by clocksource_mmio_init Date: Fri, 18 Dec 2015 15:18:10 +0100 Message-Id: <1450448302-27429-57-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450448302-27429-1-git-send-email-daniel.lezcano@linaro.org> References: <5672CB9E.7090707@linaro.org> <1450448302-27429-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 The current code to initialize, register and read the clocksource is already factored out in mmio.c via the clocksource_mmio_init function. Factor out the code with the clocksource_mmio_init function. Signed-off-by: Daniel Lezcano --- drivers/clocksource/Kconfig | 1 + drivers/clocksource/tango_xtal.c | 18 +++--------------- 2 files changed, 4 insertions(+), 15 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index db240cb..b251013 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -351,6 +351,7 @@ config CLKSRC_TANGO_XTAL bool "Clocksource for Tango SoC" if COMPILE_TEST depends on ARM select CLKSRC_OF + select CLKSRC_MMIO help This enables the clocksource for Tango SoC diff --git a/drivers/clocksource/tango_xtal.c b/drivers/clocksource/tango_xtal.c index d297b30..2bcecaf 100644 --- a/drivers/clocksource/tango_xtal.c +++ b/drivers/clocksource/tango_xtal.c @@ -19,19 +19,6 @@ static u64 notrace read_sched_clock(void) return read_xtal_counter(); } -static cycle_t read_clocksource(struct clocksource *cs) -{ - return read_xtal_counter(); -} - -static struct clocksource tango_xtal = { - .name = "tango-xtal", - .rating = 350, - .read = read_clocksource, - .mask = CLOCKSOURCE_MASK(32), - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - static void __init tango_clocksource_init(struct device_node *np) { struct clk *clk; @@ -53,8 +40,9 @@ static void __init tango_clocksource_init(struct device_node *np) delay_timer.freq = xtal_freq; delay_timer.read_current_timer = read_xtal_counter; - ret = clocksource_register_hz(&tango_xtal, xtal_freq); - if (ret != 0) { + ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350, + 32, clocksource_mmio_readl_up); + if (!ret) { pr_err("%s: registration failed\n", np->full_name); return; }