From patchwork Mon Aug 10 09:52:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52171 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 patches.linaro.org (Postfix) with ESMTPS id 0E7FA2152A for ; Mon, 10 Aug 2015 09:57:50 +0000 (UTC) Received: by wijp15 with SMTP id p15sf36991370wij.3 for ; Mon, 10 Aug 2015 02:57:49 -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=svE65PVdeAnp653lDwKpV0Z3hAfBZxIlO8svEiFr+7o=; b=Eq6hyhaS0tJb4cU3Wb/wvg+nqzc9JVXbHqkzwYCA+BcKAwD8aHFaMO1UPgvEJrDm4Y 4EoVD5YOMG89ekLbCwRne58UGNbYDS5fgfHZisarO7up6RioDHsJ6M15SzkVWFJddOz4 gV08q+fmHhB9/lXXwp4nrR6D3mBDPWq5G4YBLSquuKFX4lt186SCYzcTApdxFtHC2Soz TbeE5vXYgJ6sH36a3kDF1jk+2MBsITdXTSfO0ZzCVl1mAPQwnPKmrpT+6qm1tOVXuTmp mqJJePpXfr7VREeCfEzbc699W5OrrcJvE6Up+Wzutwsdb1TXR/MNXfCKtbgry7BvB+Rn ilxA== X-Gm-Message-State: ALoCoQnTY2XC1M9SrEg2Z5wSRnc5nt+YPq/V2wAcmAjz6kGJbfYg5rR4VvAPIurF5wcJHWIa8l00 X-Received: by 10.112.161.35 with SMTP id xp3mr3119065lbb.2.1439200669388; Mon, 10 Aug 2015 02:57:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.65 with SMTP id r1ls84245lag.31.gmail; Mon, 10 Aug 2015 02:57:49 -0700 (PDT) X-Received: by 10.112.51.133 with SMTP id k5mr18904662lbo.107.1439200669079; Mon, 10 Aug 2015 02:57:49 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id jc5si13728641lbc.127.2015.08.10.02.57.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:57:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbbpo9 with SMTP id po9so92194527lbb.2 for ; Mon, 10 Aug 2015 02:57:49 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr19255878lav.36.1439200668944; Mon, 10 Aug 2015 02:57:48 -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 l6csp1829040lba; Mon, 10 Aug 2015 02:57:47 -0700 (PDT) X-Received: by 10.68.117.173 with SMTP id kf13mr42555646pbb.96.1439200667090; Mon, 10 Aug 2015 02:57:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gk2si32398021pac.68.2015.08.10.02.57.40; Mon, 10 Aug 2015 02:57:47 -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 S1754850AbbHJJ5W (ORCPT + 28 others); Mon, 10 Aug 2015 05:57:22 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:36081 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754799AbbHJJ5S (ORCPT ); Mon, 10 Aug 2015 05:57:18 -0400 Received: by wicja10 with SMTP id ja10so30408239wic.1 for ; Mon, 10 Aug 2015 02:57:17 -0700 (PDT) X-Received: by 10.181.25.234 with SMTP id it10mr23531176wid.0.1439200637239; Mon, 10 Aug 2015 02:57:17 -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.57.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:57:16 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: [PATCH 72/74] xtensa/time: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:52:29 +0200 Message-Id: <1439200352-26767-72-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.180 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 xtensa 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: Chris Zankel Cc: Max Filippov Cc: linux-xtensa@linux-xtensa.org Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- arch/xtensa/kernel/time.c | 53 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 2a1823d..b97767d 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c @@ -52,8 +52,6 @@ static struct clocksource ccount_clocksource = { static int ccount_timer_set_next_event(unsigned long delta, struct clock_event_device *dev); -static void ccount_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt); struct ccount_timer { struct clock_event_device evt; int irq_enabled; @@ -77,35 +75,34 @@ static int ccount_timer_set_next_event(unsigned long delta, return ret; } -static void ccount_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +/* + * There is no way to disable the timer interrupt at the device level, + * only at the intenable register itself. Since enable_irq/disable_irq + * calls are nested, we need to make sure that these calls are + * balanced. + */ +static int ccount_timer_shutdown(struct clock_event_device *evt) +{ + struct ccount_timer *timer = + container_of(evt, struct ccount_timer, evt); + + if (timer->irq_enabled) { + disable_irq(evt->irq); + timer->irq_enabled = 0; + } + return 0; +} + +static int ccount_timer_set_oneshot(struct clock_event_device *evt) { struct ccount_timer *timer = container_of(evt, struct ccount_timer, evt); - /* - * There is no way to disable the timer interrupt at the device level, - * only at the intenable register itself. Since enable_irq/disable_irq - * calls are nested, we need to make sure that these calls are - * balanced. - */ - switch (mode) { - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_UNUSED: - if (timer->irq_enabled) { - disable_irq(evt->irq); - timer->irq_enabled = 0; - } - break; - case CLOCK_EVT_MODE_RESUME: - case CLOCK_EVT_MODE_ONESHOT: - if (!timer->irq_enabled) { - enable_irq(evt->irq); - timer->irq_enabled = 1; - } - default: - break; + if (!timer->irq_enabled) { + enable_irq(evt->irq); + timer->irq_enabled = 1; } + return 0; } static irqreturn_t timer_interrupt(int irq, void *dev_id); @@ -126,7 +123,9 @@ void local_timer_setup(unsigned cpu) clockevent->features = CLOCK_EVT_FEAT_ONESHOT; clockevent->rating = 300; clockevent->set_next_event = ccount_timer_set_next_event; - clockevent->set_mode = ccount_timer_set_mode; + clockevent->set_state_shutdown = ccount_timer_shutdown; + clockevent->set_state_oneshot = ccount_timer_set_oneshot; + clockevent->tick_resume = ccount_timer_set_oneshot; clockevent->cpumask = cpumask_of(cpu); clockevent->irq = irq_create_mapping(NULL, LINUX_TIMER_INT); if (WARN(!clockevent->irq, "error: can't map timer irq"))