From patchwork Thu Jun 18 10:54:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50015 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 15B77228CC for ; Thu, 18 Jun 2015 10:58:18 +0000 (UTC) Received: by wibdt2 with SMTP id dt2sf20735718wib.3 for ; Thu, 18 Jun 2015 03:58:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:in-reply-to:references:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list; bh=FIqTQLr0lBi7KOpFQWqjUWq+MiMLafnNfbKl0SiaJPk=; b=l9+VD6kSIe1n5GGMpRl/KQ5J4p9EqLK9l86p4g5/4xCw++AukKdaieb7xS6d43OrZq z12SL2co3lOztjkXT5xniCalQ0K8tnswDtqMz1EMUIG5NqCC+8gndJPtwobwuRd+wfeF 5lzYQrTzli7uoLn2MeTokDrxItwDFW04T28X2yEpkq/GfhtGiwyUMljz0vEKxyU3zt/t H7wcPIdxPTFIKreuLmEQYPJ6m2gHj30B3G/591eU7Pv66SavE2AED1kAgZ/X5YpV2m9P 1einInMrHh6sF4QnuED8HKzsskiodY9bmf6mX3f2E8ew1sATIytob5sOSdzUbQoorm6M 3MWA== X-Gm-Message-State: ALoCoQlFulEXQ5AWbW0hKXiyUcnfODmBFRrSdsfqzyWXtQvnKl0D8LlbhZmqyvOCk/FGbPUfxgfl X-Received: by 10.194.5.229 with SMTP id v5mr1828068wjv.0.1434625097434; Thu, 18 Jun 2015 03:58:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.162 with SMTP id n2ls443000laf.82.gmail; Thu, 18 Jun 2015 03:58:17 -0700 (PDT) X-Received: by 10.112.199.10 with SMTP id jg10mr12437025lbc.24.1434625097268; Thu, 18 Jun 2015 03:58:17 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id lc3si6185055lab.50.2015.06.18.03.58.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbti3 with SMTP id ti3so49741435lbb.1 for ; Thu, 18 Jun 2015 03:58:17 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr12317994lbb.76.1434625097076; Thu, 18 Jun 2015 03:58:17 -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 hn6csp1095740lbb; Thu, 18 Jun 2015 03:58:16 -0700 (PDT) X-Received: by 10.66.155.197 with SMTP id vy5mr20424216pab.104.1434625095386; Thu, 18 Jun 2015 03:58:15 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id u9si10850829pdp.186.2015.06.18.03.58.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:58:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XUa-000158-Bi; Thu, 18 Jun 2015 10:56:20 +0000 Received: from mail-pa0-f43.google.com ([209.85.220.43]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XU5-0000v2-Uh for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2015 10:55:51 +0000 Received: by pabvl15 with SMTP id vl15so12907428pab.1 for ; Thu, 18 Jun 2015 03:55:28 -0700 (PDT) X-Received: by 10.66.218.6 with SMTP id pc6mr20118026pac.20.1434624928862; Thu, 18 Jun 2015 03:55:28 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id do3sm7658437pbb.5.2015.06.18.03.55.27 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:55:28 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Subject: [PATCH 07/41] clocksource: fsl_ftm: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:21 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150618_035550_071589_1FEF85C9 X-CRM114-Status: GOOD ( 12.11 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.43 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.220.43 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record Cc: Viresh Kumar , Xiubo Li , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.217.170 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 Migrate fsl_ftm 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. Cc: Xiubo Li Signed-off-by: Viresh Kumar --- drivers/clocksource/fsl_ftm_timer.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c index 454227d4f895..ef434699c80a 100644 --- a/drivers/clocksource/fsl_ftm_timer.c +++ b/drivers/clocksource/fsl_ftm_timer.c @@ -153,19 +153,16 @@ static int ftm_set_next_event(unsigned long delta, return 0; } -static void ftm_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int ftm_set_oneshot(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - ftm_set_next_event(priv->periodic_cyc, evt); - break; - case CLOCK_EVT_MODE_ONESHOT: - ftm_counter_disable(priv->clkevt_base); - break; - default: - return; - } + ftm_counter_disable(priv->clkevt_base); + return 0; +} + +static int ftm_set_periodic(struct clock_event_device *evt) +{ + ftm_set_next_event(priv->periodic_cyc, evt); + return 0; } static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id) @@ -174,7 +171,7 @@ static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id) ftm_irq_acknowledge(priv->clkevt_base); - if (likely(evt->mode == CLOCK_EVT_MODE_ONESHOT)) { + if (likely(clockevent_state_oneshot(evt))) { ftm_irq_disable(priv->clkevt_base); ftm_counter_disable(priv->clkevt_base); } @@ -185,11 +182,13 @@ static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id) } static struct clock_event_device ftm_clockevent = { - .name = "Freescale ftm timer", - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = ftm_set_mode, - .set_next_event = ftm_set_next_event, - .rating = 300, + .name = "Freescale ftm timer", + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_state_periodic = ftm_set_periodic, + .set_state_oneshot = ftm_set_oneshot, + .set_next_event = ftm_set_next_event, + .rating = 300, }; static struct irqaction ftm_timer_irq = {