From patchwork Thu Jul 16 11:26:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51165 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 7D9A322A28 for ; Thu, 16 Jul 2015 11:29:51 +0000 (UTC) Received: by lagx9 with SMTP id x9sf17940334lag.2 for ; Thu, 16 Jul 2015 04:29:50 -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=3Mr76VIfNxFuPPy1w+XxATAXssSRKcJ7R1Q6phNvrJE=; b=MNyTEeuLrFRBb1cB0rEmntmEOjImk2fhFlckGJuXkWkiAJ0PU9bav2JOJMa57dKVMs +VwkfXT6dHU2lppFu6Koud+3egtWAU8vDgsdojuZ0QWCWytBPG1z846NU6hO/edNxcoL kLu2jALlmyNxxuyETmFwnLHQyjR/6nw0oa3jnoFfYnReNJEF6z5NPvBNlQF0KaLFWe6f DR0yBfVo6QA/gshUT1SyxT60yjI2oFcZFbv2JbW2VN94HInD3QYDnv52yZbBE6XOo2Kn ULwWgUH2Ff1BKsAy/cScVZk4teiISIZNlwzwVUDCWZVxOhDb4gqFEqTCNEEuBSBcFp4p ogFg== X-Gm-Message-State: ALoCoQkIgosauTq6zJz57CHP2Gwyzbc+PH6voLgDOnKLEG/4zzTYYiRvd+1QsAbWYcu4HspEROs9 X-Received: by 10.194.175.36 with SMTP id bx4mr4654721wjc.1.1437046190275; Thu, 16 Jul 2015 04:29:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.207.38 with SMTP id lt6ls354138lac.50.gmail; Thu, 16 Jul 2015 04:29:50 -0700 (PDT) X-Received: by 10.152.116.39 with SMTP id jt7mr8826619lab.82.1437046190018; Thu, 16 Jul 2015 04:29:50 -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 l6si6689963lbd.114.2015.07.16.04.29.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 04:29: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 lblf12 with SMTP id f12so41777676lbl.2 for ; Thu, 16 Jul 2015 04:29:49 -0700 (PDT) X-Received: by 10.152.88.42 with SMTP id bd10mr4849829lab.112.1437046189719; Thu, 16 Jul 2015 04:29:49 -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 hn6csp192319lbb; Thu, 16 Jul 2015 04:29:48 -0700 (PDT) X-Received: by 10.66.249.1 with SMTP id yq1mr17413349pac.3.1437046187604; Thu, 16 Jul 2015 04:29:47 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot9si12591142pab.79.2015.07.16.04.29.46; Thu, 16 Jul 2015 04:29: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 S1755472AbbGPL30 (ORCPT + 27 others); Thu, 16 Jul 2015 07:29:26 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:34998 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752199AbbGPL3W (ORCPT ); Thu, 16 Jul 2015 07:29:22 -0400 Received: by pdrg1 with SMTP id g1so42894820pdr.2 for ; Thu, 16 Jul 2015 04:29:22 -0700 (PDT) X-Received: by 10.68.224.72 with SMTP id ra8mr17745739pbc.29.1437046162163; Thu, 16 Jul 2015 04:29:22 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id fq2sm7693976pdb.35.2015.07.16.04.29.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 04:29:21 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: [PATCH 21/23] xtensa/time: Migrate to new 'set-state' interface Date: Thu, 16 Jul 2015 16:56:33 +0530 Message-Id: <2982093964fd0f988893e52f068d83f5e56471b8.1437044518.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.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: , 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 --- 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 2a1823de69cc..b97767dbc7c8 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"))