From patchwork Mon Aug 10 09:52:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52181 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 073C22152A for ; Mon, 10 Aug 2015 10:00:45 +0000 (UTC) Received: by lbcli1 with SMTP id li1sf3530174lbc.2 for ; Mon, 10 Aug 2015 03:00:43 -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=mfPeeIZ4yv9EVvqyaHASRdCraWEsPwWQ/uP/ZF/JVDo=; b=UJGka45QpigMR8cMSkq9+ZhYeuBB1QPZedH1ZNGxGVRymoBMx9eAumGDbl7mS3U1Cd y3u6OjngUR4Ib62WNQhMviIqdaen/e7jllRSsi134RIFFbdWoLMupLESGwsJLXm5QMmQ 9LusQ3qAR9st1bZHEBJqOSS3ey0flY3Do+oyyxmksTGTML0RPLK6bKL1UlKi7qvbY9UU n+YNpNrr5Ajha4hhMRr6SZT8hP+V9FLBFFH8oyt9xUJrJxYRBAe71wOLYDNy/ii9eyuD 0LGq9uwESGjVIZ5j+/qG+SywV/87gXXUi6ipLsq52/PkzWlAaQ8aZZMxzZkH4pzpPa+C Nx9w== X-Gm-Message-State: ALoCoQmQC34maziopIY+LJfrSxtOxzp2gG4RfsegK9mqcHNfz9PuDDUwFSXxn/WrDwmJEI9NjLqh X-Received: by 10.180.83.226 with SMTP id t2mr3456981wiy.5.1439200843926; Mon, 10 Aug 2015 03:00:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.185.67 with SMTP id fa3ls664914lac.76.gmail; Mon, 10 Aug 2015 03:00:43 -0700 (PDT) X-Received: by 10.152.37.227 with SMTP id b3mr19059220lak.91.1439200843603; Mon, 10 Aug 2015 03:00:43 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id t6si13708710lae.163.2015.08.10.03.00.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 03:00:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbsx3 with SMTP id sx3so8388369lbb.0 for ; Mon, 10 Aug 2015 03:00:43 -0700 (PDT) X-Received: by 10.152.28.193 with SMTP id d1mr5729785lah.72.1439200843456; Mon, 10 Aug 2015 03:00:43 -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 l6csp1830295lba; Mon, 10 Aug 2015 03:00:42 -0700 (PDT) X-Received: by 10.68.193.169 with SMTP id hp9mr43700482pbc.39.1439200841417; Mon, 10 Aug 2015 03:00:41 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oq6si23052938pab.88.2015.08.10.03.00.40; Mon, 10 Aug 2015 03:00:41 -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 S1755314AbbHJKAf (ORCPT + 28 others); Mon, 10 Aug 2015 06:00:35 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:38425 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933384AbbHJJyt (ORCPT ); Mon, 10 Aug 2015 05:54:49 -0400 Received: by wicja10 with SMTP id ja10so17936091wic.1 for ; Mon, 10 Aug 2015 02:54:48 -0700 (PDT) X-Received: by 10.180.218.227 with SMTP id pj3mr22190426wic.59.1439200488332; Mon, 10 Aug 2015 02:54:48 -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.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:47 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Yoshinori Sato , uclinux-h8-devel@lists.sourceforge.jp (moderated list:H8/300 ARCHITECTURE) Subject: [PATCH 58/74] clockevents/drivers/h8300_timer8: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:52:15 +0200 Message-Id: <1439200352-26767-58-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.179 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 h8300_timer8 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. Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- drivers/clocksource/h8300_timer8.c | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/drivers/clocksource/h8300_timer8.c b/drivers/clocksource/h8300_timer8.c index 0214cb3..f9b3b70 100644 --- a/drivers/clocksource/h8300_timer8.c +++ b/drivers/clocksource/h8300_timer8.c @@ -81,7 +81,7 @@ static irqreturn_t timer8_interrupt(int irq, void *dev_id) p->flags |= FLAG_IRQCONTEXT; ctrl_outw(p->tcora, p->mapbase + TCORA); if (!(p->flags & FLAG_SKIPEVENT)) { - if (p->ced.mode == CLOCK_EVT_MODE_ONESHOT) + if (clockevent_state_oneshot(&p->ced)) ctrl_outw(0x0000, p->mapbase + _8TCR); p->ced.event_handler(&p->ced); } @@ -169,29 +169,32 @@ static void timer8_clock_event_start(struct timer8_priv *p, int periodic) timer8_set_next(p, periodic?(p->rate + HZ/2) / HZ:0x10000); } -static void timer8_clock_event_mode(enum clock_event_mode mode, - struct clock_event_device *ced) +static int timer8_clock_event_shutdown(struct clock_event_device *ced) +{ + timer8_stop(ced_to_priv(ced)); + return 0; +} + +static int timer8_clock_event_periodic(struct clock_event_device *ced) { struct timer8_priv *p = ced_to_priv(ced); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - dev_info(&p->pdev->dev, "used for periodic clock events\n"); - timer8_stop(p); - timer8_clock_event_start(p, PERIODIC); - break; - case CLOCK_EVT_MODE_ONESHOT: - dev_info(&p->pdev->dev, "used for oneshot clock events\n"); - timer8_stop(p); - timer8_clock_event_start(p, ONESHOT); - break; - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_UNUSED: - timer8_stop(p); - break; - default: - break; - } + dev_info(&p->pdev->dev, "used for periodic clock events\n"); + timer8_stop(p); + timer8_clock_event_start(p, PERIODIC); + + return 0; +} + +static int timer8_clock_event_oneshot(struct clock_event_device *ced) +{ + struct timer8_priv *p = ced_to_priv(ced); + + dev_info(&p->pdev->dev, "used for oneshot clock events\n"); + timer8_stop(p); + timer8_clock_event_start(p, ONESHOT); + + return 0; } static int timer8_clock_event_next(unsigned long delta, @@ -199,7 +202,7 @@ static int timer8_clock_event_next(unsigned long delta, { struct timer8_priv *p = ced_to_priv(ced); - BUG_ON(ced->mode != CLOCK_EVT_MODE_ONESHOT); + BUG_ON(!clockevent_state_oneshot(ced)); timer8_set_next(p, delta - 1); return 0; @@ -246,7 +249,9 @@ static int timer8_setup(struct timer8_priv *p, p->ced.rating = 200; p->ced.cpumask = cpumask_of(0); p->ced.set_next_event = timer8_clock_event_next; - p->ced.set_mode = timer8_clock_event_mode; + p->ced.set_state_shutdown = timer8_clock_event_shutdown; + p->ced.set_state_periodic = timer8_clock_event_periodic; + p->ced.set_state_oneshot = timer8_clock_event_oneshot; ret = setup_irq(irq, &p->irqaction); if (ret < 0) {