From patchwork Mon Apr 21 09:55:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28674 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B72F82032B for ; Mon, 21 Apr 2014 09:57:01 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id wp4sf26238603obc.8 for ; Mon, 21 Apr 2014 02:57:01 -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=vqUqEHjSj99QHGZN1uK8f80eBqxPp+NAtZdnBHt/yu0=; b=TEOq9ECcoqMK3AGUJGPZx3I+7DNtbgCa4xY/D8flZP29TpcHg/Ab1uVHwDIIZXK1Xd 9UBcTfsUa5vsVKDA/dPAKJdBZqrB/alV4/skpK+EPOxKXbFK+3GX08XTpkWOrk/M2Ajs myCPwD3x8Je1k9kyDdg9bYD5KkSNGNBGCdIh18oqltsMXwOngHJ5Q6RfXKpP8zaP91Xu AMmCw9wuEUFTm6SQ0X5J5wtK4jLC1OnVG3Qf4qiH03IopeftL8bMRVAvmH5U2n7HP/QF uR7zsohsEJRGHg2xTVELj0Mfe1EgwNSpnZ8e+knGGuZwh2GUw2z4ktOUk9PEH2eY0Gna 2RTw== X-Gm-Message-State: ALoCoQmXrnhX1xnwZu7DK9Me9+UXRgdri4JgCY1WeeAeRvLItnIRWj88svPjzULWPJCG3S+8SY7E X-Received: by 10.50.39.80 with SMTP id n16mr422717igk.2.1398074221281; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.170 with SMTP id p39ls2388013qgd.49.gmail; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) X-Received: by 10.52.15.132 with SMTP id x4mr398855vdc.31.1398074221162; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id iz10si6182444vec.6.2014.04.21.02.57.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 02:57:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.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.128.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so7437670veb.6 for ; Mon, 21 Apr 2014 02:57:01 -0700 (PDT) X-Received: by 10.58.171.229 with SMTP id ax5mr1328589vec.24.1398074221084; Mon, 21 Apr 2014 02:57:01 -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 ib8csp280268vcb; Mon, 21 Apr 2014 02:57:00 -0700 (PDT) X-Received: by 10.68.135.42 with SMTP id pp10mr37247234pbb.58.1398074220304; Mon, 21 Apr 2014 02:57:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id eg2si20547193pac.387.2014.04.21.02.56.59; Mon, 21 Apr 2014 02:56:59 -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 S1751887AbaDUJ4Z (ORCPT + 26 others); Mon, 21 Apr 2014 05:56:25 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:60952 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824AbaDUJzy (ORCPT ); Mon, 21 Apr 2014 05:55:54 -0400 Received: by mail-wi0-f179.google.com with SMTP id z2so1621904wiv.12 for ; Mon, 21 Apr 2014 02:55:52 -0700 (PDT) X-Received: by 10.180.94.37 with SMTP id cz5mr13408114wib.19.1398074152774; Mon, 21 Apr 2014 02:55:52 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id b2sm15225997wiz.15.2014.04.21.02.55.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 21 Apr 2014 02:55:52 -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 05/19] tick: move definition of tick_get_device() to tick.h Date: Mon, 21 Apr 2014 15:25:01 +0530 Message-Id: <2565ee70b249641746606702238580bd40b4e595.1398072824.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.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: , There are multiple users of tick_get_device() which are currently using &per_cpu(tick_cpu_device, cpu) directly. Would be better if we use tick_get_device() consistently. Move definition of tick_get_device() to tick.h and update others to use it. 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 2ba812bc..a3e9333 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 b1c7b21..6289680 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 0a0608e..3f3aa86 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;