From patchwork Mon Jun 1 12:08:20 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: 49322 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F1C99218FC for ; Mon, 1 Jun 2015 12:08:53 +0000 (UTC) Received: by wiam3 with SMTP id m3sf10640163wia.3 for ; Mon, 01 Jun 2015 05:08:53 -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=E6LhskBxOd2OMOIE64r3EXRjH1NUtfwvs80U2irLjgA=; b=QujmN/BhWMQC1/p1fHJlaMmAFpt1yNsNDNIF5W7ZTw2mAXesfvk5Pe3Zo+RgeMUm3F TgLoI3LMLUJIyqx7nvE9c/NCV13lq9dydamaNUcmjkDJNJWpIqWl4iIKMFeHe20Hg4Ld uKAi6oMVtc0yJg9UCBp/xoi/ikyzeiJ1/s5e9Ap9Zl7LZrpyAbeQK+f1Jgn3UsbaFXBQ 9ezAiTgr6j0VB4837B1vJugTbVnCIbNm1aFsccBkZsAocXVd4qK5FwPTt1Nanqg7FOQ0 XPPqreq600V4bzX5yRVHP9vnRdfaG5PsFJuwehI+mZ1JKpWSpywZseHt2yQEKn4xL8m7 Ne+A== X-Gm-Message-State: ALoCoQmhXFL0Wm6p9Hex3eceRF585S9RHn7RKys0XZPbVc6it1ZkiKY137iuEVoAy8ROp6dI/2tv X-Received: by 10.194.5.229 with SMTP id v5mr20619585wjv.0.1433160533331; Mon, 01 Jun 2015 05:08:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.195 with SMTP id g3ls643292lam.0.gmail; Mon, 01 Jun 2015 05:08:53 -0700 (PDT) X-Received: by 10.112.169.42 with SMTP id ab10mr20648107lbc.3.1433160533133; Mon, 01 Jun 2015 05:08:53 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id t6si12140511lal.117.2015.06.01.05.08.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 05:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labko7 with SMTP id ko7so96014666lab.2 for ; Mon, 01 Jun 2015 05:08:53 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr20524106lah.76.1433160532999; Mon, 01 Jun 2015 05:08:52 -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 hn6csp2266049lbb; Mon, 1 Jun 2015 05:08:51 -0700 (PDT) X-Received: by 10.70.55.199 with SMTP id u7mr39912385pdp.42.1433160531053; Mon, 01 Jun 2015 05:08:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id da5si21015645pbc.20.2015.06.01.05.08.50; Mon, 01 Jun 2015 05:08:51 -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 S1752469AbbFAMIp (ORCPT + 28 others); Mon, 1 Jun 2015 08:08:45 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:36100 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752556AbbFAMIf (ORCPT ); Mon, 1 Jun 2015 08:08:35 -0400 Received: by pdjm12 with SMTP id m12so23426305pdj.3 for ; Mon, 01 Jun 2015 05:08:34 -0700 (PDT) X-Received: by 10.68.88.33 with SMTP id bd1mr2521617pbb.124.1433160514865; Mon, 01 Jun 2015 05:08:34 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id o3sm14368100pds.1.2015.06.01.05.08.32 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 05:08:34 -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 v4 25/25] k_clock:Remove the 32bit methods with timespec/itimerspec type Date: Mon, 1 Jun 2015 20:08:20 +0800 Message-Id: <1433160500-5480-1-git-send-email-baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 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.46 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 new methods, this patch removes the older methods with timepsec/itimerspec type, as a result, the k_clock structure is ready for the year 2038 year. 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 31ba88d..b4756a3 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; \ @@ -543,73 +542,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) { @@ -619,28 +551,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); @@ -687,8 +608,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]; }