From patchwork Thu Jul 16 11:26:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51151 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 334C022A28 for ; Thu, 16 Jul 2015 11:27:21 +0000 (UTC) Received: by wgfk9 with SMTP id k9sf18111485wgf.1 for ; Thu, 16 Jul 2015 04:27:20 -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=GtdDoIWM1na8GvmbsLUKy477Lm9fCNGdlcU6dy6v+4Y=; b=Ji6DoHizJv9b554MDS8EUTIDHa6HsFMSbtuoBQWhZ3grN2TottiKt84PWwAhscD/ro QAmPBaLm6h3Rmqb9HOQGMpyLSFZi08FAkePv/oADeLRwyN5jfNQfngMYAyOcT/JqkeYq 1H+ZVaonq7LcFeh9d4X3vo6HCXrY3d+e0BG9WRWYKCd30XBhFYLhI5I9UHn5wzipaYXy lL2LVBmgAiSFcGmKqJEKvCbe76U8LGufgR81XTg4hzx5GOLpRytw1PfG5UO9dSl9jq+1 KboY6tNcapbKCc42KvNIo3SXTNqFYLnJJJtfAJ6e7mt2d0+MtMyumbH5pRW6f0FL3lGv 7JTQ== X-Gm-Message-State: ALoCoQkQAfKcW2KpI4ICfjcHoSaAZqAa2OFqCflttTajNJ/THJour7WiD48Pnbroy6RtMusxHmko X-Received: by 10.152.6.103 with SMTP id z7mr4639223laz.8.1437046040534; Thu, 16 Jul 2015 04:27:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.234 with SMTP id w10ls76054lag.41.gmail; Thu, 16 Jul 2015 04:27:20 -0700 (PDT) X-Received: by 10.112.151.178 with SMTP id ur18mr9021822lbb.59.1437046040269; Thu, 16 Jul 2015 04:27:20 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id wh7si6680836lbb.123.2015.07.16.04.27.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 04:27:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbzr7 with SMTP id zr7so41802439lbb.1 for ; Thu, 16 Jul 2015 04:27:20 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr8876440laj.88.1437046040135; Thu, 16 Jul 2015 04:27:20 -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 hn6csp191110lbb; Thu, 16 Jul 2015 04:27:19 -0700 (PDT) X-Received: by 10.70.135.67 with SMTP id pq3mr17904321pdb.8.1437046038401; Thu, 16 Jul 2015 04:27:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oz3si12584806pdb.69.2015.07.16.04.27.17; Thu, 16 Jul 2015 04:27:18 -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 S1754844AbbGPL1L (ORCPT + 27 others); Thu, 16 Jul 2015 07:27:11 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:34174 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754612AbbGPL1H (ORCPT ); Thu, 16 Jul 2015 07:27:07 -0400 Received: by pdbep18 with SMTP id ep18so44359948pdb.1 for ; Thu, 16 Jul 2015 04:27:07 -0700 (PDT) X-Received: by 10.70.92.70 with SMTP id ck6mr17587273pdb.161.1437046027295; Thu, 16 Jul 2015 04:27:07 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id j4sm7664743pdo.62.2015.07.16.04.27.05 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 04:27:06 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar , Vineet Gupta Subject: [PATCH 02/23] ARC/time: Migrate to new 'set-state' interface Date: Thu, 16 Jul 2015 16:56:14 +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.217.181 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 arc 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. Cc: Vineet Gupta Signed-off-by: Viresh Kumar --- arch/arc/kernel/time.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c index 3364d2bbc515..4294761a2b3e 100644 --- a/arch/arc/kernel/time.c +++ b/arch/arc/kernel/time.c @@ -203,34 +203,24 @@ static int arc_clkevent_set_next_event(unsigned long delta, return 0; } -static void arc_clkevent_set_mode(enum clock_event_mode mode, - struct clock_event_device *dev) +static int arc_clkevent_set_periodic(struct clock_event_device *dev) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - /* - * At X Hz, 1 sec = 1000ms -> X cycles; - * 10ms -> X / 100 cycles - */ - arc_timer_event_setup(arc_get_core_freq() / HZ); - break; - case CLOCK_EVT_MODE_ONESHOT: - break; - default: - break; - } - - return; + /* + * At X Hz, 1 sec = 1000ms -> X cycles; + * 10ms -> X / 100 cycles + */ + arc_timer_event_setup(arc_get_core_freq() / HZ); + return 0; } static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = { - .name = "ARC Timer0", - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .mode = CLOCK_EVT_MODE_UNUSED, - .rating = 300, - .irq = TIMER0_IRQ, /* hardwired, no need for resources */ - .set_next_event = arc_clkevent_set_next_event, - .set_mode = arc_clkevent_set_mode, + .name = "ARC Timer0", + .features = CLOCK_EVT_FEAT_ONESHOT | + CLOCK_EVT_FEAT_PERIODIC, + .rating = 300, + .irq = TIMER0_IRQ, /* hardwired, no need for resources */ + .set_next_event = arc_clkevent_set_next_event, + .set_state_periodic = arc_clkevent_set_periodic, }; static irqreturn_t timer_irq_handler(int irq, void *dev_id) @@ -240,7 +230,7 @@ static irqreturn_t timer_irq_handler(int irq, void *dev_id) * irq_set_chip_and_handler() asked for handle_percpu_devid_irq() */ struct clock_event_device *evt = this_cpu_ptr(&arc_clockevent_device); - int irq_reenable = evt->mode == CLOCK_EVT_MODE_PERIODIC; + int irq_reenable = clockevent_state_periodic(evt); /* * Any write to CTRL reg ACks the interrupt, we rewrite the