From patchwork Mon Apr 14 16:24:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28352 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 25E9620534 for ; Mon, 14 Apr 2014 16:28:39 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id if11sf28859221vcb.0 for ; Mon, 14 Apr 2014 09:28: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: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=A7Qbgh8DCbdqWDO/C+Nk1d6SPbFsF1LjDgM+8WpU9EI=; b=VwAe1LnrYiDcMt2uK4BtIFYG0C3OvCir9KGbSO+hipLr87jTg79S8YoEKp46XMmac+ fz3a0T7QQwpaHgLJaQsfakMEND5ZewAUb+lWZ9xyRd6KQpeyq0WK1RDiijq0a5Sbjyr6 QYKwnTd+TfdA3S2BINbIXSq5sBi0iBj5ALO2Y2O5fdpIpIm6WklaiYgfL1XZlJmTmwFv TmNd54u7ewTaUX6TNcn+DvIsjqAuviN74FYvgpa+E6RI1WAoY6DHNOj/aJy42WiLBWX5 iYD+e8vHBITweBAgQZug8+SpXMINYuB9kPjuULzpKKaqtjKTJTOvIQRPr79ymZNIAlcQ MfDA== X-Gm-Message-State: ALoCoQlUDvCQXNCZE3n2IMH61NK2KLpboPGFKP7UDDIU2C4zoOkYgp8mIHZp2oG0aYG2pfHagyFH X-Received: by 10.236.137.50 with SMTP id x38mr20189831yhi.9.1397492918850; Mon, 14 Apr 2014 09:28:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.106 with SMTP id 97ls2683072qgo.34.gmail; Mon, 14 Apr 2014 09:28:38 -0700 (PDT) X-Received: by 10.58.88.8 with SMTP id bc8mr487156veb.39.1397492918735; Mon, 14 Apr 2014 09:28:38 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id cm9si2831886vcb.154.2014.04.14.09.28.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:28:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 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.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so7601239veb.5 for ; Mon, 14 Apr 2014 09:28:38 -0700 (PDT) X-Received: by 10.58.90.99 with SMTP id bv3mr1011170veb.34.1397492918652; Mon, 14 Apr 2014 09:28:38 -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 ib8csp162947vcb; Mon, 14 Apr 2014 09:28:38 -0700 (PDT) X-Received: by 10.66.227.104 with SMTP id rz8mr45322728pac.74.1397492916911; Mon, 14 Apr 2014 09:28:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tc10si6201513pbc.203.2014.04.14.09.28.35; Mon, 14 Apr 2014 09:28:35 -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 S1755946AbaDNQ20 (ORCPT + 26 others); Mon, 14 Apr 2014 12:28:26 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:47101 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754692AbaDNQ2X (ORCPT ); Mon, 14 Apr 2014 12:28:23 -0400 Received: by mail-pa0-f42.google.com with SMTP id fb1so8497296pad.1 for ; Mon, 14 Apr 2014 09:28:22 -0700 (PDT) X-Received: by 10.66.163.2 with SMTP id ye2mr45216107pab.110.1397492902539; Mon, 14 Apr 2014 09:28:22 -0700 (PDT) Received: from localhost ([122.167.126.16]) by mx.google.com with ESMTPSA id cz3sm34777148pbc.9.2014.04.14.09.28.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:28:21 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Arvind.Chauhan@arm.com, linaro-networking@linaro.org, Viresh Kumar Subject: [PATCH 38/38] clockevents: set event_handler to clockevents_handle_noop() in clockevents_exchange_device() Date: Mon, 14 Apr 2014 21:54:00 +0530 Message-Id: <8b416eb5d9362b014d1954df08f8001d03889f2f.1397492345.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.174 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: , All users of clockevents_handle_noop() are setting old->event_handler to it after calling clockevents_exchange_device() and so it would be better if we can do this at a single place. The only thing we need to make sure is, we preserve it before calling clockevents_exchange_device() in case we need it. As there are no external users of it, make it static. Signed-off-by: Viresh Kumar --- include/linux/clockchips.h | 2 -- kernel/time/clockevents.c | 3 ++- kernel/time/tick-broadcast.c | 2 -- kernel/time/tick-common.c | 11 +++++------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 2e4cb67..7e492ad 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -165,8 +165,6 @@ extern void clockevents_set_mode(struct clock_event_device *dev, extern int clockevents_program_event(struct clock_event_device *dev, ktime_t expires, bool force); -extern void clockevents_handle_noop(struct clock_event_device *dev); - static inline void clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec) { diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index d80e891..757dae8 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -480,7 +480,7 @@ int clockevents_update_freq(struct clock_event_device *dev, u32 freq) /* * Noop handler when we shut down an event device */ -void clockevents_handle_noop(struct clock_event_device *dev) +static void clockevents_handle_noop(struct clock_event_device *dev) { } @@ -506,6 +506,7 @@ void clockevents_exchange_device(struct clock_event_device *old, clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED); list_del(&old->list); list_add(&old->list, &clockevents_released); + old->event_handler = clockevents_handle_noop; } if (new) { diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 9d81a81..bb96da7 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -95,8 +95,6 @@ void tick_install_broadcast_device(struct clock_event_device *dev) return; clockevents_exchange_device(cur, dev); - if (cur) - cur->event_handler = clockevents_handle_noop; tick_broadcast_device.evtdev = dev; if (!cpumask_empty(tick_broadcast_mask)) tick_broadcast_start_periodic(dev); diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index e1b2947..b0d14e3 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -145,11 +145,11 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast) * Setup the tick device */ static void tick_setup_device(struct tick_device *td, - struct clock_event_device *newdev, int cpu) + struct clock_event_device *newdev, int cpu, + void (*handler)(struct clock_event_device *)) { const struct cpumask *cpumask = cpumask_of(cpu); ktime_t next_event; - void (*handler)(struct clock_event_device *) = NULL; /* * First device setup ? @@ -173,9 +173,7 @@ static void tick_setup_device(struct tick_device *td, */ td->mode = TICKDEV_MODE_PERIODIC; } else { - handler = td->evtdev->event_handler; next_event = td->evtdev->next_event; - td->evtdev->event_handler = clockevents_handle_noop; } td->evtdev = newdev; @@ -206,10 +204,12 @@ static void tick_setup_device(struct tick_device *td, void tick_install_replacement(struct clock_event_device *newdev) { struct tick_device *td = tick_get_cpu_device(); + void (*handler)(struct clock_event_device *) = + td->evtdev->event_handler; int cpu = smp_processor_id(); clockevents_exchange_device(td->evtdev, newdev); - tick_setup_device(td, newdev, cpu); + tick_setup_device(td, newdev, cpu, handler); if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) tick_oneshot_notify(); } @@ -335,7 +335,6 @@ void tick_shutdown(unsigned int *cpup) * the set mode function! */ clockevents_exchange_device(dev, NULL); - dev->event_handler = clockevents_handle_noop; td->evtdev = NULL; } }