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: 6565401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 537C39F1C1 for ; Mon, 8 Jun 2015 13:46:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B460203E3 for ; Mon, 8 Jun 2015 13:46:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F745203B8 for ; Mon, 8 Jun 2015 13:46:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z1xL8-0006bZ-7q; Mon, 08 Jun 2015 13:43:46 +0000 Received: from mail-pd0-f174.google.com ([209.85.192.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z1xJP-0005VB-5u for linux-arm-kernel@lists.infradead.org; Mon, 08 Jun 2015 13:41:59 +0000 Received: by pdjn11 with SMTP id n11so67268001pdj.0 for ; Mon, 08 Jun 2015 06:41:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=J8K7F8TD/PT/tujYl3YpetG8gdNf2yP15lnPpse6enE=; b=hQ7MxHLlocs0DTvFPMlMXOz5Fkl3h14U2xs7e1Kr5+EYCgcBjIWX+63c3JPmLkyt4/ +AvevwPJMv9IMIjJum9Yb1I0k025MLowoVh5o8S29t9hh6o0LPx6BkIEyHIec0mkbhGr 29naLYjqFd9Kzad6LqY+q2bMywXnAV3JhppNfXtgcpJvcZNsG/p3Z/a8lP9JlI6cMs5C /WhF+OhsTBvBinWtfgByW5zGCrUHXFapwEA8DerFnUGMS218VQyJJZwKDU1nLhJrUqBW +jz2uvmXqqi/BzWMyg2b5i3+Sg4f6Uwi2FHxGQ2SO+475CTyuEGKBuPXrEa+VI5KO2i+ ZJ5g== X-Gm-Message-State: ALoCoQmJH1P6JOjjfMVUUbShDpbbmsGwfN8JWIHMd7jqm6zvFZHqq0sLVtzlPHKOz8+r+tK+2ZnT 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150608_064159_265912_82687808 X-CRM114-Status: GOOD ( 13.83 ) X-Spam-Score: -1.8 (-) Cc: Viresh Kumar , linaro-kernel@lists.linaro.org, Magnus Damm , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }