From patchwork Fri Jun 12 07:48:21 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: 49790 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B6F4F228DB for ; Fri, 12 Jun 2015 07:50:07 +0000 (UTC) Received: by lagh7 with SMTP id h7sf8420239lag.2 for ; Fri, 12 Jun 2015 00:50:06 -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=c2igJfymJVF9qlstyD9Qv4OktJOriXiRcLXOueglxqE=; b=PYKAs/IQJOoMnOuCLLRCh1o5CSPl+G6wpprhDky2p9X4VkMjUoZciqd1xvwt/SoG1u C3VkdsviaPH0WnaMU0JDiwk/sWsA5rRQCIVDUycjG3ad8qhse1BRWStmLDKfsyizj/LT bxwEWPOXKvwMmbx6g9jqM9qKblW0K4+no8VD2Qzh6/UOAMYJ7g2KtdUiKFvHwPhm3tsD lFU+/7XJHv1h2gPlzUMfBJcLvwplwwuKZrVIMlcsTETB9/MQMG7JfkhgZ/xSX3fKJVbE 2yDNtzJ6+hJMv9lpHGZrE7omp6KQJPvvBcB7FbxQi+ltyK9m7oajX0TKTmdYxck574sn y2Bg== X-Gm-Message-State: ALoCoQnc4HuLyApHTwNHpxWcZZRm7cl0J69ZXEL+zREKE9Xpioj9kywIAV4FPMeNG5OjJhQDHFmY X-Received: by 10.112.84.104 with SMTP id x8mr12817865lby.23.1434095406797; Fri, 12 Jun 2015 00:50:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.97 with SMTP id c1ls504391laf.66.gmail; Fri, 12 Jun 2015 00:50:06 -0700 (PDT) X-Received: by 10.153.11.163 with SMTP id ej3mr13730447lad.105.1434095406614; Fri, 12 Jun 2015 00:50:06 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id do6si2723931lac.98.2015.06.12.00.50.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 00:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbqq2 with SMTP id qq2so15343664lbb.3 for ; Fri, 12 Jun 2015 00:50:06 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr13556833lac.41.1434095406335; Fri, 12 Jun 2015 00:50:06 -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 hn6csp355857lbb; Fri, 12 Jun 2015 00:50:04 -0700 (PDT) X-Received: by 10.68.105.195 with SMTP id go3mr21425525pbb.48.1434095403262; Fri, 12 Jun 2015 00:50:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si4228324pap.184.2015.06.12.00.50.01; Fri, 12 Jun 2015 00:50:03 -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 S1753510AbbFLHtw (ORCPT + 29 others); Fri, 12 Jun 2015 03:49:52 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:33925 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331AbbFLHts (ORCPT ); Fri, 12 Jun 2015 03:49:48 -0400 Received: by pdbki1 with SMTP id ki1so19662705pdb.1 for ; Fri, 12 Jun 2015 00:49:48 -0700 (PDT) X-Received: by 10.70.33.67 with SMTP id p3mr21079026pdi.126.1434095388318; Fri, 12 Jun 2015 00:49:48 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id yv6sm2734372pac.29.2015.06.12.00.49.45 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 00:49:47 -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 06/24] posix-timers: Factor out the guts of 'timer_gettime' for reusing Date: Fri, 12 Jun 2015 15:48:21 +0800 Message-Id: <320d585c9cc4bbbda014f0a2bdcd55fe69b347cc.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.169 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 systems, factor out the guts of the 'timer_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 5ddd912..7d1973a 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -802,11 +802,8 @@ common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) cur_setting->it_value = ktime_to_timespec(remaining); } -/* Get the time remaining on a POSIX.1b interval timer. */ -SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, - struct itimerspec __user *, setting) +static int __timer_gettime(timer_t timer_id, struct itimerspec *cur_setting) { - struct itimerspec cur_setting; struct k_itimer *timr; struct k_clock *kc; unsigned long flags; @@ -820,9 +817,18 @@ SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, if (WARN_ON_ONCE(!kc || !kc->timer_get)) ret = -EINVAL; else - kc->timer_get(timr, &cur_setting); + kc->timer_get(timr, cur_setting); unlock_timer(timr, flags); + return ret; +} + +/* Get the time remaining on a POSIX.1b interval timer. */ +SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id, + struct itimerspec __user *, setting) +{ + struct itimerspec cur_setting; + int ret = __timer_gettime(timer_id, &cur_setting); if (!ret && copy_to_user(setting, &cur_setting, sizeof (cur_setting))) return -EFAULT;