From patchwork Mon Aug 10 09:51:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52218 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 899C82152A for ; Mon, 10 Aug 2015 10:14:01 +0000 (UTC) Received: by lagz9 with SMTP id z9sf40548396lag.3 for ; Mon, 10 Aug 2015 03:14:00 -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=OGpIy+MxOmPd2ISSDfw+CdZLGIyG5y9+y+c6HMN3UEQ=; b=fK7SoYAT3enyVzZS5KJINn4WPQ8qS/Naob9D0C2pRuzJDAZFwferti1SXcApJJfLPR iQyOvG0u1CsCPmDsFlJWHgq8kn1jCvXeJvtHOr93vXQPZGXfOFMWldCo4NA2256kOdFF 9zC2S7fWH1QKuMc544kX8ssP05QSFl075Pq6MmlzQNtDRE2R8ZuCCqNv9vO7SnZI6Ej7 S3Yxl7r9j6blLZZ6Bf4ft1xpyzJCZd5S8X2aMq+Yodh5knxih2GIacwU50BZIIMl7SLP 6O8reiMrc0l5VCm5sN/SOCUqC7+z+N3/aVKUPr08wNXI6q/yePmRcYbcH/RQYxk6D6On UQTQ== X-Gm-Message-State: ALoCoQnkp483ZphiMQgQy+djVYtUN+Kj+HP5p9wMzqBJx7EPQoxNzmzn/toYE373efSpn13CrvBQ X-Received: by 10.112.161.35 with SMTP id xp3mr3140421lbb.2.1439201640334; Mon, 10 Aug 2015 03:14:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.162 with SMTP id z2ls168786laj.101.gmail; Mon, 10 Aug 2015 03:14:00 -0700 (PDT) X-Received: by 10.152.234.75 with SMTP id uc11mr19359420lac.20.1439201640152; Mon, 10 Aug 2015 03:14:00 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id ax10si13768736lbc.94.2015.08.10.03.14.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 03:14:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbpo9 with SMTP id po9so92411530lbb.2 for ; Mon, 10 Aug 2015 03:14:00 -0700 (PDT) X-Received: by 10.112.176.228 with SMTP id cl4mr19584125lbc.106.1439201640052; Mon, 10 Aug 2015 03:14:00 -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 l6csp1837617lba; Mon, 10 Aug 2015 03:13:58 -0700 (PDT) X-Received: by 10.66.65.138 with SMTP id x10mr42862013pas.61.1439201637965; Mon, 10 Aug 2015 03:13:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ss1si32349084pbc.93.2015.08.10.03.13.57; Mon, 10 Aug 2015 03:13:57 -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 S933707AbbHJKNz (ORCPT + 28 others); Mon, 10 Aug 2015 06:13:55 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:38836 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932240AbbHJJxe (ORCPT ); Mon, 10 Aug 2015 05:53:34 -0400 Received: by wicja10 with SMTP id ja10so17893746wic.1 for ; Mon, 10 Aug 2015 02:53:33 -0700 (PDT) X-Received: by 10.194.20.161 with SMTP id o1mr45315907wje.32.1439200413407; Mon, 10 Aug 2015 02:53:33 -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.53.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:53:32 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Magnus Damm Subject: [PATCH 06/74] clockevents/drivers/em_sti: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:51:23 +0200 Message-Id: <1439200352-26767-6-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.217.173 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 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 Signed-off-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 dc3c6ee..7a97a34 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); }