From patchwork Thu Jun 18 10:54:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50008 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97DB5228CC for ; Thu, 18 Jun 2015 10:57:09 +0000 (UTC) Received: by wgfj7 with SMTP id j7sf16344137wgf.1 for ; Thu, 18 Jun 2015 03:57:08 -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=zHeQVG+UtB2nlq+7O0B6ZIuGltn3MPrDalGkLwa/9Pc=; b=OuiNyA/F+YUr7H6nF4yojsdiaibLrZeLhIRcNc3IceeAbxWO8mUG8W7IcFQWcnQzsr jA/syKvf9KF3w9y7rfuVigglmN1Pk7YvfQzDJzJjgHi80iHc1fNyjqYKkZs0ip7ou8CR SNLi/BPod2zaSzzV6HzYlRak9/BtkqXvR6uQog1XraUJ4+N1NsyvBbtBJVTbLCxA0C0i Pi0yBlLHDRnM5RBxIX5+9yRB+ZDNoaqTzx1r/6VBk284m29KvYlH1jhfXFpvhrRP6+aN q2x9li6PTtXsiI/+ET4MXhPiNuAws/0gmiPBgJmo4YKKv1GaaA2hkxqLz8nHFc+e2um1 /w4g== X-Gm-Message-State: ALoCoQkQ/w9tJvDmMDRCECHQyg9GJtU7iqemh3Z4UbK7klbQtETx4net7cdBb/O8JmBmtYiM1m88 X-Received: by 10.152.19.161 with SMTP id g1mr9860202lae.8.1434625028934; Thu, 18 Jun 2015 03:57:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.1 with SMTP id g1ls53442lag.46.gmail; Thu, 18 Jun 2015 03:57:08 -0700 (PDT) X-Received: by 10.152.43.110 with SMTP id v14mr12418417lal.4.1434625028752; Thu, 18 Jun 2015 03:57:08 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id q2si6171185laq.102.2015.06.18.03.57.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:57:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by labko7 with SMTP id ko7so51895285lab.2 for ; Thu, 18 Jun 2015 03:57:08 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr12464638lae.19.1434625028624; Thu, 18 Jun 2015 03:57:08 -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 hn6csp1095188lbb; Thu, 18 Jun 2015 03:57:07 -0700 (PDT) X-Received: by 10.68.218.231 with SMTP id pj7mr19799524pbc.155.1434625026593; Thu, 18 Jun 2015 03:57:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tv5si10797841pbc.226.2015.06.18.03.57.05; Thu, 18 Jun 2015 03:57:06 -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 S1754678AbbFRK4z (ORCPT + 30 others); Thu, 18 Jun 2015 06:56:55 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:32844 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932404AbbFRK4W (ORCPT ); Thu, 18 Jun 2015 06:56:22 -0400 Received: by padev16 with SMTP id ev16so59061671pad.0 for ; Thu, 18 Jun 2015 03:56:22 -0700 (PDT) X-Received: by 10.70.33.67 with SMTP id p3mr20125300pdi.126.1434624982198; Thu, 18 Jun 2015 03:56:22 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id m3sm4968560pdd.29.2015.06.18.03.56.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:56:21 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Magnus Damm , Laurent Pinchart , Paul Mundt Subject: [PATCH 22/41] clocksource: sh_tmu: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:36 +0530 Message-Id: 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.215.51 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 sh_tmu 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: Magnus Damm Cc: Laurent Pinchart Cc: Paul Mundt Signed-off-by: Viresh Kumar --- drivers/clocksource/sh_tmu.c | 63 +++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index b6b8fa3cd211..43c98143f79a 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c @@ -240,7 +240,7 @@ static irqreturn_t sh_tmu_interrupt(int irq, void *dev_id) struct sh_tmu_channel *ch = dev_id; /* disable or acknowledge interrupt */ - if (ch->ced.mode == CLOCK_EVT_MODE_ONESHOT) + if (clockevent_state_oneshot(&ch->ced)) sh_tmu_write(ch, TCR, TCR_TPSC_CLK4); else sh_tmu_write(ch, TCR, TCR_UNIE | TCR_TPSC_CLK4); @@ -358,42 +358,37 @@ static void sh_tmu_clock_event_start(struct sh_tmu_channel *ch, int periodic) } } -static void sh_tmu_clock_event_mode(enum clock_event_mode mode, - struct clock_event_device *ced) +static int sh_tmu_clock_event_shutdown(struct clock_event_device *ced) +{ + struct sh_tmu_channel *ch = ced_to_sh_tmu(ced); + + sh_tmu_disable(ch); + return 0; +} + +static int sh_tmu_clock_event_set_state(struct clock_event_device *ced, + int periodic) { struct sh_tmu_channel *ch = ced_to_sh_tmu(ced); - int disabled = 0; /* deal with old setting first */ - switch (ced->mode) { - case CLOCK_EVT_MODE_PERIODIC: - case CLOCK_EVT_MODE_ONESHOT: + if (clockevent_state_oneshot(ced) || clockevent_state_periodic(ced)) sh_tmu_disable(ch); - disabled = 1; - break; - default: - break; - } - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - dev_info(&ch->tmu->pdev->dev, - "ch%u: used for periodic clock events\n", ch->index); - sh_tmu_clock_event_start(ch, 1); - break; - case CLOCK_EVT_MODE_ONESHOT: - dev_info(&ch->tmu->pdev->dev, - "ch%u: used for oneshot clock events\n", ch->index); - sh_tmu_clock_event_start(ch, 0); - break; - case CLOCK_EVT_MODE_UNUSED: - if (!disabled) - sh_tmu_disable(ch); - break; - case CLOCK_EVT_MODE_SHUTDOWN: - default: - break; - } + dev_info(&ch->tmu->pdev->dev, "ch%u: used for %s clock events\n", + ch->index, periodic ? "periodic" : "oneshot"); + sh_tmu_clock_event_start(ch, periodic); + return 0; +} + +static int sh_tmu_clock_event_set_oneshot(struct clock_event_device *ced) +{ + return sh_tmu_clock_event_set_state(ced, 0); +} + +static int sh_tmu_clock_event_set_periodic(struct clock_event_device *ced) +{ + return sh_tmu_clock_event_set_state(ced, 1); } static int sh_tmu_clock_event_next(unsigned long delta, @@ -401,7 +396,7 @@ static int sh_tmu_clock_event_next(unsigned long delta, { struct sh_tmu_channel *ch = ced_to_sh_tmu(ced); - BUG_ON(ced->mode != CLOCK_EVT_MODE_ONESHOT); + BUG_ON(!clockevent_state_oneshot(ced)); /* program new delta value */ sh_tmu_set_next(ch, delta, 0); @@ -430,7 +425,9 @@ static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, ced->rating = 200; ced->cpumask = cpu_possible_mask; ced->set_next_event = sh_tmu_clock_event_next; - ced->set_mode = sh_tmu_clock_event_mode; + ced->set_state_shutdown = sh_tmu_clock_event_shutdown; + ced->set_state_periodic = sh_tmu_clock_event_set_periodic; + ced->set_state_oneshot = sh_tmu_clock_event_set_oneshot; ced->suspend = sh_tmu_clock_event_suspend; ced->resume = sh_tmu_clock_event_resume;