From patchwork Mon Jun 1 12:00: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: 49316 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 E4CF9218FC for ; Mon, 1 Jun 2015 12:01:43 +0000 (UTC) Received: by lani11 with SMTP id i11sf36331091lan.3 for ; Mon, 01 Jun 2015 05:01:42 -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=ZoNrc+kF3ELT5brucAvUW3v3YGUiINygg3q0tNW/ZNM=; b=d1kalpR+K/51iPFJnR8qnZadmXotxDOg/SVB8/HoiIKB2HI27xv0ruX1AQiceGMROj E5nLSbkGyJqQCTZUJrsPIgNsaPx9dg7Qc2VdZlccvgSYXB6GHoyax1IPzxehmbJQKOQ6 /eBa+b1ciNn4YHKs0ZniP5V+BVhkPrKigwVdIqywohnKeAzDE2Ia1ZDC/8cEtEFFoo2i Q1QcTuGUqK07+S8kmX+cNy9RFWhAB5Hf9V18tqk40LpsrMYhw/s3R8GUWoSO3ImUQvdS ChPWmrKF+fQgou+x8E0g8S7b+qP5QAhMj/HMmS19JYZe71UM25citvtvx+IU5Isv6xKc k8Sg== X-Gm-Message-State: ALoCoQmmEqDzdYVeVWzMdedQku7SYh9fAzNqinmUBKKLfZGKYyLLvvNsGGQsl/ymELTZS3dL9Z3V X-Received: by 10.180.35.164 with SMTP id i4mr1811065wij.0.1433160102836; Mon, 01 Jun 2015 05:01:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.227 with SMTP id kt3ls538222lac.18.gmail; Mon, 01 Jun 2015 05:01:42 -0700 (PDT) X-Received: by 10.152.43.168 with SMTP id x8mr20868254lal.79.1433160102645; Mon, 01 Jun 2015 05:01:42 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id lp10si12158626lbb.1.2015.06.01.05.01.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 05:01:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbcmx3 with SMTP id mx3so82737130lbc.1 for ; Mon, 01 Jun 2015 05:01:42 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr20351507lay.72.1433160102078; Mon, 01 Jun 2015 05:01: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 hn6csp2261121lbb; Mon, 1 Jun 2015 05:01:41 -0700 (PDT) X-Received: by 10.66.242.79 with SMTP id wo15mr40649954pac.6.1433160100292; Mon, 01 Jun 2015 05:01:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci4si3140539pad.127.2015.06.01.05.01.39; Mon, 01 Jun 2015 05:01: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 S932114AbbFAMBe (ORCPT + 28 others); Mon, 1 Jun 2015 08:01:34 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:36060 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752435AbbFAMBO (ORCPT ); Mon, 1 Jun 2015 08:01:14 -0400 Received: by pdjm12 with SMTP id m12so23288595pdj.3 for ; Mon, 01 Jun 2015 05:01:14 -0700 (PDT) X-Received: by 10.70.129.133 with SMTP id nw5mr39536290pdb.155.1433160074415; Mon, 01 Jun 2015 05:01:14 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id zv8sm14045898pbc.45.2015.06.01.05.01.11 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 05:01:13 -0700 (PDT) From: Baolin Wang To: arnd@arndb.de Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v4 19/25] char/mmtimer:Convert to the 64bit methods for k_clock callback functions Date: Mon, 1 Jun 2015 20:00:58 +0800 Message-Id: <1433160058-5255-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.217.177 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: , This patch converts the timespec/itimerspec type to timespec64/itimerspec64 type for k_clock callback functions in mmtimer.c file, that makes it ready for 2038 issue. Signed-off-by: Baolin Wang --- drivers/char/mmtimer.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index 3d6c067..213d0bb 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c @@ -478,18 +478,18 @@ static int sgi_clock_period; static struct timespec sgi_clock_offset; static int sgi_clock_period; -static int sgi_clock_get(clockid_t clockid, struct timespec *tp) +static int sgi_clock_get(clockid_t clockid, struct timespec64 *tp) { u64 nsec; nsec = rtc_time() * sgi_clock_period + sgi_clock_offset.tv_nsec; - *tp = ns_to_timespec(nsec); + *tp = ns_to_timespec64(nsec); tp->tv_sec += sgi_clock_offset.tv_sec; return 0; }; -static int sgi_clock_set(const clockid_t clockid, const struct timespec *tp) +static int sgi_clock_set(const clockid_t clockid, const struct timespec64 *tp) { u64 nsec; @@ -657,7 +657,7 @@ static int sgi_timer_del(struct k_itimer *timr) } /* Assumption: it_lock is already held with irq's disabled */ -static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) +static void sgi_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting) { if (timr->it.mmtimer.clock == TIMER_OFF) { @@ -668,14 +668,14 @@ static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) return; } - cur_setting->it_interval = ns_to_timespec(timr->it.mmtimer.incr * sgi_clock_period); - cur_setting->it_value = ns_to_timespec((timr->it.mmtimer.expires - rtc_time()) * sgi_clock_period); + cur_setting->it_interval = ns_to_timespec64(timr->it.mmtimer.incr * sgi_clock_period); + cur_setting->it_value = ns_to_timespec64((timr->it.mmtimer.expires - rtc_time()) * sgi_clock_period); } static int sgi_timer_set(struct k_itimer *timr, int flags, - struct itimerspec * new_setting, - struct itimerspec * old_setting) + struct itimerspec64 *new_setting, + struct itimerspec64 *old_setting) { unsigned long when, period, irqflags; int err = 0; @@ -687,8 +687,8 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, sgi_timer_get(timr, old_setting); sgi_timer_del(timr); - when = timespec_to_ns(&new_setting->it_value); - period = timespec_to_ns(&new_setting->it_interval); + when = timespec64_to_ns(&new_setting->it_value); + period = timespec64_to_ns(&new_setting->it_interval); if (when == 0) /* Clear timer */ @@ -699,11 +699,9 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, return -ENOMEM; if (flags & TIMER_ABSTIME) { - struct timespec n; unsigned long now; - getnstimeofday(&n); - now = timespec_to_ns(&n); + now = ktime_get_real_ns(); if (when > now) when -= now; else @@ -765,7 +763,7 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, return err; } -static int sgi_clock_getres(const clockid_t which_clock, struct timespec *tp) +static int sgi_clock_getres(const clockid_t which_clock, struct timespec64 *tp) { tp->tv_sec = 0; tp->tv_nsec = sgi_clock_period; @@ -773,13 +771,13 @@ static int sgi_clock_getres(const clockid_t which_clock, struct timespec *tp) } static struct k_clock sgi_clock = { - .clock_set = sgi_clock_set, - .clock_get = sgi_clock_get, - .clock_getres = sgi_clock_getres, + .clock_set64 = sgi_clock_set, + .clock_get64 = sgi_clock_get, + .clock_getres64 = sgi_clock_getres, .timer_create = sgi_timer_create, - .timer_set = sgi_timer_set, + .timer_set64 = sgi_timer_set, .timer_del = sgi_timer_del, - .timer_get = sgi_timer_get + .timer_get64 = sgi_timer_get }; /**