From patchwork Mon Jul 27 09:32:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51496 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 0502D22918 for ; Mon, 27 Jul 2015 09:32:24 +0000 (UTC) Received: by lafd3 with SMTP id d3sf25722959laf.1 for ; Mon, 27 Jul 2015 02:32:22 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=icsbLbZd9aq7Ztu2M5JwQ1bNSGfzLPhMVviXfFpOTY8=; b=ekE1nTcYj/XRqGiE0Fhg9JMBtMM+IgLdIq1tVYJjOFcff5tmAbmaeSswWUZrevylKf B1HvDfylar76DOZe8HbJ+RERVxh0N50ABDULBRP2dzXkMdQmxT7V//hkdH2vCDFxcuDz TZy601KfE/4IaPXADttid+JWylwxGqkX1/xv1DluZRL8E/avVuTO/gTSMAprByHF9fgy nbd6HwqJV5xBnHPr+kBFeSzb4tcFY9i9GQI4Wh2McxwqvReEjsQqSDVngzrHknUyDTDI kc2xCxrWuwGja1/3uuq1efAcqgLFUtqQz+B1wuoPwCphCl+4uJKky5sMMeFHo591fDvj EZwA== X-Gm-Message-State: ALoCoQlswDai8P366r22AE7yxdAtEqQevcglZIZkuoF70xLxj3XyTJFG4grswXtmSMyRT8S7/AOy X-Received: by 10.112.98.42 with SMTP id ef10mr11874767lbb.18.1437989542932; Mon, 27 Jul 2015 02:32:22 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.219.4 with SMTP id pk4ls645928lac.90.gmail; Mon, 27 Jul 2015 02:32:22 -0700 (PDT) X-Received: by 10.152.22.129 with SMTP id d1mr26315987laf.13.1437989542749; Mon, 27 Jul 2015 02:32:22 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id z1si14824963laa.59.2015.07.27.02.32.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2015 02:32:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lblf12 with SMTP id f12so49401416lbl.2 for ; Mon, 27 Jul 2015 02:32:22 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr26590507lbb.35.1437989542637; Mon, 27 Jul 2015 02:32:22 -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 l6csp1416114lba; Mon, 27 Jul 2015 02:32:21 -0700 (PDT) X-Received: by 10.66.194.201 with SMTP id hy9mr67012107pac.140.1437989540281; Mon, 27 Jul 2015 02:32:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by1si208936pab.92.2015.07.27.02.32.18; Mon, 27 Jul 2015 02:32:20 -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 S1754713AbbG0JcR (ORCPT + 28 others); Mon, 27 Jul 2015 05:32:17 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:33578 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754695AbbG0JcN (ORCPT ); Mon, 27 Jul 2015 05:32:13 -0400 Received: by pdbnt7 with SMTP id nt7so49066482pdb.0 for ; Mon, 27 Jul 2015 02:32:13 -0700 (PDT) X-Received: by 10.70.1.102 with SMTP id 6mr66157231pdl.32.1437989533337; Mon, 27 Jul 2015 02:32:13 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id i5sm28521542pat.42.2015.07.27.02.32.11 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 27 Jul 2015 02:32:12 -0700 (PDT) From: Viresh Kumar To: Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list:CLOCKSOURCE, CLOCKEVENT DRIVERS), Thomas Gleixner , uclinux-h8-devel@lists.sourceforge.jp (open list:H8/300 ARCHITECTURE), Yoshinori Sato Subject: [PATCH] clockevents/drivers/h8300_timer8: Migrate to new 'set-state' interface Date: Mon, 27 Jul 2015 15:02:00 +0530 Message-Id: <3d28b42ed2d37941fa7cc80562956f324206427f.1437989421.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 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.181 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 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 --- @Daniel: This driver got added in 4.2 release only and so wasn't migrated earlier. Please include this in your pull request for 4.3. Untested. --- 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 0214cb3a7f5e..f9b3b7033a97 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) {