From patchwork Fri Apr 4 06:36:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27750 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4373F2036E for ; Fri, 4 Apr 2014 06:42:41 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id b6sf8501590yha.0 for ; Thu, 03 Apr 2014 23:42: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=PMY4TuKHbmr3AQaS+W6b0zG2atNS5yvTiTuNPCebt2o=; b=NpCmpYPwMI0r7Iaus2w2touPXWuEmGG7bGM5dMQTTXHzSU4tFnUGcts36YB51Aujr8 aS0zPazWuE7nR5/bB+9JWKNJAS6jkvAmPq/g1HBCDwjO5jAKKtcKLQ0dEnTXh4m+jgl0 jBXScRSCItOIGaBlgaU6yda6RZP86j/7ADRKYTR+203RzJpzJJ7aGbrEiJwd2wU92Xwa i+s6lcoyJQr3PiVTYsuEpxrBb/y4O4XyfeMXy+uvq1dqZ+P0qOHI2+pl4bHvCRcEFRYy SJzxUmlXnaiRuh0PBQSL441AFt0Afk9cUAWPWh4dEWq2xjTjNUQYEOAv42sCCpZxygJm L+yA== X-Gm-Message-State: ALoCoQnOhMppiq+ANTQ4emaCFTaivcApW1bllMG9OQZHCDbBWBYY0gQitCad47cpvp7ASgjFC+R/ X-Received: by 10.236.45.41 with SMTP id o29mr6129131yhb.13.1396593761037; Thu, 03 Apr 2014 23:42:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.100 with SMTP id u91ls880055qgu.74.gmail; Thu, 03 Apr 2014 23:42:40 -0700 (PDT) X-Received: by 10.58.187.78 with SMTP id fq14mr3527631vec.9.1396593760971; Thu, 03 Apr 2014 23:42:40 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id j5si623472veb.183.2014.04.03.23.42.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Apr 2014 23:42:40 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so1096550veb.26 for ; Thu, 03 Apr 2014 23:42:40 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr3583674vec.15.1396593760911; Thu, 03 Apr 2014 23:42:40 -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 v8csp89292vcv; Thu, 3 Apr 2014 23:42:40 -0700 (PDT) X-Received: by 10.67.13.226 with SMTP id fb2mr12885472pad.146.1396593756376; Thu, 03 Apr 2014 23:42:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xt7si4198997pab.20.2014.04.03.23.42.35; Thu, 03 Apr 2014 23:42: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 S1752773AbaDDGmN (ORCPT + 27 others); Fri, 4 Apr 2014 02:42:13 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:36551 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752732AbaDDGmE (ORCPT ); Fri, 4 Apr 2014 02:42:04 -0400 Received: by mail-wi0-f178.google.com with SMTP id bs8so588997wib.17 for ; Thu, 03 Apr 2014 23:42:02 -0700 (PDT) X-Received: by 10.194.24.74 with SMTP id s10mr16803539wjf.43.1396593722566; Thu, 03 Apr 2014 23:42:02 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id ee5sm2720153wib.8.2014.04.03.23.41.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Apr 2014 23:42:01 -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 23/36] hrtimer: create for_each_active_base() Date: Fri, 4 Apr 2014 12:06:06 +0530 Message-Id: <170b73764b62e2af7cfcdd2fdea1dd203ab5173a.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.128.181 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: , There are many places where we need to iterate over all the currently active clock bases for a particular cpu_base. Create for_each_active_base() to simplify code at those places. Signed-off-by: Viresh Kumar --- kernel/hrtimer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 379d21a..ceadfa5 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -113,6 +113,19 @@ static inline bool base_on_this_cpu(struct hrtimer_clock_base *base) } /* + * for_each_active_base: iterate over all active clock bases + * @_index: 'int' variable for internal purpose + * @_base: holds pointer to a active clock base + * @_cpu_base: cpu base to iterate on + * @_active_bases: 'unsigned int' variable for internal purpose + */ +#define for_each_active_base(_index, _base, _cpu_base, _active_bases) \ + for ((_active_bases) = (_cpu_base)->active_bases; \ + (_index) = ffs(_active_bases), \ + (_base) = (_cpu_base)->clock_base + (_index) - 1, (_index); \ + (_active_bases) &= ~(1 << ((_index) - 1))) + +/* * Get the coarse grained time at the softirq based on xtime and * wall_to_monotonic. */