From patchwork Fri Apr 4 06:36:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27760 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 323FD2036E for ; Fri, 4 Apr 2014 06:44:30 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf9809361pdb.5 for ; Thu, 03 Apr 2014 23:44:29 -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=TQ3Ncj3t6Av5WFEMWHUvFS0xniVAwYrDavVwzGk1Ydw=; b=O+PLMwrqbp3uyu4TJ01DTtuwkr41ezkF4CxMb8bs6PTYVi/6AOVwHFHjDfR7oWTX9V E7rNyvqd/6pu4RfrTejoe9Kbik/tZfR4qPp+1BzeGKSuUAjdSOhQ2DViXKnRXLj+SfKF OFxC0/0iz6RhpGdEZH/mbMUoRjjBKYpG+iI30pIq5mxyun5Ng6bS4sWe8nHD4Un4KKdm ILzpjyL1nQZCQIDpA/8vXUHwZnfsIh+d8MGX/Mubqf5JiUy5qaIJ3xWE6jTfFQA7gw5c hgrfGVEfGMWt7Xuxah8oZ9MtrRO6rfEiensNQwoNxJidwSqvrGJeEvIfnVTJiVu7fxp1 J31g== X-Gm-Message-State: ALoCoQkd0oCYKSAgoesTdtF25FIlanvo1i7yKsrNKl9cvwHKgktz9xDQBPcgP9bbuqzDmFBr1LQd X-Received: by 10.66.240.4 with SMTP id vw4mr6665463pac.10.1396593869395; Thu, 03 Apr 2014 23:44:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.23.106 with SMTP id 97ls905035qgo.34.gmail; Thu, 03 Apr 2014 23:44:29 -0700 (PDT) X-Received: by 10.58.38.166 with SMTP id h6mr147268vek.22.1396593869280; Thu, 03 Apr 2014 23:44:29 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id x6si1635750vcl.120.2014.04.03.23.44.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Apr 2014 23:44:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so2829332vcb.34 for ; Thu, 03 Apr 2014 23:44:29 -0700 (PDT) X-Received: by 10.58.107.65 with SMTP id ha1mr3652363veb.1.1396593869165; Thu, 03 Apr 2014 23:44:29 -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.12.8 with SMTP id v8csp89387vcv; Thu, 3 Apr 2014 23:44:27 -0700 (PDT) X-Received: by 10.68.197.66 with SMTP id is2mr12958574pbc.96.1396593867345; Thu, 03 Apr 2014 23:44:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pm5si4175849pbc.484.2014.04.03.23.44.26; Thu, 03 Apr 2014 23:44:26 -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 S1752638AbaDDGoS (ORCPT + 27 others); Fri, 4 Apr 2014 02:44:18 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35795 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752982AbaDDGnH (ORCPT ); Fri, 4 Apr 2014 02:43:07 -0400 Received: by mail-wi0-f173.google.com with SMTP id z2so596046wiv.12 for ; Thu, 03 Apr 2014 23:43:05 -0700 (PDT) X-Received: by 10.194.205.35 with SMTP id ld3mr17037434wjc.82.1396593785922; Thu, 03 Apr 2014 23:43:05 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id gc19sm2729537wic.5.2014.04.03.23.43.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Apr 2014 23:43:05 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, fweisbec@gmail.com, linaro-networking@linaro.org, Arvind.Chauhan@arm.com, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 34/36] hrtimer: make enqueue_hrtimer() return void Date: Fri, 4 Apr 2014 12:06:17 +0530 Message-Id: <2ea42c62aa005f9d3aa593e10ff8bd51dafbe989.1396592516.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.220.175 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: , enqueue_hrtimer() routine is called from three places and only one of them effectively uses its return value. Also, by its name enqueue_hrtimer() isn't supposed to return "if the queued timer is the leftmost". So it makes more sense to separate this routine into two parts, first one enqueues a timer and the other one tells if the timer is leftmost or not. Signed-off-by: Viresh Kumar --- include/linux/hrtimer.h | 5 +++++ kernel/hrtimer.c | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index d1836cb..435ac4c 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -263,6 +263,11 @@ static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) return ktime_sub(timer->node.expires, timer->base->get_time()); } +static inline int hrtimer_is_leftmost(struct hrtimer *timer) +{ + return &timer->node == timer->base->active.next; +} + #ifdef CONFIG_HIGH_RES_TIMERS struct clock_event_device; diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index ea620e5..d62fe32 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -856,7 +856,7 @@ EXPORT_SYMBOL_GPL(hrtimer_forward); * * Returns 1 when the new timer is the leftmost timer in the tree. */ -static int enqueue_hrtimer(struct hrtimer *timer) +static void enqueue_hrtimer(struct hrtimer *timer) { struct hrtimer_clock_base *base = timer->base; @@ -870,8 +870,6 @@ static int enqueue_hrtimer(struct hrtimer *timer) * state of a possibly running callback. */ timer->state |= HRTIMER_STATE_ENQUEUED; - - return (&timer->node == base->active.next); } /* @@ -943,7 +941,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, { struct hrtimer_clock_base *base; unsigned long flags; - int ret, leftmost; + int ret; lock_hrtimer_base(timer, &flags); base = timer->base; @@ -972,7 +970,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, timer_stats_hrtimer_set_start_info(timer); - leftmost = enqueue_hrtimer(timer); + enqueue_hrtimer(timer); /* * Only allow reprogramming if the new base is on this CPU. @@ -980,7 +978,7 @@ int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, * * XXX send_remote_softirq() ? */ - if (leftmost && base_on_this_cpu(timer->base) + if (hrtimer_is_leftmost(timer) && base_on_this_cpu(timer->base) && hrtimer_enqueue_reprogram(timer)) { if (wakeup) { /*