From patchwork Mon Jun 8 13:40:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49624 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 171AB214B2 for ; Mon, 8 Jun 2015 13:42:54 +0000 (UTC) Received: by wibut5 with SMTP id ut5sf21272670wib.0 for ; Mon, 08 Jun 2015 06:42:53 -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=CjEUJ1Gpwh4NPK6H+MDHpHS5JRjfkixbIaoEOgX7YsY=; b=PbZJCv6FS++xxcWkONUASPzC9iadZqGvCXkt/z0WXUuB5OXoClhWi81vtvBT1rsbIO hVfFyPO3O+H5CeJNqrbpWf47LgJqyg98an+yGpf1rMs/0BX9GIXc/7SQovV2OLQ0LQcY +aEV03U7qAXFf8inCSrZy+wYRBHSFjgUhHdsYNc7zdWq0LLZuwzNfsADvryL4SkYPOT8 BmParHaa6LvJZwh23kKmlqREhVyPwLzgNUi5haYDq4q2P6euU1y8csNJ+YFWy3ZHa/D6 0POuZ24FzfBWzTZm36flGLUTXoHsocjxpAdqoocO3WH6zn/iE/d2q16vJfIDRQE+sh/2 8xGg== X-Gm-Message-State: ALoCoQnMlwzAhO63w8b+9GvqEEfg6yBS09rd7vhgmH+UmU86M5yxnoyLatn43Z/N0n5JLK4mA6e/ X-Received: by 10.112.142.170 with SMTP id rx10mr17200421lbb.12.1433770973354; Mon, 08 Jun 2015 06:42:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.65 with SMTP id o1ls693055laj.108.gmail; Mon, 08 Jun 2015 06:42:53 -0700 (PDT) X-Received: by 10.112.13.97 with SMTP id g1mr16864618lbc.52.1433770973174; Mon, 08 Jun 2015 06:42:53 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id y10si2744854lal.136.2015.06.08.06.42.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jun 2015 06:42:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by laar3 with SMTP id r3so48176542laa.3 for ; Mon, 08 Jun 2015 06:42:53 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr16781284lbb.76.1433770973061; Mon, 08 Jun 2015 06:42:53 -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 hn6csp1874842lbb; Mon, 8 Jun 2015 06:42:51 -0700 (PDT) X-Received: by 10.66.218.193 with SMTP id pi1mr29322455pac.152.1433770971254; Mon, 08 Jun 2015 06:42:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id le1si4193732pab.92.2015.06.08.06.42.50; Mon, 08 Jun 2015 06:42:51 -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 S932496AbbFHNmf (ORCPT + 28 others); Mon, 8 Jun 2015 09:42:35 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33645 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932136AbbFHNli (ORCPT ); Mon, 8 Jun 2015 09:41:38 -0400 Received: by padev16 with SMTP id ev16so40619404pad.0 for ; Mon, 08 Jun 2015 06:41:38 -0700 (PDT) X-Received: by 10.68.218.103 with SMTP id pf7mr29654124pbc.32.1433770897983; Mon, 08 Jun 2015 06:41:37 -0700 (PDT) Received: from localhost ([122.167.219.251]) by mx.google.com with ESMTPSA id ql9sm2694458pbc.65.2015.06.08.06.41.36 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 08 Jun 2015 06:41:37 -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 Subject: [PATCH 6/6] clocksource: em_sti: Migrate to new 'set-state' interface Date: Mon, 8 Jun 2015 19:10:47 +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.50 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. Cc: Magnus Damm Signed-off-by: Viresh Kumar Acked-by: Daniel Lezcano --- 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); }