Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp719243yba; Fri, 26 Apr 2019 07:41:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/5TEMlCnloZgc1W4O0iWQXI5H4cURpPgUxr4FmY6bmpp0aZNKpWLPOfZV5/i0vcuw911E X-Received: by 2002:a63:fb01:: with SMTP id o1mr33599477pgh.135.1556289702141; Fri, 26 Apr 2019 07:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556289702; cv=none; d=google.com; s=arc-20160816; b=Xi/jUlabXm8J+jSuU06wOMm/+Kzz3duvDolQCtYQ2cvB4avzo813mrx+lnJY9TOdGK 3+0U2rGU0Xsnot2QeiCnncCCEa8tQ77L/itNxI8yeqenjENrfHavtVgpeDmE3PRQ4y+e Gd4vN2NP3kBOqi9JO0FrNhCYy4oljLYb9wI6ipE94sqvSDfn3pqC7gGlcU5BGKszefLM cKU9f1Xvibb8izP4ssSvBbAEMA7Sp1S92fniwfYAdsTiITa3Ufnrou167eeMeI81Fwy6 qoGwk8DGxPOyI+wR/ZKQuL7Y3+iiFDSV1WsjRH1DDnQymkZwgMPSLwHfi+pXkP4uexVQ OiGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jMpWMAAxO+LnMJ+gJEcV0WaBPF9RswGeTtWwU7nzdko=; b=M/eIcuIvb+MaVX7mZikPLE+z9LiPJ+Uk2wIUM5HpybfrFEiB+x0e4pfei61ERn9ry3 Sppuk5tM9tugrYnpVYJuwunJI/Rbf14bIpITxFku2cs/Yn+U1juTYEtFMjt9A5pYf4hd nNkxtKq1M099hRCEpmVtQ0D1HeFZqUmbxRKjdxcYjcqPmpaX2in/+wzb8FPqTy5qe48H Gx5RPQxQaKFSRGweTfo+Y/fiC7tp0jmoCtlXMjpg1St57jC94ccTR2lRnA9XAz/UnqRS ikqGL9YbiI7F0id7cqMIhpQ084sDNDn8sPTa709trtc+Q5YXbFrvX6zRuE2/OtJE18c6 difA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si24822382pgk.76.2019.04.26.07.41.26; Fri, 26 Apr 2019 07:41:42 -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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726521AbfDZOiZ (ORCPT + 99 others); Fri, 26 Apr 2019 10:38:25 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:40617 "EHLO relay2-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726154AbfDZOiZ (ORCPT ); Fri, 26 Apr 2019 10:38:25 -0400 X-Originating-IP: 109.213.12.238 Received: from localhost (alyon-652-1-29-238.w109-213.abo.wanadoo.fr [109.213.12.238]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id F134740008; Fri, 26 Apr 2019 14:38:22 +0000 (UTC) Date: Fri, 26 Apr 2019 16:38:22 +0200 From: Alexandre Belloni To: Mathieu Malaterre Cc: linux-rtc@vger.kernel.org, Paul Cercueil , linux-arm-kernel@lists.infradead.org, LKML Subject: Re: [PATCH 2/7] rtc: jz4740: switch to rtc_time64_to_tm/rtc_tm_to_time64 Message-ID: <20190426143822.GS14604@piout.net> References: <20190418100045.29288-1-alexandre.belloni@bootlin.com> <20190418100045.29288-2-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/04/2019 16:29:36+0200, Mathieu Malaterre wrote: > On Thu, Apr 18, 2019 at 12:00 PM Alexandre Belloni > wrote: > > > > Call the 64bit versions of rtc_tm time conversion now that the range is > > enforced by the core. > > > > Signed-off-by: Alexandre Belloni > > --- > > drivers/rtc/rtc-jz4740.c | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c > > index 079469627bd7..15b6832f3931 100644 > > --- a/drivers/rtc/rtc-jz4740.c > > +++ b/drivers/rtc/rtc-jz4740.c > > @@ -171,7 +171,7 @@ static int jz4740_rtc_read_time(struct device *dev, struct rtc_time *time) > > if (timeout == 0) > > return -EIO; > > > > - rtc_time_to_tm(secs, time); > > + rtc_time64_to_tm(secs, time); > > > > return 0; > > } > > @@ -196,7 +196,7 @@ static int jz4740_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) > > alrm->enabled = !!(ctrl & JZ_RTC_CTRL_AE); > > alrm->pending = !!(ctrl & JZ_RTC_CTRL_AF); > > > > - rtc_time_to_tm(secs, &alrm->time); > > + rtc_time64_to_tm(secs, &alrm->time); > > > > return rtc_valid_tm(&alrm->time); > > } > > @@ -205,9 +205,7 @@ static int jz4740_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) > > { > > int ret; > > struct jz4740_rtc *rtc = dev_get_drvdata(dev); > > - unsigned long secs; > > - > > - rtc_tm_to_time(&alrm->time, &secs); > > + unsigned long secs = rtc_tm_to_time64(&alrm->time); > > nitpick: all other declarations are done with uint32_t, so to make it > clear (maybe) with something like: > > uint32_t secs = lower_32_bits(rtc_tm_to_time64(&alrm->time)); > Ok, I'll change that. > Technically I would have stored the full time64_t here and put a > WARN_ON(secs > U32_MAX) but I am not sure what other driver are > supposed to do in this case. > Because range_max is set properly, the core will ensure that all the times passed to the driver fit within the range. Thanks for the review! -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com