From patchwork Mon Jun 8 13:40:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49620 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 55E8A214B2 for ; Mon, 8 Jun 2015 13:41:42 +0000 (UTC) Received: by wgme6 with SMTP id e6sf32809843wgm.3 for ; Mon, 08 Jun 2015 06:41:41 -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=wLAbovkfkloMBqndohfV2MCdRioqzjhh/bCZGLnn/rk=; b=g3eedmr+G38t/GAFk3h7OpZNIYrPjO8A9d2+Oeag1MzkAJE9Cf0CJn9/IHiTLTFQ/Q TU9I7cOP2SCMBQ2r4o0HotarVc8Q3mCDrxBHKsamShFNOIb1+9fgg9ldmuWpC/pzXZwx vm+LNnz5wAJ2ERnLyLccG+LJHi7LMtPfsvuaoE+iHhAtX4A8v+nmPOYu/YJlxtgaqWS3 voc8xBbmJ38bgHkEPfpBMscaCuW+i2QsOjImL/1vNwptUED8AnYuc5BSkLHrSuSkyn04 OuNK6Vg1BnoWZvsSufE+vCy1+zTgg5/j+grUmuSsyPyZ1B1c3QrxtAFBvckDLrO0Kb/f ajRg== X-Gm-Message-State: ALoCoQlZTyTlz+M8iV67T+E1gkVfDnn1vDe39Ndrup45Q/8BEaGPQFG6r20/K2efjPbe/MSD6jIf X-Received: by 10.112.84.104 with SMTP id x8mr17076854lby.23.1433770901447; Mon, 08 Jun 2015 06:41:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.73 with SMTP id i9ls683166lai.100.gmail; Mon, 08 Jun 2015 06:41:41 -0700 (PDT) X-Received: by 10.112.218.67 with SMTP id pe3mr16128246lbc.53.1433770901268; Mon, 08 Jun 2015 06:41:41 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id j6si2767269lag.54.2015.06.08.06.41.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jun 2015 06:41:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbtu8 with SMTP id tu8so64992484lbb.2 for ; Mon, 08 Jun 2015 06:41:41 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr17093233laa.106.1433770901162; Mon, 08 Jun 2015 06:41:41 -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 hn6csp1874178lbb; Mon, 8 Jun 2015 06:41:40 -0700 (PDT) X-Received: by 10.68.108.65 with SMTP id hi1mr29504504pbb.129.1433770899331; Mon, 08 Jun 2015 06:41:39 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bq16si4154483pdb.214.2015.06.08.06.41.38; Mon, 08 Jun 2015 06:41:39 -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 S932107AbbFHNlc (ORCPT + 28 others); Mon, 8 Jun 2015 09:41:32 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36309 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752814AbbFHNlQ (ORCPT ); Mon, 8 Jun 2015 09:41:16 -0400 Received: by pabqy3 with SMTP id qy3so97766681pab.3 for ; Mon, 08 Jun 2015 06:41:15 -0700 (PDT) X-Received: by 10.66.231.42 with SMTP id td10mr29356058pac.98.1433770875817; Mon, 08 Jun 2015 06:41:15 -0700 (PDT) Received: from localhost ([122.167.219.251]) by mx.google.com with ESMTPSA id pr5sm2694595pbc.63.2015.06.08.06.41.14 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 08 Jun 2015 06:41:15 -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 , Marc Zyngier Subject: [PATCH 1/6] clocksource: arm_arch_timer: Migrate to new 'set-state' interface Date: Mon, 8 Jun 2015 19:10:42 +0530 Message-Id: <80bb7da364daf25660d130513d386353ac78a640.1433768426.git.viresh.kumar@linaro.org> 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.176 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 arm_arch_timer 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. Cc: Marc Zyngier Signed-off-by: Viresh Kumar --- drivers/clocksource/arm_arch_timer.c | 61 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 0aa135ddbf80..d0b0cf43b981 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -181,44 +181,44 @@ static irqreturn_t arch_timer_handler_virt_mem(int irq, void *dev_id) return timer_handler(ARCH_TIMER_MEM_VIRT_ACCESS, evt); } -static __always_inline void timer_set_mode(const int access, int mode, - struct clock_event_device *clk) +static __always_inline void timer_shutdown(const int access, + struct clock_event_device *clk) { unsigned long ctrl; - switch (mode) { - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL, clk); - ctrl &= ~ARCH_TIMER_CTRL_ENABLE; - arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk); - break; - default: - break; - } + + ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL, clk); + ctrl &= ~ARCH_TIMER_CTRL_ENABLE; + arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk); } -static void arch_timer_set_mode_virt(enum clock_event_mode mode, - struct clock_event_device *clk) +static int arch_timer_shutdown_virt(struct clock_event_device *clk) { - timer_set_mode(ARCH_TIMER_VIRT_ACCESS, mode, clk); + timer_shutdown(ARCH_TIMER_VIRT_ACCESS, clk); + return 0; } -static void arch_timer_set_mode_phys(enum clock_event_mode mode, - struct clock_event_device *clk) +static int arch_timer_shutdown_phys(struct clock_event_device *clk) { - timer_set_mode(ARCH_TIMER_PHYS_ACCESS, mode, clk); + timer_shutdown(ARCH_TIMER_PHYS_ACCESS, clk); + return 0; } -static void arch_timer_set_mode_virt_mem(enum clock_event_mode mode, - struct clock_event_device *clk) +static int arch_timer_shutdown_virt_mem(struct clock_event_device *clk) { - timer_set_mode(ARCH_TIMER_MEM_VIRT_ACCESS, mode, clk); + timer_shutdown(ARCH_TIMER_MEM_VIRT_ACCESS, clk); + return 0; } -static void arch_timer_set_mode_phys_mem(enum clock_event_mode mode, - struct clock_event_device *clk) +static int arch_timer_shutdown_phys_mem(struct clock_event_device *clk) { - timer_set_mode(ARCH_TIMER_MEM_PHYS_ACCESS, mode, clk); + timer_shutdown(ARCH_TIMER_MEM_PHYS_ACCESS, clk); + return 0; +} + +static int arch_timer_set_oneshot(struct clock_event_device *clk) +{ + /* Nothing to do here */ + return 0; } static __always_inline void set_next_event(const int access, unsigned long evt, @@ -273,11 +273,11 @@ static void __arch_timer_setup(unsigned type, clk->cpumask = cpumask_of(smp_processor_id()); if (arch_timer_use_virtual) { clk->irq = arch_timer_ppi[VIRT_PPI]; - clk->set_mode = arch_timer_set_mode_virt; + clk->set_state_shutdown = arch_timer_shutdown_virt; clk->set_next_event = arch_timer_set_next_event_virt; } else { clk->irq = arch_timer_ppi[PHYS_SECURE_PPI]; - clk->set_mode = arch_timer_set_mode_phys; + clk->set_state_shutdown = arch_timer_shutdown_phys; clk->set_next_event = arch_timer_set_next_event_phys; } } else { @@ -286,17 +286,18 @@ static void __arch_timer_setup(unsigned type, clk->rating = 400; clk->cpumask = cpu_all_mask; if (arch_timer_mem_use_virtual) { - clk->set_mode = arch_timer_set_mode_virt_mem; + clk->set_state_shutdown = arch_timer_shutdown_virt_mem; clk->set_next_event = arch_timer_set_next_event_virt_mem; } else { - clk->set_mode = arch_timer_set_mode_phys_mem; + clk->set_state_shutdown = arch_timer_shutdown_phys_mem; clk->set_next_event = arch_timer_set_next_event_phys_mem; } } - clk->set_mode(CLOCK_EVT_MODE_SHUTDOWN, clk); + clk->set_state_oneshot = arch_timer_set_oneshot; + clk->set_state_shutdown(clk); clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff); } @@ -506,7 +507,7 @@ static void arch_timer_stop(struct clock_event_device *clk) disable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI]); } - clk->set_mode(CLOCK_EVT_MODE_UNUSED, clk); + clk->set_state_shutdown(clk); } static int arch_timer_cpu_notify(struct notifier_block *self,