From patchwork Mon Jun 8 13:40:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49625 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 99CA7214B2 for ; Mon, 8 Jun 2015 13:43:00 +0000 (UTC) Received: by laar3 with SMTP id r3sf20713520laa.3 for ; Mon, 08 Jun 2015 06:42:59 -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=hjiohGcanbKBgOcH7rjzo3ARfTD/hHwNM7QlvwNdyA4=; b=ONhC4UMcg8lb+wjXBSqprXxT/NWRIsEELwMqYK5c8By5N1B+xqjjnNqV/EDFTILqBU bFlXxPc4fQXJnLRhj9bF1wQZWaq2CovXLenzpIamH49c4W9zm/wlCC3gVzW+kFfdLzBe N4TakiL25rlBSXX2wanCmFh+AP66+5tIidv8zMa7HVtaMF+AKHX2ykmnnG/TxYNtHA2n b9q/1f9r9Ermn5uILmxOeXAbYtnXft1SIWsMLdYM1FithFQagB2u6VM4xQ9ug4TIvxNF vNhAAjl8qYtLgXGWA9utRrC2/eAxl0tdjkzMHYVnHIEPJsJBt8JESRlkRQboMJbTCWw/ /4Ww== X-Gm-Message-State: ALoCoQnNnalLGj6RXkSHOoqpZSV2HS+o59PtoaUl1Ge3FbVxj8vK6m0bkF2l2dRoT7exR1JC7/kx X-Received: by 10.180.97.9 with SMTP id dw9mr12577132wib.2.1433770979394; Mon, 08 Jun 2015 06:42:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.133 with SMTP id kq5ls627261lac.102.gmail; Mon, 08 Jun 2015 06:42:59 -0700 (PDT) X-Received: by 10.152.219.3 with SMTP id pk3mr16893155lac.114.1433770979201; Mon, 08 Jun 2015 06:42:59 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id bc7si2742943lbc.144.2015.06.08.06.42.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jun 2015 06:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by labko7 with SMTP id ko7so97404675lab.2 for ; Mon, 08 Jun 2015 06:42:59 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr16534410lak.117.1433770979070; Mon, 08 Jun 2015 06:42:59 -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 hn6csp1874907lbb; Mon, 8 Jun 2015 06:42:58 -0700 (PDT) X-Received: by 10.70.87.195 with SMTP id ba3mr30020676pdb.154.1433770977325; Mon, 08 Jun 2015 06:42:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4si4166894pdp.192.2015.06.08.06.42.56; Mon, 08 Jun 2015 06:42:57 -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 S932518AbbFHNmt (ORCPT + 28 others); Mon, 8 Jun 2015 09:42:49 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:32788 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbbFHNlf (ORCPT ); Mon, 8 Jun 2015 09:41:35 -0400 Received: by pdjn11 with SMTP id n11so67266719pdj.0 for ; Mon, 08 Jun 2015 06:41:33 -0700 (PDT) X-Received: by 10.70.39.103 with SMTP id o7mr29531153pdk.122.1433770893707; Mon, 08 Jun 2015 06:41:33 -0700 (PDT) Received: from localhost ([122.167.219.251]) by mx.google.com with ESMTPSA id s1sm2702923pda.54.2015.06.08.06.41.32 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 08 Jun 2015 06:41:33 -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 , Andres Salomon Subject: [PATCH 5/6] clocksource: cs5535: Migrate to new 'set-state' interface Date: Mon, 8 Jun 2015 19:10:46 +0530 Message-Id: <9ea6d10fe6578199584a3a3620da9cb6db481a2d.1433768426.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.48 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. Cc: Andres Salomon Signed-off-by: Viresh Kumar Acked-by: Daniel Lezcano --- 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);