From patchwork Mon Mar 25 20:08:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 15632 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9B49E23E66 for ; Mon, 25 Mar 2013 20:08:36 +0000 (UTC) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id 57A5DA1954C for ; Mon, 25 Mar 2013 20:08:36 +0000 (UTC) Received: by mail-vc0-f180.google.com with SMTP id m17so5047072vca.11 for ; Mon, 25 Mar 2013 13:08:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=CIkw6Yr1R2Jjf7/NKRX+mlvNYQE/iQKHFkAzEheKzl8=; b=jw4LoAeIwEx5v2m/wMBQe+38TWVMNct7t0tQp8cQzr+LJOJyT1C4D8WfLZhkP3mjIz ADqthI3UAhs6sgAuitaOjlmrnrccdJgFfSPGsRmvHVLdtpa647S2JwNf7BctBVlcixJp 5HYJxt4wKjfALHQkll3Mb4naAWnPrUdgPPE7pr7DOMxqArQgChUrqrN3r5NcUQoKG2OO ZsAgjrHuBQ33Hr6Q0HTZw4lq77/8QzoKtYxIkJ2YEzcqKGkSg4yDwc6vtKsTcIAlFLHy 3DeOG1wMtbIvFjVkBtxQVCsx5zGZCvwSI7Jk1XbFYqAX7FKp1U5Uy4PBIWChHMJowY3X r0BA== X-Received: by 10.52.93.20 with SMTP id cq20mr14850434vdb.38.1364242115883; Mon, 25 Mar 2013 13:08:35 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.59.4.204 with SMTP id cg12csp41762ved; Mon, 25 Mar 2013 13:08:35 -0700 (PDT) X-Received: by 10.66.246.168 with SMTP id xx8mr19836343pac.107.1364242115052; Mon, 25 Mar 2013 13:08:35 -0700 (PDT) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id ed2si14583012pbb.155.2013.03.25.13.08.34 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Mar 2013 13:08:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.175; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: by mail-pd0-f175.google.com with SMTP id t10so439903pdi.34 for ; Mon, 25 Mar 2013 13:08:34 -0700 (PDT) X-Received: by 10.68.189.99 with SMTP id gh3mr19329490pbc.203.1364242114636; Mon, 25 Mar 2013 13:08:34 -0700 (PDT) Received: from localhost.localdomain (c-24-21-54-107.hsd1.or.comcast.net. [24.21.54.107]) by mx.google.com with ESMTPS id gn2sm14529074pbb.22.2013.03.25.13.08.33 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Mar 2013 13:08:33 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Thomas Gleixner , Richard Cochran , Prarit Bhargava Subject: [PATCH 7/8] timekeeping: Simplify tai updating from do_adjtimex Date: Mon, 25 Mar 2013 13:08:17 -0700 Message-Id: <1364242098-5977-8-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364242098-5977-1-git-send-email-john.stultz@linaro.org> References: <1364242098-5977-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQmFOH05kzKxrFw9FiHC5as5Y9bhnuqAZt1nPFRY+fI2b6jAf/HVc3ukC2L/BNnZTgpZjMtM Since we are taking the timekeeping locks, just go ahead and update any tai change directly, rather then dropping the lock and calling a function that will just take it again. Cc: Thomas Gleixner Cc: Richard Cochran Cc: Prarit Bhargava Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index d10bd73..f93f60c 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1618,9 +1618,10 @@ EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset); */ int do_adjtimex(struct timex *txc) { + struct timekeeper *tk = &timekeeper; unsigned long flags; struct timespec ts; - s32 tai, orig_tai; + s32 tai; int ret; /* Validate the data before disabling interrupts */ @@ -1640,19 +1641,17 @@ int do_adjtimex(struct timex *txc) } getnstimeofday(&ts); - orig_tai = tai = timekeeping_get_tai_offset(); raw_spin_lock_irqsave(&timekeeper_lock, flags); write_seqcount_begin(&timekeeper_seq); + tai = tk->tai_offset; ret = __do_adjtimex(txc, &ts, &tai); + __timekeeping_set_tai_offset(tk, tai); write_seqcount_end(&timekeeper_seq); raw_spin_unlock_irqrestore(&timekeeper_lock, flags); - if (tai != orig_tai) - timekeeping_set_tai_offset(tai); - return ret; }