From patchwork Fri Jun 12 08:00:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49806 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 88E4C228DB for ; Fri, 12 Jun 2015 08:01:21 +0000 (UTC) Received: by lbcue7 with SMTP id ue7sf7686436lbc.3 for ; Fri, 12 Jun 2015 01:01:20 -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=hnxeusUN6hujhuTU6Nbbv2xru4j3/TLnOEeempP/+gU=; b=ZyuUhdw5p+zinE5zL+nF0tRCnByw/BpTPa61AS+oaG+q2+fF8U59yNaoThs6jIFVf5 lb7j5xhDzQLUXQZVMzfXJFNYc40RDYeWFLaABG0O1EV9SOxzEhUHghwoIFg1Wf8Znj4j 5XIbm19yOVe5dHq3lRbJSPWzT+nT1VXH4/YC/F6PkiSjLfqUxRC5qjAjl2A8QT+iLlqI P91UvifV2weK5MIihs62XDT89Zwee0vq9dqesGs6++ALLm8BexECW6lbmcJMhy7mNIpu iHXPSyx0eocu+b/urAL1wCkdmpBlWJPaIieZOLxkh/fYhFqzL7cOxFOmwEkeKihjjOSA E0+A== X-Gm-Message-State: ALoCoQmJLc+48k9Wyfe+wuYSbzVEawwpPxW5xP/dagqw/bUe/Vo1iXo9h5wxyq7kX/I6JfH9GSp7 X-Received: by 10.112.84.104 with SMTP id x8mr12862323lby.23.1434096080468; Fri, 12 Jun 2015 01:01:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.8 with SMTP id u8ls562862laj.39.gmail; Fri, 12 Jun 2015 01:01:20 -0700 (PDT) X-Received: by 10.152.18.163 with SMTP id x3mr13811170lad.70.1434096080287; Fri, 12 Jun 2015 01:01:20 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id ew10si2772035lac.11.2015.06.12.01.01.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 01:01:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lazv15 with SMTP id v15so16809480laz.3 for ; Fri, 12 Jun 2015 01:01:20 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr13888679lbc.19.1434096080010; Fri, 12 Jun 2015 01:01:20 -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 hn6csp361687lbb; Fri, 12 Jun 2015 01:01:18 -0700 (PDT) X-Received: by 10.70.49.168 with SMTP id v8mr21459312pdn.24.1434096078260; Fri, 12 Jun 2015 01:01:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gf2si4302023pbd.94.2015.06.12.01.01.17; Fri, 12 Jun 2015 01:01:18 -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 S1755078AbbFLIBE (ORCPT + 29 others); Fri, 12 Jun 2015 04:01:04 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:35048 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932074AbbFLIAy (ORCPT ); Fri, 12 Jun 2015 04:00:54 -0400 Received: by pdbnf5 with SMTP id nf5so19866458pdb.2 for ; Fri, 12 Jun 2015 01:00:54 -0700 (PDT) X-Received: by 10.66.216.161 with SMTP id or1mr21302160pac.34.1434096054143; Fri, 12 Jun 2015 01:00:54 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id h1sm2774791pdp.34.2015.06.12.01.00.53 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 12 Jun 2015 01:00:53 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar , Andres Salomon Subject: [PATCH V2 6/7] clocksource: cs5535: Migrate to new 'set-state' interface Date: Fri, 12 Jun 2015 13:30:16 +0530 Message-Id: <14c27e413a8efe282616b495a8b4ae43b423b480.1434095303.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.44 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 cs5535 driver to the new 'set-state' interface provided by the 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. Acked-by: Daniel Lezcano Cc: Andres Salomon Signed-off-by: Viresh Kumar --- drivers/clocksource/cs5535-clockevt.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c index db2105290898..9a7e37cf56b0 100644 --- a/drivers/clocksource/cs5535-clockevt.c +++ b/drivers/clocksource/cs5535-clockevt.c @@ -42,7 +42,6 @@ MODULE_PARM_DESC(irq, "Which IRQ to use for the clock source MFGPT ticks."); * 256 128 .125 512.000 */ -static unsigned int cs5535_tick_mode = CLOCK_EVT_MODE_SHUTDOWN; static struct cs5535_mfgpt_timer *cs5535_event_clock; /* Selected from the table above */ @@ -77,15 +76,17 @@ static void start_timer(struct cs5535_mfgpt_timer *timer, uint16_t delta) MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2); } -static void mfgpt_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int mfgpt_shutdown(struct clock_event_device *evt) { disable_timer(cs5535_event_clock); + return 0; +} - if (mode == CLOCK_EVT_MODE_PERIODIC) - start_timer(cs5535_event_clock, MFGPT_PERIODIC); - - cs5535_tick_mode = mode; +static int mfgpt_set_periodic(struct clock_event_device *evt) +{ + disable_timer(cs5535_event_clock); + start_timer(cs5535_event_clock, MFGPT_PERIODIC); + return 0; } static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt) @@ -97,7 +98,10 @@ static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt) static struct clock_event_device cs5535_clockevent = { .name = DRV_NAME, .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = mfgpt_set_mode, + .set_state_shutdown = mfgpt_shutdown, + .set_state_periodic = mfgpt_set_periodic, + .set_state_oneshot = mfgpt_shutdown, + .tick_resume = mfgpt_shutdown, .set_next_event = mfgpt_next_event, .rating = 250, }; @@ -113,7 +117,7 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id) /* Turn off the clock (and clear the event) */ disable_timer(cs5535_event_clock); - if (cs5535_tick_mode == CLOCK_EVT_MODE_SHUTDOWN) + if (clockevent_state_shutdown(&cs5535_clockevent)) return IRQ_HANDLED; /* Clear the counter */ @@ -121,7 +125,7 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id) /* Restart the clock in periodic mode */ - if (cs5535_tick_mode == CLOCK_EVT_MODE_PERIODIC) + if (clockevent_state_periodic(&cs5535_clockevent)) cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2);