From patchwork Fri Dec 18 14:18:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 58686 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp1056329lbb; Fri, 18 Dec 2015 06:19:48 -0800 (PST) X-Received: by 10.66.164.234 with SMTP id yt10mr5538733pab.11.1450448387436; Fri, 18 Dec 2015 06:19:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o65si19201858pfa.179.2015.12.18.06.19.47; Fri, 18 Dec 2015 06:19:47 -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 S964895AbbLROTl (ORCPT + 29 others); Fri, 18 Dec 2015 09:19:41 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:35270 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933167AbbLROTi (ORCPT ); Fri, 18 Dec 2015 09:19:38 -0500 Received: by mail-wm0-f52.google.com with SMTP id l126so66177374wml.0 for ; Fri, 18 Dec 2015 06:19:37 -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=n/cE5UeqGe4k0IonnTID00qwhw4jrwVDoTNFKqu0DDw=; b=K+2xIhGRW0NY8HNT7WRfY8NpdNCq4xWT+jwzZDN6fZ2KSM8QUIuqRusmwZBN5CXis0 iYezSTnuPhjSvQipKjJUnuFzq1MSba37pYG4VGCC9wAchGLyMJUf8H1JzyB6/O1xIovD dWg9IyQCBUJS4deG77FxKiIxouTxv4PxSzCEQ= 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=n/cE5UeqGe4k0IonnTID00qwhw4jrwVDoTNFKqu0DDw=; b=dJfTCz0D0HetDNupIky9aUYuubVgzQwgAuvGYenFxlhvaXQycco8+b3wBECoy4xSZv ISQgekTPtDOn+H0iOzJHUJvAVZPckq01m7VVIWmlQ7MMKIklh8Ce7eU/QUFu79jgRJnZ R54N0IdvdPLrUm/OUb1zkpKiryB/esn1vDw1hi33+AtLO6As3WWGi2v7WtsA7Lc2NekM A32nriqdVlbsnEwZF43ywd3wz1ihtC5U/Ta+iFuCwNwVBrntr23OfMZZA7lO3khoUpcZ 5IRSjug22Xl3g9gQ+oA4cE1hpOS3JkbopTZZ6RJCBzCkeRMItY3SwpwUZX8DrpD+K68T s9rg== X-Gm-Message-State: ALoCoQkzA55gXC6XEKITR5yWEhehNwkG9x3zvEYPhCd/k+vzmL0ZnF/8zyY4bdHcQ8h/T9HbZbrjQYswrkmME84cXUBRg5+6sg== X-Received: by 10.194.85.165 with SMTP id i5mr4815478wjz.173.1450448377040; Fri, 18 Dec 2015 06:19:37 -0800 (PST) Received: from localhost.localdomain ([78.210.255.2]) by smtp.gmail.com with ESMTPSA id ql10sm15010027wjc.23.2015.12.18.06.19.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 06:19:36 -0800 (PST) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mingo@kernel.org, Maxime Ripard , Chen-Yu Tsai Subject: [PATCH 53/69] clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init Date: Fri, 18 Dec 2015 15:18:06 +0100 Message-Id: <1450448302-27429-53-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. The only difference is the readl vs readl_relaxed. Factor out the code with the clocksource_mmio_init function. Signed-off-by: Daniel Lezcano Acked-by: Maxime Ripard --- drivers/clocksource/timer-sun5i.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 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/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index bca9573..24c83f9 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c @@ -152,13 +152,6 @@ static irqreturn_t sun5i_timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static cycle_t sun5i_clksrc_read(struct clocksource *clksrc) -{ - struct sun5i_timer_clksrc *cs = to_sun5i_timer_clksrc(clksrc); - - return ~readl(cs->timer.base + TIMER_CNTVAL_LO_REG(1)); -} - static int sun5i_rate_cb_clksrc(struct notifier_block *nb, unsigned long event, void *data) { @@ -217,13 +210,8 @@ static int __init sun5i_setup_clocksource(struct device_node *node, writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD, base + TIMER_CTL_REG(1)); - cs->clksrc.name = node->name; - cs->clksrc.rating = 340; - cs->clksrc.read = sun5i_clksrc_read; - cs->clksrc.mask = CLOCKSOURCE_MASK(32); - cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS; - - ret = clocksource_register_hz(&cs->clksrc, rate); + ret = clocksource_mmio_init(base + TIMER_CNTVAL_LO_REG(1), node->name, + rate, 340, 32, clocksource_mmio_readl_down); if (ret) { pr_err("Couldn't register clock source.\n"); goto err_remove_notifier;