From patchwork Thu Oct 3 15:56:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20798 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 04FAF25CAB for ; Thu, 3 Oct 2013 15:58:04 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id l13sf4975017qcy.5 for ; Thu, 03 Oct 2013 08:58:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=ieAOrBWKI8f+VSpf1tPNzRRh/68QU/UWecbXNY0XNc8=; b=GXeB2NW2C29fhbEQGGsOHk7TeIqXDMK2LSiVnXSQWt3LznmGqvFwKB6NsHnrdWluwu TrrJ9v+n/Vk1EU8+T4cZdRgwTBmfdxMpW5HY7yiTwRXJbiO+SnMkdt7IJT5K3jwVHJCb DEh/ZrkGgg32PSR1BYqJzTDBiZnRJquqd92PBraRRpG83uTjwnbmPrnIWieoSk2AWcIr Eo5j3ZGbafisDV3ulttxEGQ4iVGnyt/M+4MWuaZfqyhLsSPMps0XZ4DwkggPEJq05OQG dOcU2nACX737U5iFnyXF+aTPfb2+X6rpoe8jLlMZxxOKiSbgUQ22+vYHw1jyc2vTp1h9 W8xQ== X-Received: by 10.236.26.202 with SMTP id c50mr7588218yha.14.1380815883859; Thu, 03 Oct 2013 08:58:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.68 with SMTP id da4ls1053802qeb.24.gmail; Thu, 03 Oct 2013 08:58:03 -0700 (PDT) X-Received: by 10.58.168.205 with SMTP id zy13mr8045928veb.19.1380815883714; Thu, 03 Oct 2013 08:58:03 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id dt10si1880002vdb.73.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 08:58:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 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.173; Received: by mail-vc0-f173.google.com with SMTP id if17so1138499vcb.32 for ; Thu, 03 Oct 2013 08:58:03 -0700 (PDT) X-Gm-Message-State: ALoCoQk1zs9gZXRyOj255j8s2kBMBM/18hBVsnA0Uj7NeJkQud25GBO9/usagwEw6PbTNzqS6fyv X-Received: by 10.52.227.6 with SMTP id rw6mr6734086vdc.19.1380815883614; Thu, 03 Oct 2013 08:58:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp189213vcz; Thu, 3 Oct 2013 08:58:03 -0700 (PDT) X-Received: by 10.68.179.161 with SMTP id dh1mr1310884pbc.160.1380815882613; Thu, 03 Oct 2013 08:58:02 -0700 (PDT) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id fl1si6829736pab.170.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 08:58:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id fa1so2818194pad.33 for ; Thu, 03 Oct 2013 08:58:02 -0700 (PDT) X-Received: by 10.68.101.3 with SMTP id fc3mr1303114pbb.107.1380815882191; Thu, 03 Oct 2013 08:58:02 -0700 (PDT) Received: from localhost ([122.167.152.64]) by mx.google.com with ESMTPSA id 7sm11543111paf.22.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Oct 2013 08:58:01 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl, daniel.lezcano@linaro.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 09/16] cpuidle: reduce code duplication inside cpuidle_idle_call() Date: Thu, 3 Oct 2013 21:26:48 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: 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.173 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We are doing this twice in cpuidle_idle_call() routine: drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP Would be better if we actually store this in a local variable and use that. That would remove code duplication as well as make this piece of code run fast (in case compiler wasn't able to optimize it earlier) Acked-by: Daniel Lezcano Signed-off-by: Viresh Kumar --- drivers/cpuidle/cpuidle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 518b542..ffc637a 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -118,6 +118,7 @@ int cpuidle_idle_call(void) struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); struct cpuidle_driver *drv; int next_state, entered_state; + bool broadcast; if (off || !initialized) return -ENODEV; @@ -141,7 +142,9 @@ int cpuidle_idle_call(void) trace_cpu_idle_rcuidle(next_state, dev->cpu); - if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) + broadcast = drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP; + + if (broadcast) clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); @@ -151,7 +154,7 @@ int cpuidle_idle_call(void) else entered_state = cpuidle_enter_state(dev, drv, next_state); - if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) + if (broadcast) clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);