From patchwork Fri Jun 12 08:12:58 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: 49815 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DEC94211FD for ; Fri, 12 Jun 2015 08:14:43 +0000 (UTC) Received: by wgme6 with SMTP id e6sf7511028wgm.3 for ; Fri, 12 Jun 2015 01:14:43 -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=ovvoewXiPekhl45fKTdtKUDzO0w/oJGoVtRNHajcrVU=; b=F+gZ7Mc41hITWqsUOZNjyCUELrE5cXYnx0oN0FMUk0SCpes9Sr2ZURs+ic68SMdtMa MlZq8dW2bjnBewU2Fud7U7YpUjrMcg8DoWRiRObJViGvlahFsH6RDCQ4FsrFxrH22Z81 NTh3R1wuIYkyF0VYLOlozaotNj6O6fVkAgbWiqk000OCGxhfCRi9ug5E4qKkFk7w/QzI PQkGdK+v6KkxQ1fXFKyLHClukaLImYxbVWOVTVU5ScSilAnKn139Ay5QwPbF66aNstp5 V8K3GFrUDnzJaKdQTbp6LAYCmQ3If+vhRlxW+elh0fhlVR+LmxlWoPcWiohVERaAy8oM DmMA== X-Gm-Message-State: ALoCoQlAs83nFvMgJwhJkRo5X5mY0J7jX0eQHyYxZCfT46QtmSGY8D9g2LfWCE4Xk+/BaFKlVPS/ X-Received: by 10.180.89.231 with SMTP id br7mr2942296wib.0.1434096883066; Fri, 12 Jun 2015 01:14:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.36 with SMTP id g4ls547372lah.33.gmail; Fri, 12 Jun 2015 01:14:42 -0700 (PDT) X-Received: by 10.112.83.135 with SMTP id q7mr14033286lby.13.1434096882875; Fri, 12 Jun 2015 01:14:42 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id mr8si2773837lbb.104.2015.06.12.01.14.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 01:14:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labko7 with SMTP id ko7so17033971lab.2 for ; Fri, 12 Jun 2015 01:14:42 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr14210231lbb.56.1434096882692; Fri, 12 Jun 2015 01:14:42 -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 hn6csp369333lbb; Fri, 12 Jun 2015 01:14:41 -0700 (PDT) X-Received: by 10.70.36.10 with SMTP id m10mr14862497pdj.34.1434096880293; Fri, 12 Jun 2015 01:14:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cy3si4329592pdb.175.2015.06.12.01.14.39; Fri, 12 Jun 2015 01:14:40 -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 S1754526AbbFLIOa (ORCPT + 29 others); Fri, 12 Jun 2015 04:14:30 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34653 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753322AbbFLIOS (ORCPT ); Fri, 12 Jun 2015 04:14:18 -0400 Received: by payr10 with SMTP id r10so18646931pay.1 for ; Fri, 12 Jun 2015 01:14:18 -0700 (PDT) X-Received: by 10.70.41.33 with SMTP id c1mr21331188pdl.114.1434096858104; Fri, 12 Jun 2015 01:14:18 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id ff10sm2822581pab.13.2015.06.12.01.14.15 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 01:14:17 -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 24/24] k_clock: Remove y2038 unsafe callbacks Date: Fri, 12 Jun 2015 16:12:58 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <59b6758dc5d951734263b3439aab4573a0a1a13d.1434079263.git.baolin.wang@linaro.org> References: <59b6758dc5d951734263b3439aab4573a0a1a13d.1434079263.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.215.45 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: , All of the k_clock users have been converted to the y2038 safe methods, this patch removes the older methods with timepsec/itimerspec type, as a result the k_clock structure is ready for the year 2038. Signed-off-by: Baolin Wang --- include/linux/posix-timers.h | 9 ----- kernel/time/posix-timers.c | 90 +++--------------------------------------- 2 files changed, 5 insertions(+), 94 deletions(-) diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 35786c5..7c3dae2 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -97,29 +97,20 @@ struct k_itimer { }; struct k_clock { - int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); int (*clock_getres64) (const clockid_t which_clock, struct timespec64 *tp); - int (*clock_set) (const clockid_t which_clock, - const struct timespec *tp); int (*clock_set64) (const clockid_t which_clock, const struct timespec64 *tp); - int (*clock_get) (const clockid_t which_clock, struct timespec * tp); int (*clock_get64) (const clockid_t which_clock, struct timespec64 *tp); int (*clock_adj) (const clockid_t which_clock, struct timex *tx); int (*timer_create) (struct k_itimer *timer); int (*nsleep) (const clockid_t which_clock, int flags, struct timespec *, struct timespec __user *); long (*nsleep_restart) (struct restart_block *restart_block); - int (*timer_set) (struct k_itimer * timr, int flags, - struct itimerspec * new_setting, - struct itimerspec * old_setting); int (*timer_set64) (struct k_itimer *timr, int flags, struct itimerspec64 *new_setting, struct itimerspec64 *old_setting); int (*timer_del) (struct k_itimer * timr); #define TIMER_RETRY 1 - void (*timer_get) (struct k_itimer * timr, - struct itimerspec * cur_setting); void (*timer_get64) (struct k_itimer *timr, struct itimerspec64 *cur_setting); }; diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 80f630a..e9e6e29 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -140,7 +140,6 @@ static int common_timer_del(struct k_itimer *timer); static enum hrtimer_restart posix_timer_fn(struct hrtimer *data); static struct k_itimer *__lock_timer(timer_t timer_id, unsigned long *flags); -static struct k_clock *clockid_to_kclock(const clockid_t id); #define lock_timer(tid, flags) \ ({ struct k_itimer *__timr; \ @@ -550,73 +549,6 @@ static struct pid *good_sigevent(sigevent_t * event) return task_pid(rtn); } -static void default_timer_get64(struct k_itimer *timr, - struct itimerspec64 *cur_setting64) -{ - struct itimerspec cur_setting; - struct k_clock *kc = clockid_to_kclock(timr->it_clock); - - kc->timer_get(timr, &cur_setting); - *cur_setting64 = itimerspec_to_itimerspec64(&cur_setting); -} - -static int default_timer_set64(struct k_itimer *timr, int flags, - struct itimerspec64 *new_setting64, - struct itimerspec64 *old_setting64) -{ - struct k_clock *kc = clockid_to_kclock(timr->it_clock); - struct itimerspec new_setting, old_setting; - struct itimerspec *rtn = old_setting64 ? &old_setting : NULL; - int ret; - - new_setting = itimerspec64_to_itimerspec(new_setting64); - ret = kc->timer_set(timr, flags, &new_setting, rtn); - if (!ret && old_setting64) - *old_setting64 = itimerspec_to_itimerspec64(&old_setting); - - return ret; -} - -static int default_clock_set64(const clockid_t which_clock, - const struct timespec64 *tp64) -{ - struct k_clock *kc = clockid_to_kclock(which_clock); - struct timespec tp; - int ret; - - tp = timespec64_to_timespec(*tp64); - ret = kc->clock_set(which_clock, &tp); - return ret; -} - -static int default_clock_get64(const clockid_t which_clock, - struct timespec64 *tp64) -{ - struct k_clock *kc = clockid_to_kclock(which_clock); - struct timespec tp; - int ret; - - ret = kc->clock_get(which_clock, &tp); - if (!ret) - *tp64 = timespec_to_timespec64(tp); - - return ret; -} - -static int default_clock_getres64(const clockid_t which_clock, - struct timespec64 *tp64) -{ - struct k_clock *kc = clockid_to_kclock(which_clock); - struct timespec tp; - int ret; - - ret = kc->clock_getres(which_clock, &tp); - if (!ret) - *tp64 = timespec_to_timespec64(tp); - - return 0; -} - void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock) { @@ -626,28 +558,17 @@ void posix_timers_register_clock(const clockid_t clock_id, return; } - if (!new_clock->clock_get && !new_clock->clock_get64) { - printk(KERN_WARNING "POSIX clock id %d lacks clock_get() and clock_get64()\n", + if (!new_clock->clock_get64) { + printk(KERN_WARNING "POSIX clock id %d lacks clock_get64()\n", clock_id); return; } - if (!new_clock->clock_getres && !new_clock->clock_getres64) { - printk(KERN_WARNING "POSIX clock id %d lacks clock_getres() and clock_getres64()\n", + if (!new_clock->clock_getres64) { + printk(KERN_WARNING "POSIX clock id %d lacks clock_getres64()\n", clock_id); return; } - if (new_clock->timer_get && !new_clock->timer_get64) - new_clock->timer_get64 = default_timer_get64; - if (new_clock->timer_set && !new_clock->timer_set64) - new_clock->timer_set64 = default_timer_set64; - if (new_clock->clock_set && !new_clock->clock_set64) - new_clock->clock_set64 = default_clock_set64; - if (new_clock->clock_get && !new_clock->clock_get64) - new_clock->clock_get64 = default_clock_get64; - if (new_clock->clock_getres && !new_clock->clock_getres64) - new_clock->clock_getres64 = default_clock_getres64; - posix_clocks[clock_id] = *new_clock; } EXPORT_SYMBOL_GPL(posix_timers_register_clock); @@ -694,8 +615,7 @@ static struct k_clock *clockid_to_kclock(const clockid_t id) return (id & CLOCKFD_MASK) == CLOCKFD ? &clock_posix_dynamic : &clock_posix_cpu; - if (id >= MAX_CLOCKS || (!posix_clocks[id].clock_getres - && !posix_clocks[id].clock_getres64)) + if (id >= MAX_CLOCKS || !posix_clocks[id].clock_getres64) return NULL; return &posix_clocks[id]; }