From patchwork Mon Apr 21 09:55:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28689 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 231BF2032B for ; Mon, 21 Apr 2014 10:02:23 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf16543090pdb.5 for ; Mon, 21 Apr 2014 03:02:23 -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=TNVGiNjBwMkuHNOLmSC4j9je3jQUV8+dCfhYayG9X5U=; b=Lh2sRl+fZtT+idAwsrPTaaKyTPWTcFXCNbNunoMl1q2CAjsJh2pz8t8fMwD8T0BBd/ 2L0d5B5mnWpyVyRMyzuvxbi6UXdGmUclofjalOHReL99Cu126s8a2C6h9RwKgKvtETQn axIhTcmsmUySBHsXco5GZgEYCvFWPk9dq/bOvAea5268yYiEq1hp2fyYWWLiDg920QnU +ou8ML3I5yqy2pEsxJeGhdbTuLX0QXw/tT6wFJOEJgIO0nyQWKUGWn3gCB/7ahop1eCR eNDLzD9/KdmA0bMWt+p9quQjerP6e7ZyZzvX/7Qt72OAcklUq+K8Bc+gTwereIi8PMum GODg== X-Gm-Message-State: ALoCoQkeaOGrSeQSn3rL58QKQ4kgUdv/YeFIbn55aeu2+5IlK7pKPQgIABDQLi+drLFnfVcozIXs X-Received: by 10.66.102.36 with SMTP id fl4mr18076110pab.20.1398074543374; Mon, 21 Apr 2014 03:02:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.52 with SMTP id j49ls1813516qga.67.gmail; Mon, 21 Apr 2014 03:02:23 -0700 (PDT) X-Received: by 10.52.108.164 with SMTP id hl4mr2120520vdb.25.1398074543224; Mon, 21 Apr 2014 03:02:23 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id kj3si5574552vdb.96.2014.04.21.03.02.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 03:02:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 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.172; Received: by mail-ve0-f172.google.com with SMTP id jx11so7769169veb.3 for ; Mon, 21 Apr 2014 03:02:23 -0700 (PDT) X-Received: by 10.52.144.42 with SMTP id sj10mr24380846vdb.19.1398074543141; Mon, 21 Apr 2014 03:02:23 -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 ib8csp280507vcb; Mon, 21 Apr 2014 03:02:22 -0700 (PDT) X-Received: by 10.66.164.70 with SMTP id yo6mr37080365pab.85.1398074542336; Mon, 21 Apr 2014 03:02:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si6973251pbj.231.2014.04.21.03.02.21; Mon, 21 Apr 2014 03:02:21 -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 S1752584AbaDUKCN (ORCPT + 26 others); Mon, 21 Apr 2014 06:02:13 -0400 Received: from mail-we0-f176.google.com ([74.125.82.176]:42314 "EHLO mail-we0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751603AbaDUJ4G (ORCPT ); Mon, 21 Apr 2014 05:56:06 -0400 Received: by mail-we0-f176.google.com with SMTP id x48so3565642wes.35 for ; Mon, 21 Apr 2014 02:56:04 -0700 (PDT) X-Received: by 10.194.80.7 with SMTP id n7mr28254146wjx.8.1398074164671; Mon, 21 Apr 2014 02:56:04 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id q2sm15227681wix.5.2014.04.21.02.56.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 21 Apr 2014 02:56:03 -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 07/19] tick: initialize variables during their definitions Date: Mon, 21 Apr 2014 15:25:03 +0530 Message-Id: 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.172 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 don't have to assign values to variables in separate lines when we can do that during their initialization. Move assignments of few variables to their definitions. This makes code smaller and more readable. Signed-off-by: Viresh Kumar --- kernel/time/tick-broadcast.c | 20 ++++++-------------- kernel/time/tick-common.c | 10 +++------- kernel/time/tick-sched.c | 6 ++---- 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index bf289cd..7802020 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -329,16 +329,12 @@ unlock: */ static void tick_do_broadcast_on_off(unsigned long *reason) { - struct clock_event_device *bc, *dev; - struct tick_device *td; + struct tick_device *td = tick_get_cpu_device(); + struct clock_event_device *bc, *dev = td->evtdev; + int cpu = smp_processor_id(), bc_stopped; unsigned long flags; - int cpu, bc_stopped; raw_spin_lock_irqsave(&tick_broadcast_lock, flags); - - cpu = smp_processor_id(); - td = tick_get_cpu_device(); - dev = td->evtdev; bc = tick_broadcast_device.evtdev; /* @@ -682,11 +678,11 @@ static void broadcast_move_bc(int deadcpu) */ int tick_broadcast_oneshot_control(unsigned long reason) { - struct clock_event_device *bc, *dev; - struct tick_device *td; + struct tick_device *td = tick_get_cpu_device(); + struct clock_event_device *bc, *dev = td->evtdev; + int cpu = smp_processor_id(), ret = 0; unsigned long flags; ktime_t now; - int cpu, ret = 0; /* * Periodic mode does not care about the enter/exit of power @@ -699,10 +695,6 @@ int tick_broadcast_oneshot_control(unsigned long reason) * We are called with preemtion disabled from the depth of the * idle code, so we can't be moved away. */ - cpu = smp_processor_id(); - td = tick_get_cpu_device(); - dev = td->evtdev; - if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) return 0; diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 1e2c96e..4d45e08 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -283,17 +283,13 @@ bool tick_check_replacement(struct clock_event_device *curdev, */ void tick_check_new_device(struct clock_event_device *newdev) { - struct clock_event_device *curdev; - struct tick_device *td; - int cpu; + struct tick_device *td = tick_get_cpu_device(); + struct clock_event_device *curdev = td->evtdev; + int cpu = smp_processor_id(); - cpu = smp_processor_id(); if (!cpumask_test_cpu(cpu, newdev->cpumask)) goto out_bc; - td = tick_get_cpu_device(); - curdev = td->evtdev; - /* cpu local device ? */ if (!tick_check_percpu(curdev, newdev, cpu)) goto out_bc; diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 5f27c71..71f64ee 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -277,7 +277,7 @@ out: /* Parse the boot-time nohz CPU list from the kernel parameters. */ static int __init tick_nohz_full_setup(char *str) { - int cpu; + int cpu = smp_processor_id(); alloc_bootmem_cpumask_var(&tick_nohz_full_mask); if (cpulist_parse(str, tick_nohz_full_mask) < 0) { @@ -285,7 +285,6 @@ static int __init tick_nohz_full_setup(char *str) return 1; } - cpu = smp_processor_id(); if (cpumask_test_cpu(cpu, tick_nohz_full_mask)) { pr_warning("NO_HZ: Clearing %d from nohz_full range for timekeeping\n", cpu); @@ -790,7 +789,7 @@ static void __tick_nohz_idle_enter(struct tick_sched *ts) */ void tick_nohz_idle_enter(void) { - struct tick_sched *ts; + struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); WARN_ON_ONCE(irqs_disabled()); @@ -804,7 +803,6 @@ void tick_nohz_idle_enter(void) local_irq_disable(); - ts = &__get_cpu_var(tick_cpu_sched); ts->inidle = 1; __tick_nohz_idle_enter(ts);