From patchwork Mon Aug 10 09:51:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52154 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 4E4B92152A for ; Mon, 10 Aug 2015 09:55:09 +0000 (UTC) Received: by wicul11 with SMTP id ul11sf37307685wic.1 for ; Mon, 10 Aug 2015 02:55: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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=RyNWjHCgHUlW8WIUm9Tu5Syae7UATGTAzlsEN/7Y6xY=; b=Fpq6TPQOTFEuRZO18WbOvSHOtVQor1hGSk5IC3huW7y3nVD8Z2lxbxrBhvpyLptmFS 1iLtm4MNWD4PR5NzYAo5LDFZyrEDVo1ek2u0egn4FiTTIpBe4XxPbKFBSDteXREjy3R6 aXL+iGZ23ar9Kwz/cKvBjqx3cKepNrXsxpZd7RUq+TOUbZ0e973e9i4MN5YuNKjZTBpJ tWyl/wzu4DmPzN7Dcas9TnTctOCSJvC+wmJQFiO/DBJC/tmvaHKNf6vVwJpbN9TXW/1M Hd0G0oATh03IQZqlG/tVWqMfyacWolpGGuA39bBI88Tniqj7WZPSq0oXA7DC2nLTktyb CujQ== X-Gm-Message-State: ALoCoQn2ws586Njpp/G59zrSLJQJ3qMZ/D3lVhKz5hH6QDtEehVJ+ee3fbypSVxb+1GzBU3I7sas X-Received: by 10.180.100.71 with SMTP id ew7mr2796139wib.0.1439200508610; Mon, 10 Aug 2015 02:55:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.101 with SMTP id s5ls731316lag.108.gmail; Mon, 10 Aug 2015 02:55:08 -0700 (PDT) X-Received: by 10.112.54.132 with SMTP id j4mr7139357lbp.84.1439200508284; Mon, 10 Aug 2015 02:55:08 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id yk6si13744288lbb.90.2015.08.10.02.55.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by lalv9 with SMTP id v9so7985516lal.0 for ; Mon, 10 Aug 2015 02:55:08 -0700 (PDT) X-Received: by 10.152.164.130 with SMTP id yq2mr12781516lab.76.1439200508179; Mon, 10 Aug 2015 02:55: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.7.198 with SMTP id l6csp1827925lba; Mon, 10 Aug 2015 02:55:07 -0700 (PDT) X-Received: by 10.66.196.15 with SMTP id ii15mr42384207pac.108.1439200506308; Mon, 10 Aug 2015 02:55:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sz3si32368137pac.98.2015.08.10.02.55.05; Mon, 10 Aug 2015 02:55: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 S933291AbbHJJyW (ORCPT + 28 others); Mon, 10 Aug 2015 05:54:22 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:36997 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933197AbbHJJyL (ORCPT ); Mon, 10 Aug 2015 05:54:11 -0400 Received: by wibhh20 with SMTP id hh20so142940801wib.0 for ; Mon, 10 Aug 2015 02:54:09 -0700 (PDT) X-Received: by 10.194.121.131 with SMTP id lk3mr40811572wjb.77.1439200449715; Mon, 10 Aug 2015 02:54:09 -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.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:09 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Magnus Damm , Laurent Pinchart , Paul Mundt Subject: [PATCH 30/74] clockevents/drivers/sh_mtu2: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:51:47 +0200 Message-Id: <1439200352-26767-30-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.215.41 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 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 Signed-off-by: Daniel Lezcano Acked-by: Laurent Pinchart --- 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 3d88698..f1985da 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;