From patchwork Fri Jun 12 08:00:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49808 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6E391228DB for ; Fri, 12 Jun 2015 08:01:25 +0000 (UTC) Received: by lbcue7 with SMTP id ue7sf7686881lbc.3 for ; Fri, 12 Jun 2015 01:01:24 -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=pqa2j0b0q++Tgn3kAZKOcxmEMwm3tW5nTvOlK6KVcZ8=; b=ezncpfV6OaejVO7Q/E6mg1t5+negYyvBUfh/4bLWd9PInf0mehmOj4tLxNRlHiOE/c 3ZcYK21FeBnDpYGTIWFsyCVyt1nLV0n4oVl2q1r0GCXjJtNrXLUK9WiYKQTDOAQXlNUl UCTvcBThnF/bcnuIvGqVpo6siSmOvZ3KAp+tV5SScOjOhn+8mQRIz70OVTGgY14nZFAA MWZE+H9YppZmfYAimh+uD1UnYqO9d0MEAa7yrjIuJpAEmFFyAOXWLZuvtGS21s1XjEz7 bF619RiEKwS9DKKr6efmekrh4657w97F3WUxbLzGLsBqyVFSrk/bk4cAE17Qyr890/rs mx7g== X-Gm-Message-State: ALoCoQm+0ZlRO6Wtkcp++rHTBbstOj+zgCdOChQN0xjcTiiV1idwxfTHowSNVIR4ksRluEowX20P X-Received: by 10.194.47.179 with SMTP id e19mr13025571wjn.4.1434096084480; Fri, 12 Jun 2015 01:01:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.226 with SMTP id q2ls546403lae.73.gmail; Fri, 12 Jun 2015 01:01:24 -0700 (PDT) X-Received: by 10.112.140.9 with SMTP id rc9mr14037115lbb.14.1434096084287; Fri, 12 Jun 2015 01:01:24 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id tp6si2751137lbb.97.2015.06.12.01.01.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 01:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbtu8 with SMTP id tu8so15524735lbb.2 for ; Fri, 12 Jun 2015 01:01:24 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr13670301lay.72.1434096084184; Fri, 12 Jun 2015 01:01:24 -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 hn6csp361738lbb; Fri, 12 Jun 2015 01:01:23 -0700 (PDT) X-Received: by 10.66.231.42 with SMTP id td10mr20944366pac.98.1434096080936; Fri, 12 Jun 2015 01:01:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gf2si4302023pbd.94.2015.06.12.01.01.19; Fri, 12 Jun 2015 01:01: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 S1755140AbbFLIBM (ORCPT + 29 others); Fri, 12 Jun 2015 04:01:12 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:36100 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751512AbbFLIA6 (ORCPT ); Fri, 12 Jun 2015 04:00:58 -0400 Received: by pdjm12 with SMTP id m12so19764747pdj.3 for ; Fri, 12 Jun 2015 01:00:57 -0700 (PDT) X-Received: by 10.70.131.73 with SMTP id ok9mr21052943pdb.109.1434096057662; Fri, 12 Jun 2015 01:00:57 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id ko1sm2760736pdb.58.2015.06.12.01.00.56 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 12 Jun 2015 01:00:56 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar , Magnus Damm Subject: [PATCH V2 7/7] clocksource: em_sti: Migrate to new 'set-state' interface Date: Fri, 12 Jun 2015 13:30:17 +0530 Message-Id: <74f9c0ad37cdcddb99cbd5565b5ff47ee0a88842.1434095303.git.viresh.kumar@linaro.org> 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.217.182 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 em_sti driver to the new 'set-state' interface provided by the 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. NOTE: This also drops a special check: if (old_mode == CLOCK_EVT_MODE_ONESHOT) em_sti_stop(p, USER_CLOCKEVENT); as it doesn't look like that important. This driver only supports ONESHOT and we can only move only to SHUTDOWN from ONESHOT and. Also on second call (on shutdown), em_sti_stop() would return without disabling the device again. Acked-by: Daniel Lezcano Cc: Magnus Damm Signed-off-by: Viresh Kumar --- drivers/clocksource/em_sti.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c index dc3c6ee04aaa..7a97a34dba70 100644 --- a/drivers/clocksource/em_sti.c +++ b/drivers/clocksource/em_sti.c @@ -251,33 +251,21 @@ static struct em_sti_priv *ced_to_em_sti(struct clock_event_device *ced) return container_of(ced, struct em_sti_priv, ced); } -static void em_sti_clock_event_mode(enum clock_event_mode mode, - struct clock_event_device *ced) +static int em_sti_clock_event_shutdown(struct clock_event_device *ced) { struct em_sti_priv *p = ced_to_em_sti(ced); + em_sti_stop(p, USER_CLOCKEVENT); + return 0; +} - /* deal with old setting first */ - switch (ced->mode) { - case CLOCK_EVT_MODE_ONESHOT: - em_sti_stop(p, USER_CLOCKEVENT); - break; - default: - break; - } +static int em_sti_clock_event_set_oneshot(struct clock_event_device *ced) +{ + struct em_sti_priv *p = ced_to_em_sti(ced); - switch (mode) { - case CLOCK_EVT_MODE_ONESHOT: - dev_info(&p->pdev->dev, "used for oneshot clock events\n"); - em_sti_start(p, USER_CLOCKEVENT); - clockevents_config(&p->ced, p->rate); - break; - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_UNUSED: - em_sti_stop(p, USER_CLOCKEVENT); - break; - default: - break; - } + dev_info(&p->pdev->dev, "used for oneshot clock events\n"); + em_sti_start(p, USER_CLOCKEVENT); + clockevents_config(&p->ced, p->rate); + return 0; } static int em_sti_clock_event_next(unsigned long delta, @@ -303,11 +291,12 @@ static void em_sti_register_clockevent(struct em_sti_priv *p) ced->rating = 200; ced->cpumask = cpu_possible_mask; ced->set_next_event = em_sti_clock_event_next; - ced->set_mode = em_sti_clock_event_mode; + ced->set_state_shutdown = em_sti_clock_event_shutdown; + ced->set_state_oneshot = em_sti_clock_event_set_oneshot; dev_info(&p->pdev->dev, "used for clock events\n"); - /* Register with dummy 1 Hz value, gets updated in ->set_mode() */ + /* Register with dummy 1 Hz value, gets updated in ->set_state_oneshot() */ clockevents_config_and_register(ced, 1, 2, 0xffffffff); }