From patchwork Thu Jun 18 10:54:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 6635991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4DF1CC0020 for ; Thu, 18 Jun 2015 11:38:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65E8F207D1 for ; Thu, 18 Jun 2015 11:38:43 +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 8BEFB207E6 for ; Thu, 18 Jun 2015 11:38:42 +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 1Z5Y72-0006hZ-AJ; Thu, 18 Jun 2015 11:36:04 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5Y5u-00056k-5s for linux-arm-kernel@bombadil.infradead.org; Thu, 18 Jun 2015 11:34:54 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XUb-0003zj-Od for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2015 10:56:22 +0000 Received: by padev16 with SMTP id ev16so59055895pad.0 for ; Thu, 18 Jun 2015 03:56: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:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=XVDQvK7wZyXbnVi/ru26c/aWHHalkqhMeIviKkOAZnQ=; b=QFlhp9nEaUn0wRfKEZ/DcP6PObj7n/mUpEH25n6oMgYF7t9VissRn5jJZLTl/QD23c WRdJprEoh3JX1pWuSQZwx3XUkLAJaN1P+34EHeGxQfAiUvuu5v7xGF/mcMDEYuri1L3L w3FMAHGF7Hmix1/OCBLMsqUfT7WFmagXsaDJZPShxFS6rirCUFADdqB+pnhW+3wkwZgz 46nlHgLyy8QHww/h5P80DMZX+geG0hCMwUM8V3jMj7XtWYvIWWwJt/n7FDp8lqs+YYLL /5pbgLo6ulndPz/Iv+cqre5VVIupw+KnjmDvcyvSME0i/eQI8XearJ1Ic7+rC40v+K4Q fSwA== X-Gm-Message-State: ALoCoQl0Q666cvb+Jzy25GEKnQ+z2a+qt7WpRtvCmBGFHsZRR0WGgsBNZGRqlRqbAhqdLtMOybnF X-Received: by 10.70.128.13 with SMTP id nk13mr19823973pdb.21.1434624960768; Thu, 18 Jun 2015 03:56:00 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id ks9sm7689917pdb.36.2015.06.18.03.55.59 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:56:00 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Subject: [PATCH 16/41] clocksource: pxa: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:30 +0530 Message-Id: <3aa5c1a740911258698769cbbb8f60ee02178848.1434622147.git.viresh.kumar@linaro.org> 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-20150618_065622_086519_CBCC2FA9 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, Russell King , Viresh Kumar , linux-kernel@vger.kernel.org, Robert Jarzmik , 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 pxa 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. Both oneshot and shutdown modes had exactly same code and so only a single callback is sufficient now, which will be called for both the modes. Cc: Robert Jarzmik Cc: Russell King Signed-off-by: Viresh Kumar Acked-by: Robert Jarzmik --- drivers/clocksource/pxa_timer.c | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/clocksource/pxa_timer.c b/drivers/clocksource/pxa_timer.c index d9438af2bbd6..45b6a4999713 100644 --- a/drivers/clocksource/pxa_timer.c +++ b/drivers/clocksource/pxa_timer.c @@ -88,26 +88,12 @@ pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev) return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; } -static void -pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) +static int pxa_osmr0_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_ONESHOT: - timer_writel(timer_readl(OIER) & ~OIER_E0, OIER); - timer_writel(OSSR_M0, OSSR); - break; - - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - /* initializing, released, or preparing for suspend */ - timer_writel(timer_readl(OIER) & ~OIER_E0, OIER); - timer_writel(OSSR_M0, OSSR); - break; - - case CLOCK_EVT_MODE_RESUME: - case CLOCK_EVT_MODE_PERIODIC: - break; - } + /* initializing, released, or preparing for suspend */ + timer_writel(timer_readl(OIER) & ~OIER_E0, OIER); + timer_writel(OSSR_M0, OSSR); + return 0; } #ifdef CONFIG_PM @@ -147,13 +133,14 @@ static void pxa_timer_resume(struct clock_event_device *cedev) #endif static struct clock_event_device ckevt_pxa_osmr0 = { - .name = "osmr0", - .features = CLOCK_EVT_FEAT_ONESHOT, - .rating = 200, - .set_next_event = pxa_osmr0_set_next_event, - .set_mode = pxa_osmr0_set_mode, - .suspend = pxa_timer_suspend, - .resume = pxa_timer_resume, + .name = "osmr0", + .features = CLOCK_EVT_FEAT_ONESHOT, + .rating = 200, + .set_next_event = pxa_osmr0_set_next_event, + .set_state_shutdown = pxa_osmr0_shutdown, + .set_state_oneshot = pxa_osmr0_shutdown, + .suspend = pxa_timer_suspend, + .resume = pxa_timer_resume, }; static struct irqaction pxa_ost0_irq = {