From patchwork Thu Mar 19 05:45:08 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: 46011 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8D3272153C for ; Thu, 19 Mar 2015 05:46:53 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf10706080lab.1 for ; Wed, 18 Mar 2015 22:46:52 -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=epHpwUQ037tyRuqbNSJ+CblVjbUptuOvJoGhPWvDECo=; b=J2BOXRQKe11WgnmyJSy9+Rm0s+3gLY00sbQ/Eq02MCYitna0DadYp/sEUN0TdwuX7d g39X0AUrTVy6Z15kCjm4RwH8alA1d9PPJV4C1+lykcIE+CBNZSuXy2ZmJG8Gf3wNbH82 +Fs74ZROwiTXKljG1KtAVGCD44ceELMSEGHueYIPmlOBNiT1IVAbPIVAwRL68qH1E2BN yHkeqgAd2HRpWY/dFAfF4vW4YxrbhuaPQgUID2JKLBG90WeqhcguI6JeMVWrhGaFXv3D 2reKdaG7jgvWnAC3covUOltrRlg+2c/baSdLKuRDlJ1sQEYDdXyN6yW63Zo3It+Ew3ef b1Ow== X-Gm-Message-State: ALoCoQkHiPj6s27eVqtZviJu2eqnRWLRKVti31XqdeGOsN7xU+YUdtH94uUOkMdC5biLDWXWnY0X X-Received: by 10.112.40.81 with SMTP id v17mr7732300lbk.5.1426744012442; Wed, 18 Mar 2015 22:46:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.225.132 with SMTP id rk4ls259047lac.50.gmail; Wed, 18 Mar 2015 22:46:51 -0700 (PDT) X-Received: by 10.152.203.134 with SMTP id kq6mr47671260lac.110.1426744011897; Wed, 18 Mar 2015 22:46:51 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id cj10si179852lad.105.2015.03.18.22.46.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 22:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by labjg1 with SMTP id jg1so53708019lab.2 for ; Wed, 18 Mar 2015 22:46:51 -0700 (PDT) X-Received: by 10.152.8.15 with SMTP id n15mr40006443laa.41.1426744011729; Wed, 18 Mar 2015 22:46:51 -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.35.133 with SMTP id h5csp171375lbj; Wed, 18 Mar 2015 22:46:50 -0700 (PDT) X-Received: by 10.66.156.38 with SMTP id wb6mr91290477pab.68.1426744009944; Wed, 18 Mar 2015 22:46:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qa7si789461pac.22.2015.03.18.22.46.48; Wed, 18 Mar 2015 22:46:49 -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 S1752941AbbCSFqn (ORCPT + 27 others); Thu, 19 Mar 2015 01:46:43 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:33780 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751529AbbCSFqk (ORCPT ); Thu, 19 Mar 2015 01:46:40 -0400 Received: by pdnc3 with SMTP id c3so65778099pdn.0 for ; Wed, 18 Mar 2015 22:46:39 -0700 (PDT) X-Received: by 10.66.218.168 with SMTP id ph8mr27296148pac.95.1426743999707; Wed, 18 Mar 2015 22:46:39 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([114.30.40.58]) by mx.google.com with ESMTPSA id j4sm655258pdk.76.2015.03.18.22.46.36 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2015 22:46:38 -0700 (PDT) From: Baolin Wang To: richardcochran@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, john.stultz@linaro.com, tglx@linutronix.de, arnd@linaro.org, baolin.wang@linaro.org Subject: [PATCH 3/4] ptp/pch:Replace timespec with ktime_t in ptp_pch.c Date: Thu, 19 Mar 2015 13:45:08 +0800 Message-Id: <1426743909-24335-4-git-send-email-baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1426743909-24335-1-git-send-email-baolin.wang@linaro.org> References: <1426743909-24335-1-git-send-email-baolin.wang@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: 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.50 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 changes the 32-bit time type (timespec) to the 64-bit one (ktime_t), since 32-bit time types will break in the year 2038. This patch implements the getktime/setktime interfaces with "ktime_t" type, and removed the gettime/settime interfaces with "timespec" type in ptp_pch.c file. Signed-off-by: Baolin Wang --- drivers/ptp/ptp_pch.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index 2554872..c759225 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c @@ -449,36 +449,27 @@ static int ptp_pch_adjtime(struct ptp_clock_info *ptp, s64 delta) return 0; } -static int ptp_pch_gettime(struct ptp_clock_info *ptp, struct timespec *ts) +static int ptp_pch_getktime(struct ptp_clock_info *ptp, ktime_t *kt) { - u64 ns; - u32 remainder; unsigned long flags; struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps); struct pch_ts_regs __iomem *regs = pch_dev->regs; spin_lock_irqsave(&pch_dev->register_lock, flags); - ns = pch_systime_read(regs); + *kt = ns_to_ktime(pch_systime_read(regs)); spin_unlock_irqrestore(&pch_dev->register_lock, flags); - ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); - ts->tv_nsec = remainder; return 0; } -static int ptp_pch_settime(struct ptp_clock_info *ptp, - const struct timespec *ts) +static int ptp_pch_setktime(struct ptp_clock_info *ptp, ktime_t kt) { - u64 ns; unsigned long flags; struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps); struct pch_ts_regs __iomem *regs = pch_dev->regs; - ns = ts->tv_sec * 1000000000ULL; - ns += ts->tv_nsec; - spin_lock_irqsave(&pch_dev->register_lock, flags); - pch_systime_write(regs, ns); + pch_systime_write(regs, ktime_to_ns(kt)); spin_unlock_irqrestore(&pch_dev->register_lock, flags); return 0; @@ -518,8 +509,8 @@ static struct ptp_clock_info ptp_pch_caps = { .pps = 0, .adjfreq = ptp_pch_adjfreq, .adjtime = ptp_pch_adjtime, - .gettime = ptp_pch_gettime, - .settime = ptp_pch_settime, + .getktime = ptp_pch_getktime, + .setktime = ptp_pch_setktime, .enable = ptp_pch_enable, };