From patchwork Mon Apr 14 16:23:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28334 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CE41F20534 for ; Mon, 14 Apr 2014 16:25:13 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id up15sf32259390pbc.2 for ; Mon, 14 Apr 2014 09:25:12 -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=Xd/ffmP5552RpW0zYVDYNbnd04YRYEA5bRWCu7m0jeA=; b=GNxb1vx2M4GDGRmgdoWjYOfObMzEFznhpctb2UmF1IzbFo1Y9qdHBhShM69LqtrNUM n472db7qVHn4LEFjBslGSIOdGhgLhzeNIGcLWSXwk4+91HJqS0BtMAguYEr2iSKzKAzQ mhb/Efio7NCwZLSPy3rPpeqzf0XYRJj8PAZtsXbfDdhjc8vUNxwA3f0LSaXkSKJUXEly 8BSZXJiQjXFaSc2NhwpKDqXrW33wqFzCBX/VBefEOLg0lRr5W9Q7/1aUyT4wMv/n4fL0 +waNrxoIk57JFG84+8NvPWwgJ5EMTnE+M/tdOMS6kcoGdV2V/At5irmSKEHpxk2CjSAu IvEQ== X-Gm-Message-State: ALoCoQljD51dV+qyGww+eNL5Z3BhnHxOtAjDyvVcCiGdbgGsQrcW4T/0klwEqniV2/PV6kLJ6UWR X-Received: by 10.66.188.238 with SMTP id gd14mr5009379pac.18.1397492712955; Mon, 14 Apr 2014 09:25:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.198 with SMTP id o64ls2712305qga.66.gmail; Mon, 14 Apr 2014 09:25:12 -0700 (PDT) X-Received: by 10.52.69.146 with SMTP id e18mr31123484vdu.15.1397492712785; Mon, 14 Apr 2014 09:25:12 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id z6si2829408vcm.117.2014.04.14.09.25.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:25:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 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.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so7605302veb.39 for ; Mon, 14 Apr 2014 09:25:12 -0700 (PDT) X-Received: by 10.220.7.131 with SMTP id d3mr243860vcd.45.1397492712698; Mon, 14 Apr 2014 09:25:12 -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 ib8csp162723vcb; Mon, 14 Apr 2014 09:25:12 -0700 (PDT) X-Received: by 10.68.194.134 with SMTP id hw6mr45009160pbc.49.1397492711622; Mon, 14 Apr 2014 09:25:11 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si9150226paw.45.2014.04.14.09.25.10; Mon, 14 Apr 2014 09:25:10 -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 S1755340AbaDNQYq (ORCPT + 26 others); Mon, 14 Apr 2014 12:24:46 -0400 Received: from mail-pb0-f49.google.com ([209.85.160.49]:44368 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754839AbaDNQYl (ORCPT ); Mon, 14 Apr 2014 12:24:41 -0400 Received: by mail-pb0-f49.google.com with SMTP id jt11so8328529pbb.8 for ; Mon, 14 Apr 2014 09:24:41 -0700 (PDT) X-Received: by 10.66.232.68 with SMTP id tm4mr4561175pac.114.1397492681362; Mon, 14 Apr 2014 09:24:41 -0700 (PDT) Received: from localhost ([122.167.126.16]) by mx.google.com with ESMTPSA id vx10sm82466920pac.17.2014.04.14.09.24.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:24:40 -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 05/38] tick: move definition of tick_get_device() to tick.h Date: Mon, 14 Apr 2014 21:53:27 +0530 Message-Id: <68b5b4ea3a08ace919b8dbb16317d0b26de3679c.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.180 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 multiple users of tick_get_device() which are currently using &per_cpu(tick_cpu_device, cpu) directly. Would be better to move definition of tick_get_device() to tick.h and move others to use this routine instead. This change reduced size of bzImage for x86 by 96 bytes. Signed-off-by: Viresh Kumar --- include/linux/tick.h | 5 ++++- kernel/time/clockevents.c | 6 +++--- kernel/time/tick-broadcast.c | 12 ++++++------ kernel/time/tick-common.c | 9 ++------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 1a9908a..45e1331 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -87,7 +87,10 @@ extern void __init tick_init(void); extern int tick_is_oneshot_available(void); DECLARE_PER_CPU(struct tick_device, tick_cpu_device); -extern struct tick_device *tick_get_device(int cpu); +static inline struct tick_device *tick_get_device(int cpu) +{ + return &per_cpu(tick_cpu_device, cpu); +} # ifdef CONFIG_HIGH_RES_TIMERS extern int tick_init_highres(void); diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index ad362c2..6680a0d 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -326,7 +326,7 @@ static int __clockevents_try_unbind(struct clock_event_device *ced, int cpu) return 0; } - return ced == per_cpu(tick_cpu_device, cpu).evtdev ? -EAGAIN : -EBUSY; + return ced == tick_get_device(cpu)->evtdev ? -EAGAIN : -EBUSY; } /* @@ -675,7 +675,7 @@ static struct device tick_bc_dev = { static struct tick_device *tick_get_tick_dev(struct device *dev) { return dev == &tick_bc_dev ? tick_get_broadcast_device() : - &per_cpu(tick_cpu_device, dev->id); + tick_get_device(dev->id); } static __init int tick_broadcast_init_sysfs(void) @@ -689,7 +689,7 @@ static __init int tick_broadcast_init_sysfs(void) #else static struct tick_device *tick_get_tick_dev(struct device *dev) { - return &per_cpu(tick_cpu_device, dev->id); + return tick_get_device(dev->id); } static inline int tick_broadcast_init_sysfs(void) { return 0; } #endif diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index c4c50ba..eb0479a 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -262,7 +262,7 @@ static void tick_do_broadcast(struct cpumask *mask) */ if (cpumask_test_cpu(cpu, mask)) { cpumask_clear_cpu(cpu, mask); - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); td->evtdev->event_handler(td->evtdev); } @@ -273,7 +273,7 @@ static void tick_do_broadcast(struct cpumask *mask) * one of the first device. This works as long as we have this * misfeature only on x86 (lapic) */ - td = &per_cpu(tick_cpu_device, cpumask_first(mask)); + td = tick_get_device(cpumask_first(mask)); td->evtdev->broadcast(mask); } } @@ -337,7 +337,7 @@ static void tick_do_broadcast_on_off(unsigned long *reason) raw_spin_lock_irqsave(&tick_broadcast_lock, flags); cpu = smp_processor_id(); - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); dev = td->evtdev; bc = tick_broadcast_device.evtdev; @@ -581,7 +581,7 @@ again: now = ktime_get(); /* Find all expired events */ for_each_cpu(cpu, tick_broadcast_oneshot_mask) { - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); if (td->evtdev->next_event.tv64 <= now.tv64) { cpumask_set_cpu(cpu, tmpmask); /* @@ -700,7 +700,7 @@ int tick_broadcast_oneshot_control(unsigned long reason) * idle code, so we can't be moved away. */ cpu = smp_processor_id(); - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); dev = td->evtdev; if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) @@ -824,7 +824,7 @@ static void tick_broadcast_init_next_event(struct cpumask *mask, int cpu; for_each_cpu(cpu, mask) { - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); if (td->evtdev) td->evtdev->next_event = expires; } diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 0156612..c7859b7 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -53,11 +53,6 @@ int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; /* * Debugging: see timer_list.c */ -struct tick_device *tick_get_device(int cpu) -{ - return &per_cpu(tick_cpu_device, cpu); -} - /** * tick_is_oneshot_available - check for a oneshot capable event device */ @@ -296,7 +291,7 @@ void tick_check_new_device(struct clock_event_device *newdev) if (!cpumask_test_cpu(cpu, newdev->cpumask)) goto out_bc; - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); curdev = td->evtdev; /* cpu local device ? */ @@ -356,7 +351,7 @@ void tick_handover_do_timer(int *cpup) */ void tick_shutdown(unsigned int *cpup) { - struct tick_device *td = &per_cpu(tick_cpu_device, *cpup); + struct tick_device *td = tick_get_device(*cpup); struct clock_event_device *dev = td->evtdev; td->mode = TICKDEV_MODE_PERIODIC;