From patchwork Thu Jun 18 10:54:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50026 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E7325228CC for ; Thu, 18 Jun 2015 11:01:32 +0000 (UTC) Received: by wguu7 with SMTP id u7sf4248110wgu.0 for ; Thu, 18 Jun 2015 04:01:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=X8bPmv/YavKxBBZmIKs2JuKlYnvnqnFxPDDL8JJsdXo=; b=UGhlq/wi796lO0WKxJ9yrIdvkgUoXxP4Yq503BSgFc+FUM5AZ3ybKtaJPtP+fcONSn i4SH9rRfJqg9Jm0bklNw24roSUp5HHdlvC5wCf/pbCkKYN+qQfEPsAqLdwd2bsR7jFZA abGEejiqP3DldAFbTEe4OK8U50yNdqy4DF5RVn5pubsHWTTAK5gS/M0RNGcrg7Ab/pJA WItg/Sl2xMB3reqDTBTNcSBNOd9WtJCHZ3RQZqw2a+TZ7cPE2/CciI6FBX9RE2LTj9by ktRPFs2SD2+DpSwBrcin6+8FWybxYeLYNy6bSJUAag31bN8oF2gPKLpR5jeZPkD+x7P5 f/HA== X-Gm-Message-State: ALoCoQk7i8oLZiKLppwgStk4yZOLQwCDezf2BTdxlwNqYXVBkbjGMyw0txVu4uuS49HqHr3wd7+N X-Received: by 10.152.116.66 with SMTP id ju2mr9847255lab.7.1434625292157; Thu, 18 Jun 2015 04:01:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.34 with SMTP id n2ls419317laj.15.gmail; Thu, 18 Jun 2015 04:01:32 -0700 (PDT) X-Received: by 10.152.23.234 with SMTP id p10mr12403567laf.52.1434625291985; Thu, 18 Jun 2015 04:01:31 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id xa2si6172382lbb.156.2015.06.18.04.01.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 04:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laka10 with SMTP id a10so51914157lak.0 for ; Thu, 18 Jun 2015 04:01:31 -0700 (PDT) X-Received: by 10.152.121.67 with SMTP id li3mr12256091lab.29.1434625291882; Thu, 18 Jun 2015 04:01:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1097649lbb; Thu, 18 Jun 2015 04:01:30 -0700 (PDT) X-Received: by 10.68.200.69 with SMTP id jq5mr20072313pbc.111.1434625290174; Thu, 18 Jun 2015 04:01:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kf9si10866556pad.137.2015.06.18.04.01.29; Thu, 18 Jun 2015 04:01:30 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755498AbbFRLBX (ORCPT + 30 others); Thu, 18 Jun 2015 07:01:23 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:34035 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754759AbbFRK5G (ORCPT ); Thu, 18 Jun 2015 06:57:06 -0400 Received: by pdbki1 with SMTP id ki1so64249454pdb.1 for ; Thu, 18 Jun 2015 03:57:06 -0700 (PDT) X-Received: by 10.70.29.164 with SMTP id l4mr20081521pdh.32.1434625026193; Thu, 18 Jun 2015 03:57:06 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id jz10sm7643314pbc.48.2015.06.18.03.57.05 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:57:05 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Santosh Shilimkar Subject: [PATCH 34/41] clocksource: keystone: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:48 +0530 Message-Id: <586b9c3f64a4d84ff4b8e079ad79bce7ab761de8.1434622147.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Migrate keystone driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED. Also pass the mode-mask to keystone_timer_config() instead of the mode as mode macro's aren't valid anymore. Cc: Santosh Shilimkar Signed-off-by: Viresh Kumar --- drivers/clocksource/timer-keystone.c | 44 +++++++++++++----------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c index 0250354f7e55..edacf3902e10 100644 --- a/drivers/clocksource/timer-keystone.c +++ b/drivers/clocksource/timer-keystone.c @@ -72,10 +72,10 @@ static inline void keystone_timer_barrier(void) /** * keystone_timer_config: configures timer to work in oneshot/periodic modes. - * @ mode: mode to configure + * @ mask: mask of the mode to configure * @ period: cycles number to configure for */ -static int keystone_timer_config(u64 period, enum clock_event_mode mode) +static int keystone_timer_config(u64 period, int mask) { u32 tcr; u32 off; @@ -84,16 +84,7 @@ static int keystone_timer_config(u64 period, enum clock_event_mode mode) off = tcr & ~(TCR_ENAMODE_MASK); /* set enable mode */ - switch (mode) { - case CLOCK_EVT_MODE_ONESHOT: - tcr |= TCR_ENAMODE_ONESHOT_MASK; - break; - case CLOCK_EVT_MODE_PERIODIC: - tcr |= TCR_ENAMODE_PERIODIC_MASK; - break; - default: - return -1; - } + tcr |= mask; /* disable timer */ keystone_timer_writel(off, TCR); @@ -138,24 +129,19 @@ static irqreturn_t keystone_timer_interrupt(int irq, void *dev_id) static int keystone_set_next_event(unsigned long cycles, struct clock_event_device *evt) { - return keystone_timer_config(cycles, evt->mode); + return keystone_timer_config(cycles, TCR_ENAMODE_ONESHOT_MASK); } -static void keystone_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int keystone_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - keystone_timer_config(timer.hz_period, CLOCK_EVT_MODE_PERIODIC); - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_ONESHOT: - keystone_timer_disable(); - break; - default: - break; - } + keystone_timer_disable(); + return 0; +} + +static int keystone_set_periodic(struct clock_event_device *evt) +{ + keystone_timer_config(timer.hz_period, TCR_ENAMODE_PERIODIC_MASK); + return 0; } static void __init keystone_timer_init(struct device_node *np) @@ -222,7 +208,9 @@ static void __init keystone_timer_init(struct device_node *np) /* setup clockevent */ event_dev->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; event_dev->set_next_event = keystone_set_next_event; - event_dev->set_mode = keystone_set_mode; + event_dev->set_state_shutdown = keystone_shutdown; + event_dev->set_state_periodic = keystone_set_periodic; + event_dev->set_state_oneshot = keystone_shutdown; event_dev->cpumask = cpu_all_mask; event_dev->owner = THIS_MODULE; event_dev->name = TIMER_NAME;