From patchwork Mon Aug 10 09:52:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52160 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 4812E2152A for ; Mon, 10 Aug 2015 09:55:27 +0000 (UTC) Received: by wilj18 with SMTP id j18sf36573036wil.0 for ; Mon, 10 Aug 2015 02:55:26 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=LNYoRm6pgTLZNbFHu4/gZX4FR0B+35uAnfuBZovZwzM=; b=ilW0PrGF4uGVNdiaxNEGKS2oQ6hQCbJQiuWGwL5hMNcWchGLPvXYikfGfEhwmIQyZC FHgqQnF4nyhJ+RL6zEylpt9KiF82EXGe0sZXR2KMiLBIRZwATyyfa5ZuOA0FLMF5JZxb fDr8peVZZ8vfgmPlyUGHc36kJRlD5WJkuqkbxPJXpKseHq7AF6XEh1+cv1PASMCTTSzv CFLKg1MNwycD8UtnY0085+J8D3P2GtYdZXAVucjxfHuc9RbzSOhoGhIT/y7+45uXbQ4G xI0NxIh9Oa6vSl1XwMJxmcKMPzLjMhvmeioLtNzq6j+sr034q4P8fLM1fUrQ1n4NnjBH tjsg== X-Gm-Message-State: ALoCoQl0xohbch2BwUTdiqT6wYA4oR/8HI4q/NRKtlFIyGLx/fQJfEQoMk7jJ2GwTRNOLri3eNX8 X-Received: by 10.180.81.70 with SMTP id y6mr2599816wix.2.1439200526638; Mon, 10 Aug 2015 02:55:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.105 with SMTP id r9ls40372lar.15.gmail; Mon, 10 Aug 2015 02:55:26 -0700 (PDT) X-Received: by 10.152.2.41 with SMTP id 9mr19560456lar.65.1439200526308; Mon, 10 Aug 2015 02:55:26 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id db5si13748822lac.73.2015.08.10.02.55.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:55:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbpo9 with SMTP id po9so92163861lbb.2 for ; Mon, 10 Aug 2015 02:55:26 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr19746730lbb.56.1439200526088; Mon, 10 Aug 2015 02:55:26 -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.7.198 with SMTP id l6csp1828073lba; Mon, 10 Aug 2015 02:55:24 -0700 (PDT) X-Received: by 10.66.155.36 with SMTP id vt4mr43599386pab.32.1439200513588; Mon, 10 Aug 2015 02:55:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sz3si32368137pac.98.2015.08.10.02.55.12; Mon, 10 Aug 2015 02:55:13 -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 S933410AbbHJJyy (ORCPT + 28 others); Mon, 10 Aug 2015 05:54:54 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:34625 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933321AbbHJJyd (ORCPT ); Mon, 10 Aug 2015 05:54:33 -0400 Received: by wicne3 with SMTP id ne3so128872401wic.1 for ; Mon, 10 Aug 2015 02:54:32 -0700 (PDT) X-Received: by 10.180.206.8 with SMTP id lk8mr23650246wic.12.1439200472652; Mon, 10 Aug 2015 02:54:32 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id jr5sm28598154wjc.14.2015.08.10.02.54.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:32 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Jingchang Lu , Stefan Agner , Shawn Guo Subject: [PATCH 47/74] clockevents/drivers/vf_pit: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:52:04 +0200 Message-Id: <1439200352-26767-47-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439200352-26767-1-git-send-email-daniel.lezcano@linaro.org> References: <55C87382.4070309@linaro.org> <1439200352-26767-1-git-send-email-daniel.lezcano@linaro.org> 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: daniel.lezcano@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.173 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: , From: Viresh Kumar Migrate vf_pit 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: Jingchang Lu Cc: Stefan Agner Cc: Shawn Guo Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano Acked-by: Stefan Agner --- drivers/clocksource/vf_pit_timer.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/clocksource/vf_pit_timer.c b/drivers/clocksource/vf_pit_timer.c index b45ac62..f07ba99 100644 --- a/drivers/clocksource/vf_pit_timer.c +++ b/drivers/clocksource/vf_pit_timer.c @@ -86,20 +86,16 @@ static int pit_set_next_event(unsigned long delta, return 0; } -static void pit_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int pit_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - pit_set_next_event(cycle_per_jiffy, evt); - break; - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_UNUSED: - pit_timer_disable(); - break; - default: - break; - } + pit_timer_disable(); + return 0; +} + +static int pit_set_periodic(struct clock_event_device *evt) +{ + pit_set_next_event(cycle_per_jiffy, evt); + return 0; } static irqreturn_t pit_timer_interrupt(int irq, void *dev_id) @@ -114,7 +110,7 @@ static irqreturn_t pit_timer_interrupt(int irq, void *dev_id) * and start the counter again. So software need to disable the timer * to stop the counter loop in ONESHOT mode. */ - if (likely(evt->mode == CLOCK_EVT_MODE_ONESHOT)) + if (likely(clockevent_state_oneshot(evt))) pit_timer_disable(); evt->event_handler(evt); @@ -125,7 +121,8 @@ static irqreturn_t pit_timer_interrupt(int irq, void *dev_id) static struct clock_event_device clockevent_pit = { .name = "VF pit timer", .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = pit_set_mode, + .set_state_shutdown = pit_shutdown, + .set_state_periodic = pit_set_periodic, .set_next_event = pit_set_next_event, .rating = 300, };