From patchwork Fri Jun 12 08:00:28 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: 49809 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 9A8B9228DB for ; Fri, 12 Jun 2015 08:01:55 +0000 (UTC) Received: by wgla2 with SMTP id a2sf7477750wgl.1 for ; Fri, 12 Jun 2015 01:01:54 -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=m6qLjsTlE1jpZ8E9fAG6ctc7HdiGPKu/9ACHzBaJdqw=; b=Gec6hEglK/TJTQizwC25mEpl17hdg0C5RardfZez3AWJ0tKQi7UTL/MvaAyajneXlY hYnEt9bzbDCSoEetWKXUvMrwWzeqFRsmBSirpNcxuD55G3/fxdn8QaAviAOmZDdB2BpN PxaTidOBeuNCdqmWinXnLkDY62wD1LxUhiDKCYQHGJ/o7knVOigBVAQed+3zZa7OkOlo dLLEcBW3+kdkB/bYQc03qjVxQH5sepFeQbAa7r+2rIo5bv25gGRoxxyI7rVkcmVdIOnl D1nax6ZARdNoc7REJtrKXEPQQHsnvrR6dBzE5iAJCJ3E+Da6NDjicfjhEA9b3hd/Dmnc sV5A== X-Gm-Message-State: ALoCoQl+Aah3VKsBp8qRV1qQaHL9S6qA08+2Y5sRmgpDQO6DkhOcCyjPnyIkB+hfpaYcwySDEpcL X-Received: by 10.113.11.3 with SMTP id ee3mr13062018lbd.9.1434096114119; Fri, 12 Jun 2015 01:01:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.1 with SMTP id n1ls450615laa.87.gmail; Fri, 12 Jun 2015 01:01:53 -0700 (PDT) X-Received: by 10.112.166.5 with SMTP id zc5mr13606106lbb.91.1434096113921; Fri, 12 Jun 2015 01:01:53 -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 xp7si2764432lac.20.2015.06.12.01.01.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 01:01:53 -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 lbcmx3 with SMTP id mx3so15537782lbc.1 for ; Fri, 12 Jun 2015 01:01:53 -0700 (PDT) X-Received: by 10.152.29.34 with SMTP id g2mr13830430lah.73.1434096113633; Fri, 12 Jun 2015 01:01:53 -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 hn6csp362026lbb; Fri, 12 Jun 2015 01:01:52 -0700 (PDT) X-Received: by 10.66.255.67 with SMTP id ao3mr21128875pad.60.1434096111642; Fri, 12 Jun 2015 01:01:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fa1si4345245pab.0.2015.06.12.01.01.50; Fri, 12 Jun 2015 01:01: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 S1755164AbbFLIBp (ORCPT + 29 others); Fri, 12 Jun 2015 04:01:45 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:35786 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753103AbbFLIBk (ORCPT ); Fri, 12 Jun 2015 04:01:40 -0400 Received: by pdbnf5 with SMTP id nf5so19881280pdb.2 for ; Fri, 12 Jun 2015 01:01:40 -0700 (PDT) X-Received: by 10.66.197.231 with SMTP id ix7mr21495627pac.9.1434096100009; Fri, 12 Jun 2015 01:01:40 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id pr5sm2751388pbc.63.2015.06.12.01.01.37 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 01:01:39 -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 19/24] alarmtimer: Convert to y2038 safe callbacks Date: Fri, 12 Jun 2015 16:00:28 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: 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: , The clock_getres()/clock_get()/clock_set()/timer_set()/timer_get() callbacks in struct k_clock are not year 2038 safe on 32bit systems, and it need convert to safe callbacks which use struct timespec64 or struct itimerspec64. Signed-off-by: Baolin Wang --- kernel/time/alarmtimer.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 7fbba63..c9a0adf 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -486,11 +486,11 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, /** * alarm_clock_getres - posix getres interface * @which_clock: clockid - * @tp: timespec to fill + * @tp: timespec64 to fill * * Returns the granularity of underlying alarm base clock */ -static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp) +static int alarm_clock_getres(const clockid_t which_clock, struct timespec64 *tp) { if (!alarmtimer_get_rtcdev()) return -EINVAL; @@ -503,18 +503,18 @@ static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp) /** * alarm_clock_get - posix clock_get interface * @which_clock: clockid - * @tp: timespec to fill. + * @tp: timespec64 to fill. * * Provides the underlying alarm base time. */ -static int alarm_clock_get(clockid_t which_clock, struct timespec *tp) +static int alarm_clock_get(clockid_t which_clock, struct timespec64 *tp) { struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)]; if (!alarmtimer_get_rtcdev()) return -EINVAL; - *tp = ktime_to_timespec(base->gettime()); + *tp = ktime_to_timespec64(base->gettime()); return 0; } @@ -544,24 +544,24 @@ static int alarm_timer_create(struct k_itimer *new_timer) /** * alarm_timer_get - posix timer_get interface * @new_timer: k_itimer pointer - * @cur_setting: itimerspec data to fill + * @cur_setting: itimerspec64 data to fill * * Copies out the current itimerspec data */ static void alarm_timer_get(struct k_itimer *timr, - struct itimerspec *cur_setting) + struct itimerspec64 *cur_setting) { ktime_t relative_expiry_time = alarm_expires_remaining(&(timr->it.alarm.alarmtimer)); if (ktime_to_ns(relative_expiry_time) > 0) { - cur_setting->it_value = ktime_to_timespec(relative_expiry_time); + cur_setting->it_value = ktime_to_timespec64(relative_expiry_time); } else { cur_setting->it_value.tv_sec = 0; cur_setting->it_value.tv_nsec = 0; } - cur_setting->it_interval = ktime_to_timespec(timr->it.alarm.interval); + cur_setting->it_interval = ktime_to_timespec64(timr->it.alarm.interval); } /** @@ -585,14 +585,14 @@ static int alarm_timer_del(struct k_itimer *timr) * alarm_timer_set - posix timer_set interface * @timr: k_itimer pointer to be deleted * @flags: timer flags - * @new_setting: itimerspec to be used - * @old_setting: itimerspec being replaced + * @new_setting: itimerspec64 to be used + * @old_setting: itimerspec64 being replaced * * Sets the timer to new_setting, and starts the timer. */ static int alarm_timer_set(struct k_itimer *timr, int flags, - struct itimerspec *new_setting, - struct itimerspec *old_setting) + struct itimerspec64 *new_setting, + struct itimerspec64 *old_setting) { ktime_t exp; @@ -610,8 +610,8 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, return TIMER_RETRY; /* start the timer */ - timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval); - exp = timespec_to_ktime(new_setting->it_value); + timr->it.alarm.interval = timespec64_to_ktime(new_setting->it_interval); + exp = timespec64_to_ktime(new_setting->it_value); /* Convert (if necessary) to absolute time */ if (flags != TIMER_ABSTIME) { ktime_t now; @@ -821,12 +821,12 @@ static int __init alarmtimer_init(void) int error = 0; int i; struct k_clock alarm_clock = { - .clock_getres = alarm_clock_getres, - .clock_get = alarm_clock_get, + .clock_getres64 = alarm_clock_getres, + .clock_get64 = alarm_clock_get, .timer_create = alarm_timer_create, - .timer_set = alarm_timer_set, + .timer_set64 = alarm_timer_set, .timer_del = alarm_timer_del, - .timer_get = alarm_timer_get, + .timer_get64 = alarm_timer_get, .nsleep = alarm_timer_nsleep, };