From patchwork Tue Mar 25 08:26:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 26995 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 78CDE20062 for ; Tue, 25 Mar 2014 08:35:05 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id gq1sf535453obb.11 for ; Tue, 25 Mar 2014 01:35:05 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=eIJ5Qf58Su2F6gDibJ1VCO0P012Hx0nMvtfGDIzlmhU=; b=HmXMhIszlKZ+P0p2/aOV45gjeNqQd0eC6KBRFYChPvkm8gbjYJw5GztKal2tm6IVW5 u4sWKDmoIzvyHFL99Zx+o/vuM0xzdb+HPEfutbDQr/D7Tx5TaPGK166lw/OjlMYtXhju 0QPcZPX/+jQ6nhc7OZwr19MuG55mWqJBfLx5qfeh4vdNGnykJ7O6PHsbCZG6YULSh2Hq 0Dmfi0Clty8I/fIdNuBUv61DVWQPk2m4ZMNteB9O3rqcklc8qBgpbZCt05X7iUOfJzqb mc8s2wfHNli54h2XGiKazn2MGkHZAkyEJT+S7gvh0hH/O9Fa83tDLsfRJZOxqTN3tBf/ /6GQ== X-Gm-Message-State: ALoCoQmhQyTSIuRBW9aEF7mQRaYUfRc9ysZIYhvlJ+8EeKaZ2S7WxM0VfEi1cnm9iNA+GyUYEyEZ X-Received: by 10.43.18.133 with SMTP id qg5mr24518187icb.13.1395736505010; Tue, 25 Mar 2014 01:35:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.81 with SMTP id 75ls124590qgg.75.gmail; Tue, 25 Mar 2014 01:35:04 -0700 (PDT) X-Received: by 10.221.61.210 with SMTP id wx18mr249849vcb.27.1395736504871; Tue, 25 Mar 2014 01:35:04 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id u5si3675986vdo.94.2014.03.25.01.35.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:35:04 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 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.179; Received: by mail-ve0-f179.google.com with SMTP id db12so137849veb.38 for ; Tue, 25 Mar 2014 01:35:04 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr54858885vcb.0.1395736504789; Tue, 25 Mar 2014 01:35:04 -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.78.9 with SMTP id i9csp286063vck; Tue, 25 Mar 2014 01:35:04 -0700 (PDT) X-Received: by 10.66.144.200 with SMTP id so8mr78195935pab.15.1395736502543; Tue, 25 Mar 2014 01:35:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ha5si10915735pbc.172.2014.03.25.01.34.59; Tue, 25 Mar 2014 01:34: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 S1754082AbaCYIeb (ORCPT + 26 others); Tue, 25 Mar 2014 04:34:31 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:33389 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753790AbaCYI10 (ORCPT ); Tue, 25 Mar 2014 04:27:26 -0400 Received: by mail-wg0-f45.google.com with SMTP id l18so82635wgh.4 for ; Tue, 25 Mar 2014 01:27:25 -0700 (PDT) X-Received: by 10.180.211.208 with SMTP id ne16mr21449660wic.21.1395736045741; Tue, 25 Mar 2014 01:27:25 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id b2sm5624937wiz.15.2014.03.25.01.27.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:27:24 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Viresh Kumar Subject: [PATCH] tick: Remove code duplication in tick_handle_periodic() Date: Tue, 25 Mar 2014 13:56:23 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e 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.179 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: , tick_handle_periodic() is calling ktime_add() at two places, first before the infinite loop and then at the end of infinite loop. We can rearrange code a bit to fix code duplication here. It looks quite simple and shouldn't break anything, I guess :) Signed-off-by: Viresh Kumar --- kernel/time/tick-common.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 20b2fe3..d610ae3 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -98,18 +98,19 @@ static void tick_periodic(int cpu) void tick_handle_periodic(struct clock_event_device *dev) { int cpu = smp_processor_id(); - ktime_t next; + ktime_t next = dev->next_event; tick_periodic(cpu); if (dev->mode != CLOCK_EVT_MODE_ONESHOT) return; - /* - * Setup the next period for devices, which do not have - * periodic mode: - */ - next = ktime_add(dev->next_event, tick_period); for (;;) { + /* + * Setup the next period for devices, which do not have + * periodic mode: + */ + next = ktime_add(next, tick_period); + if (!clockevents_program_event(dev, next, false)) return; /* @@ -123,7 +124,6 @@ void tick_handle_periodic(struct clock_event_device *dev) */ if (timekeeping_valid_for_hres()) tick_periodic(cpu); - next = ktime_add(next, tick_period); } }