From patchwork Thu Oct 30 11:15:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 39822 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 41349202FE for ; Thu, 30 Oct 2014 11:17:39 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf3018251eek.10 for ; Thu, 30 Oct 2014 04:17:38 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=BuvnW/OsB2rDqP6OEFzzelOkyo3MVojiFU6e+Kxjoa4=; b=acWUayoA3w281gm04uTlo0PMiEgYTfRo+FjsLUMBiL1ev8SGk+cEI3R9lFeBUYbjw8 bguxIKLfX2EooCHietHv1tY2va8InVpXzHSm6Tg/byF2aqua3DCoiXUr+pZJPlythU3s 9kyZv5s4ALCI37Igtayd0UQNiCLzUoZdC/MxmeABA28HNXGMmZieL48dNlHFSs2seWF4 SK8BewVAHu0n7U6VfyzGKHcDuM2LEZnZakaiKxGhi4Cmu2fywbFW/W1Cdw8jBcEsFGSq NDQZGdsnRPQAeanrieznLQbRD78eZ8P17i/BGyD/BQSuAcitS3Qn87lVudlZpuKaKIGe Siiw== X-Gm-Message-State: ALoCoQldvT8RKbABnvkYv8+5tvojP+v93/gLcOmOdCnf0H7SQq/n4Wo6oXVqCljGO6M1KKFvt50v X-Received: by 10.194.86.66 with SMTP id n2mr9408wjz.7.1414667858442; Thu, 30 Oct 2014 04:17:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.7 with SMTP id f7ls290116laa.56.gmail; Thu, 30 Oct 2014 04:17:38 -0700 (PDT) X-Received: by 10.112.147.199 with SMTP id tm7mr18228407lbb.92.1414667858036; Thu, 30 Oct 2014 04:17:38 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id q9si11488686lag.92.2014.10.30.04.17.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 04:17:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gq15so4199129lab.29 for ; Thu, 30 Oct 2014 04:17:38 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr18275770lbb.46.1414667857942; Thu, 30 Oct 2014 04:17:37 -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.84.229 with SMTP id c5csp22382lbz; Thu, 30 Oct 2014 04:17:37 -0700 (PDT) X-Received: by 10.68.167.99 with SMTP id zn3mr16635619pbb.30.1414667854657; Thu, 30 Oct 2014 04:17:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wg5si6275496pab.219.2014.10.30.04.17.34 for ; Thu, 30 Oct 2014 04:17:34 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759422AbaJ3LRc (ORCPT + 26 others); Thu, 30 Oct 2014 07:17:32 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33342 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759381AbaJ3LR3 (ORCPT ); Thu, 30 Oct 2014 07:17:29 -0400 Received: by mail-pa0-f51.google.com with SMTP id kq14so5268384pab.38 for ; Thu, 30 Oct 2014 04:17:28 -0700 (PDT) X-Received: by 10.69.26.133 with SMTP id iy5mr16805955pbd.114.1414667848559; Thu, 30 Oct 2014 04:17:28 -0700 (PDT) Received: from wangdeqiang.com ([210.21.227.66]) by mx.google.com with ESMTPSA id i10sm6874826pdr.21.2014.10.30.04.17.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 04:17:27 -0700 (PDT) From: "pang.xunlei" To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, xen-devel@lists.xenproject.org, John Stultz , Thomas Gleixner , Alessandro Zummo , Stefano Stabellini , "pang.xunlei" Subject: [RFC PATCH v2 07/11] time: Convert alarm_set_rtc() to use timespec64 Date: Thu, 30 Oct 2014 19:15:41 +0800 Message-Id: <1414667745-7703-8-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414667745-7703-1-git-send-email-pang.xunlei@linaro.org> References: <1414667745-7703-1-git-send-email-pang.xunlei@linaro.org> 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: pang.xunlei@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.42 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: , As part of addressing 2038 saftey for in-kernel uses, this patch creates no functional change, and converts alarm_set_rtc() to use timespec64. Signed-off-by: pang.xunlei --- drivers/staging/android/alarm-dev.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c index 01017ff..dfa24f0 100644 --- a/drivers/staging/android/alarm-dev.c +++ b/drivers/staging/android/alarm-dev.c @@ -152,19 +152,16 @@ static int alarm_wait(void) return rv; } -/* TODO: [2038 safety] alarm_set_rtc() uses timespec64 */ -static int alarm_set_rtc(struct timespec *ts) +static int alarm_set_rtc(struct timespec64 *ts) { - struct timespec ts64; struct rtc_time new_rtc_tm; struct rtc_device *rtc_dev; unsigned long flags; int rv = 0; - ts64 = timespec_to_timespec64(*ts); - rtc_time_to_tm64(ts64.tv_sec, &new_rtc_tm); + rtc_time_to_tm64(ts->tv_sec, &new_rtc_tm); rtc_dev = alarmtimer_get_rtcdev(); - rv = do_settimeofday64(&ts64); + rv = do_settimeofday64(ts); if (rv < 0) return rv; if (rtc_dev) @@ -201,9 +198,14 @@ static int alarm_get_time(enum android_alarm_type alarm_type, return rv; } +/* +* TODO: [2038 safety] alarm_do_ioctl() should be fixed to use timespec64, +* once timespec64 is promoted to userspace. +*/ static long alarm_do_ioctl(struct file *file, unsigned int cmd, struct timespec *ts) { + struct timespec64 ts64; int rv = 0; unsigned long flags; enum android_alarm_type alarm_type = ANDROID_ALARM_IOCTL_TO_TYPE(cmd); @@ -241,7 +243,8 @@ static long alarm_do_ioctl(struct file *file, unsigned int cmd, rv = alarm_wait(); break; case ANDROID_ALARM_SET_RTC: - rv = alarm_set_rtc(ts); + ts64 = timespec_to_timespec64(*ts); + rv = alarm_set_rtc(&ts64); break; case ANDROID_ALARM_GET_TIME(0): rv = alarm_get_time(alarm_type, ts);