From patchwork Thu Jun 18 10:54:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50007 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6477F228CC for ; Thu, 18 Jun 2015 10:57:08 +0000 (UTC) Received: by lbcak1 with SMTP id ak1sf19630213lbc.2 for ; Thu, 18 Jun 2015 03:57:07 -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=6xStbFkk5A3akn0dTG+HwtH32hKYKKAeR4t2/2QLsXI=; b=AqZ+S2uV2k3k2PJh4f19VD/tDe5dYw//EozUmqcWDACR0iqlLGGR1C5td53BYcvxb5 xY+3FyE7QUa96zs1Y2vXd1urIbNzO2M/riREc5EXgwG6rig9sM55r/xXk8ML64uWWemg +ZOelVpy4MPNSpPZIoLMdbTdlLGxn1KQn7OQ9CHFhZ/AGqrT2NnHJfDhG9p1PHww0KkH K5cKYM1hgz4nQ69ZheIDLEbo3ttuMxniUdZFKLpNDxQB3+r0oyMBZE0ZNiO4l6RbQZBa lA7MIxb0Y+xPMmIEUsyxCeWV5m79sQbDOt39wLZioSTQSSVhgyixdnj7KY48CG/CRuaI sV1Q== X-Gm-Message-State: ALoCoQk8bqEZijXwwTlc4AP+4F9P27OvuTaTnOSMPQ7CFa/ybaCqYvDF3tACg/l0LNLy/d2Z+6dZ X-Received: by 10.112.42.236 with SMTP id r12mr9869335lbl.2.1434625027231; Thu, 18 Jun 2015 03:57:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.8 with SMTP id u8ls451807laj.39.gmail; Thu, 18 Jun 2015 03:57:07 -0700 (PDT) X-Received: by 10.152.87.33 with SMTP id u1mr12606228laz.35.1434625027054; Thu, 18 Jun 2015 03:57:07 -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 q2si6171135laq.102.2015.06.18.03.57.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:57:07 -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 labbc20 with SMTP id bc20so51803850lab.1 for ; Thu, 18 Jun 2015 03:57:07 -0700 (PDT) X-Received: by 10.152.44.166 with SMTP id f6mr12506200lam.86.1434625026937; Thu, 18 Jun 2015 03:57:06 -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 hn6csp1095173lbb; Thu, 18 Jun 2015 03:57:05 -0700 (PDT) X-Received: by 10.66.142.42 with SMTP id rt10mr19960541pab.142.1434625025185; Thu, 18 Jun 2015 03:57:05 -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.03; Thu, 18 Jun 2015 03:57:05 -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 S1754412AbbFRK4o (ORCPT + 30 others); Thu, 18 Jun 2015 06:56:44 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:34451 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932386AbbFRK4T (ORCPT ); Thu, 18 Jun 2015 06:56:19 -0400 Received: by pdbki1 with SMTP id ki1so64236575pdb.1 for ; Thu, 18 Jun 2015 03:56:18 -0700 (PDT) X-Received: by 10.68.131.41 with SMTP id oj9mr20486808pbb.39.1434624978492; Thu, 18 Jun 2015 03:56:18 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id jt2sm7654337pbc.21.2015.06.18.03.56.17 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:56:18 -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 21/41] clocksource: sh_mtu2: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:35 +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_mtu2 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_mtu2.c | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 3d88698cf2b8..f1985da8113f 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c @@ -276,36 +276,25 @@ static struct sh_mtu2_channel *ced_to_sh_mtu2(struct clock_event_device *ced) return container_of(ced, struct sh_mtu2_channel, ced); } -static void sh_mtu2_clock_event_mode(enum clock_event_mode mode, - struct clock_event_device *ced) +static int sh_mtu2_clock_event_shutdown(struct clock_event_device *ced) { struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced); - int disabled = 0; - /* deal with old setting first */ - switch (ced->mode) { - case CLOCK_EVT_MODE_PERIODIC: + sh_mtu2_disable(ch); + return 0; +} + +static int sh_mtu2_clock_event_set_periodic(struct clock_event_device *ced) +{ + struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced); + + if (clockevent_state_periodic(ced)) sh_mtu2_disable(ch); - disabled = 1; - break; - default: - break; - } - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - dev_info(&ch->mtu->pdev->dev, - "ch%u: used for periodic clock events\n", ch->index); - sh_mtu2_enable(ch); - break; - case CLOCK_EVT_MODE_UNUSED: - if (!disabled) - sh_mtu2_disable(ch); - break; - case CLOCK_EVT_MODE_SHUTDOWN: - default: - break; - } + dev_info(&ch->mtu->pdev->dev, "ch%u: used for periodic clock events\n", + ch->index); + sh_mtu2_enable(ch); + return 0; } static void sh_mtu2_clock_event_suspend(struct clock_event_device *ced) @@ -327,7 +316,8 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_channel *ch, ced->features = CLOCK_EVT_FEAT_PERIODIC; ced->rating = 200; ced->cpumask = cpu_possible_mask; - ced->set_mode = sh_mtu2_clock_event_mode; + ced->set_state_shutdown = sh_mtu2_clock_event_shutdown; + ced->set_state_periodic = sh_mtu2_clock_event_set_periodic; ced->suspend = sh_mtu2_clock_event_suspend; ced->resume = sh_mtu2_clock_event_resume;