From patchwork Fri Jun 12 07:48:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 49794 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 453DE228DB for ; Fri, 12 Jun 2015 07:50:46 +0000 (UTC) Received: by labsp1 with SMTP id sp1sf8432345lab.3 for ; Fri, 12 Jun 2015 00:50:45 -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=MlOITr+aDte12ml3Pf/STEkNBx6OeGdgNUDWAVlAtEQ=; b=DLb5RzZGFl1QxcV2QBdAFeVBcNdbJAoVnTH9ggoraJzHwgIwYSPCsHBQvu7pDiboxM GtQwZZvUn35+Ty235dB7ovzR6ut26IYwaRRMFhXtuxrIxklzn1VEXDEjh2fbf/nrmbuU 6gm7sViUEysIrssfiUIotoPDprBQVKeu4Q+9s3gQafgs2COEdPCv+Am9wMwntWhCA8MI wELIObi7vfiSuj1xoIo69u64XH35HFFl6vmfqF659FC9gtnUDWO+0so8kbdVSkwFePno a/cu/Pa+iWvGtfNqeiLRaJMwDa2PC7bXwZ8HhpJkE35kWW6ojiu5r6+n5P4e3YUNsW+L yw0Q== X-Gm-Message-State: ALoCoQmHLe+29fWeFd6ZNAJj7AIfkkTmplrX6IvY5rZx2AK7ni32F3v5NdVO5boJNz5orGzb/E8p X-Received: by 10.152.3.131 with SMTP id c3mr13018524lac.4.1434095445252; Fri, 12 Jun 2015 00:50:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.168 with SMTP id w8ls546265lae.41.gmail; Fri, 12 Jun 2015 00:50:45 -0700 (PDT) X-Received: by 10.112.72.132 with SMTP id d4mr13802791lbv.1.1434095445068; Fri, 12 Jun 2015 00:50:45 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id ex6si2729250lac.82.2015.06.12.00.50.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 00:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbcue7 with SMTP id ue7so15428191lbc.0 for ; Fri, 12 Jun 2015 00:50:45 -0700 (PDT) X-Received: by 10.112.234.200 with SMTP id ug8mr13649143lbc.117.1434095444977; Fri, 12 Jun 2015 00:50:44 -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.112.108.230 with SMTP id hn6csp356213lbb; Fri, 12 Jun 2015 00:50:44 -0700 (PDT) X-Received: by 10.67.4.201 with SMTP id cg9mr21275603pad.53.1434095443285; Fri, 12 Jun 2015 00:50:43 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mm8si4290950pbc.26.2015.06.12.00.50.41; Fri, 12 Jun 2015 00:50:43 -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 S1754674AbbFLHuf (ORCPT + 29 others); Fri, 12 Jun 2015 03:50:35 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35928 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754584AbbFLHu3 (ORCPT ); Fri, 12 Jun 2015 03:50:29 -0400 Received: by pabqy3 with SMTP id qy3so18127605pab.3 for ; Fri, 12 Jun 2015 00:50:28 -0700 (PDT) X-Received: by 10.68.133.131 with SMTP id pc3mr20995796pbb.107.1434095428855; Fri, 12 Jun 2015 00:50:28 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id yv6sm2734372pac.29.2015.06.12.00.50.26 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 00:50:28 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v5 12/24] posix-timers: Factor out the guts of 'clock_gettime' for reusing Date: Fri, 12 Jun 2015 15:48:27 +0800 Message-Id: <46722fb0d735b973caa3a4d52ce25b2448e144d2.1434079263.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <647dcc7ede88d9d95a6f9a2878487d46c233fb2a.1434079262.git.baolin.wang@linaro.org> References: <647dcc7ede88d9d95a6f9a2878487d46c233fb2a.1434079262.git.baolin.wang@linaro.org> 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: baolin.wang@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) 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: , In order to reuse the very same logic for the year 2038 safe syscalls which we need to introduce for 32bit system, factor out the guts of the 'clock_gettime' syscall. Signed-off-by: Baolin Wang --- kernel/time/posix-timers.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index dcc632c..ca63626 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -1124,17 +1124,23 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, return __clock_settime(which_clock, &new_tp); } -SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, - struct timespec __user *,tp) +static int __clock_gettime(clockid_t which_clock, struct timespec *ts) { struct k_clock *kc = clockid_to_kclock(which_clock); - struct timespec kernel_tp; - int error; if (!kc) return -EINVAL; - error = kc->clock_get(which_clock, &kernel_tp); + return kc->clock_get(which_clock, ts); +} + +SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, + struct timespec __user *,tp) +{ + struct timespec kernel_tp; + int error; + + error = __clock_gettime(which_clock, &kernel_tp); if (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp))) error = -EFAULT;