From patchwork Mon Apr 21 09:55:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28675 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4D535203F3 for ; Mon, 21 Apr 2014 09:57:02 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id jy13sf20522436veb.6 for ; Mon, 21 Apr 2014 02:57:02 -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=aaYTxKtZaeYcEZy8kj17uGn9g6CZpnjpzOEdCkhSA/Q=; b=Bd8LXIOZ3n4JJ+4SCxWs3TjJYEMV4+N9sYJQe2Atp5jfQhC+ClQitpP0kike/YAvWy QEkUIVEls7OEP0/SbvOw2R59tA13pRY3YdEkljZONiKkxsDXkMD66fhfUYVPdzHrnXMF YiR2ijZ/zxYVmsWCCPPyKCJXxuriNjoVhHbrmQR4z8ESyuXRikoleYC6LvHJN7X0rQp8 DqVPvWD7imsT6r8bJsi43tk9avc7FLEBSfxxJ/Sg/geV1fDA4Wln/xuf3NFrp5mREubo MdhlbHOQjhBdWDw449BS6dgo870Msj5xTEdAhpbXDP664Wb5TkeIVXE8mWeXybLfCh23 ONcw== X-Gm-Message-State: ALoCoQklY3ab/k7mRzqDT1krmjiHRvKS4vbMnssSWKVEBgCitphqfH3mL6+BZsuN4EO6jJ+u6y43 X-Received: by 10.52.112.163 with SMTP id ir3mr13036100vdb.5.1398074222027; Mon, 21 Apr 2014 02:57:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.112 with SMTP id n103ls527208qga.86.gmail; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) X-Received: by 10.220.190.197 with SMTP id dj5mr29042081vcb.19.1398074221937; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id sq9si6172861vdc.161.2014.04.21.02.57.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 02:57:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id jy13so7843776veb.30 for ; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) X-Received: by 10.220.4.132 with SMTP id 4mr30593514vcr.9.1398074221833; Mon, 21 Apr 2014 02:57:01 -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.220.221.72 with SMTP id ib8csp280270vcb; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) X-Received: by 10.69.20.33 with SMTP id gz1mr16122178pbd.30.1398074221065; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id eg2si20547193pac.387.2014.04.21.02.57.00; Mon, 21 Apr 2014 02:57:00 -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 S1751934AbaDUJ4b (ORCPT + 26 others); Mon, 21 Apr 2014 05:56:31 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:33080 "EHLO mail-we0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbaDUJ4A (ORCPT ); Mon, 21 Apr 2014 05:56:00 -0400 Received: by mail-we0-f169.google.com with SMTP id w62so3586172wes.14 for ; Mon, 21 Apr 2014 02:55:58 -0700 (PDT) X-Received: by 10.181.5.6 with SMTP id ci6mr13359289wid.39.1398074158819; Mon, 21 Apr 2014 02:55:58 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id n5sm15249717wiz.1.2014.04.21.02.55.55 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 21 Apr 2014 02:55:57 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linaro-networking@linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Viresh Kumar Subject: [PATCH V2 06/19] tick: create tick_get_cpu_device() to get tick_cpu_device on this cpu Date: Mon, 21 Apr 2014 15:25:02 +0530 Message-Id: <15f918abab2959e9addd7f66d13e4f4ed821dd7d.1398072824.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e 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=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , We are using &__get_cpu_var(tick_cpu_device) at several places and would be better if we create tick_get_cpu_device() and use it instead. This also converts tick_get_device(smp_processor_id()) to use tick_get_cpu_device(). Signed-off-by: Viresh Kumar --- include/linux/tick.h | 5 +++++ kernel/hrtimer.c | 2 +- kernel/time/tick-broadcast.c | 8 ++++---- kernel/time/tick-common.c | 10 +++++----- kernel/time/tick-oneshot.c | 8 ++++---- kernel/time/tick-sched.c | 2 +- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 45e1331..98065e5 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -92,6 +92,11 @@ static inline struct tick_device *tick_get_device(int cpu) return &per_cpu(tick_cpu_device, cpu); } +static inline struct tick_device *tick_get_cpu_device(void) +{ + return &__get_cpu_var(tick_cpu_device); +} + # ifdef CONFIG_HIGH_RES_TIMERS extern int tick_init_highres(void); extern int tick_program_event(ktime_t expires, int force); diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index d55092c..393f422 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1403,7 +1403,7 @@ static void __hrtimer_peek_ahead_timers(void) if (!hrtimer_hres_active()) return; - td = &__get_cpu_var(tick_cpu_device); + td = tick_get_cpu_device(); if (td && td->evtdev) hrtimer_interrupt(td->evtdev); } diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6289680..bf289cd 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -235,7 +235,7 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST int tick_receive_broadcast(void) { - struct tick_device *td = this_cpu_ptr(&tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); struct clock_event_device *evt = td->evtdev; if (!evt) @@ -337,7 +337,7 @@ static void tick_do_broadcast_on_off(unsigned long *reason) raw_spin_lock_irqsave(&tick_broadcast_lock, flags); cpu = smp_processor_id(); - td = tick_get_device(cpu); + td = tick_get_cpu_device(); dev = td->evtdev; bc = tick_broadcast_device.evtdev; @@ -550,7 +550,7 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc) void tick_check_oneshot_broadcast_this_cpu(void) { if (cpumask_test_cpu(smp_processor_id(), tick_broadcast_oneshot_mask)) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); /* * We might be in the middle of switching over from @@ -700,7 +700,7 @@ int tick_broadcast_oneshot_control(unsigned long reason) * idle code, so we can't be moved away. */ cpu = smp_processor_id(); - td = tick_get_device(cpu); + td = tick_get_cpu_device(); dev = td->evtdev; if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 3f3aa86..1e2c96e 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -58,7 +58,7 @@ int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; */ int tick_is_oneshot_available(void) { - struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) return 0; @@ -219,7 +219,7 @@ static void tick_setup_device(struct tick_device *td, void tick_install_replacement(struct clock_event_device *newdev) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); int cpu = smp_processor_id(); clockevents_exchange_device(td->evtdev, newdev); @@ -291,7 +291,7 @@ void tick_check_new_device(struct clock_event_device *newdev) if (!cpumask_test_cpu(cpu, newdev->cpumask)) goto out_bc; - td = tick_get_device(cpu); + td = tick_get_cpu_device(); curdev = td->evtdev; /* cpu local device ? */ @@ -369,14 +369,14 @@ void tick_shutdown(unsigned int *cpup) void tick_suspend(void) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); clockevents_shutdown(td->evtdev); } void tick_resume(void) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); int broadcast = tick_resume_broadcast(); clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_RESUME); diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 5fe86a7..7089dea 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c @@ -26,7 +26,7 @@ */ int tick_program_event(ktime_t expires, int force) { - struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; return clockevents_program_event(dev, expires, force); } @@ -36,7 +36,7 @@ int tick_program_event(ktime_t expires, int force) */ void tick_resume_oneshot(void) { - struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); clockevents_program_event(dev, ktime_get(), true); @@ -59,7 +59,7 @@ void tick_setup_oneshot(struct clock_event_device *newdev, */ int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); struct clock_event_device *dev = td->evtdev; if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT) || @@ -96,7 +96,7 @@ int tick_oneshot_mode_active(void) int ret; local_irq_save(flags); - ret = __this_cpu_read(tick_cpu_device.mode) == TICKDEV_MODE_ONESHOT; + ret = tick_get_cpu_device()->mode == TICKDEV_MODE_ONESHOT; local_irq_restore(flags); return ret; diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 9e9ddba..5f27c71 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -536,7 +536,7 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts, unsigned long seq, last_jiffies, next_jiffies, delta_jiffies; ktime_t last_update, expires, ret = { .tv64 = 0 }; unsigned long rcu_delta_jiffies; - struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev; + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; u64 time_delta; time_delta = timekeeping_max_deferment();