Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4270894pxb; Tue, 17 Nov 2020 16:31:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKdLC06j5hRaHV+C+4Z4ILsgrgDgi0+XpiznarA1JVM0k33ZOtsAE9nSL7TaIj6McEOtlr X-Received: by 2002:a50:e60a:: with SMTP id y10mr22834881edm.157.1605659514601; Tue, 17 Nov 2020 16:31:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605659514; cv=none; d=google.com; s=arc-20160816; b=Uiwrs4qD3YBi5m0j606LhZc27oi9r7tK0KYt8llkyhDY6L6ltHI927Z1tlNwfM4L1a sMBvknmDi3GL4lg3Vs8001te6YrWlf8fwPRDxHtR/5np3dgUlx85AW9xwOOi9k6DxORu 4mX+6WEenJJSa4nIoYQIu27037RRfrvgZhrDQYJ3Sb9UD71MWZVgVGor7pwbScbjbTE4 JMWUtNRDuGDcaSAsI99YQKlnvluLl520Y4i0HoxM/XygwfF/1WCqLYI28Afo/EnV6GVE tXBNxrKqjQdhHr71Uif/RNlSDYEH7jQtDLZYnJXHCijp0Fz5//561oulrIJZbwQyEm8p 8oYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=AAcpoQ3nMeXxAl8h654Ppu6kOKbUZb6cjpjImakiS3E=; b=Lq8nGWcg5LQEaU5p5wmSaNHrst47zh3V6/H9cjTgil2rEUZv27PLB04WVESTrq9jUW pTHM94MdvOxROpQ6Qwqtq3HgIvl3A38odKN0ZMo7Fx/Be0hq6sRIw310eGm4SI5ZJvkD pBqE9uUsje5ndNdOKT/4n8eQoyj/yInQ91orA4n9CjVWNr8FHIAHfYscYo56VnJUHxjC aQAzN8YUkWNUPNDID7TYE0ciZ7rsEmbe8XTqgpkIzhzz9N5sG0aPuZSJwZQB7Fmn2N64 B8c8jRe/F1lqAsP6+AihzwArfR8EGUjA0clYvpnrhSt9DMJypdPd2XWafNFpgZ4XkYWi dLnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a18si12039648edy.568.2020.11.17.16.31.32; Tue, 17 Nov 2020 16:31:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbgKRA1y (ORCPT + 99 others); Tue, 17 Nov 2020 19:27:54 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:45311 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgKRA1x (ORCPT ); Tue, 17 Nov 2020 19:27:53 -0500 X-Originating-IP: 86.194.74.19 Received: from localhost (lfbn-lyo-1-997-19.w86-194.abo.wanadoo.fr [86.194.74.19]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id AB1ADFF802; Wed, 18 Nov 2020 00:27:51 +0000 (UTC) From: Alexandre Belloni To: Alessandro Zummo , Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] rtc: pcf8523: set range Date: Wed, 18 Nov 2020 01:27:46 +0100 Message-Id: <20201118002747.1346504-2-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201118002747.1346504-1-alexandre.belloni@bootlin.com> References: <20201118002747.1346504-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the th RTC range, it is a classic BCD RTC, considering 00 as a leap year. Let the core handle range checking. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-pcf8523.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c index b525998cd70e..d5f913cb2ec9 100644 --- a/drivers/rtc/rtc-pcf8523.c +++ b/drivers/rtc/rtc-pcf8523.c @@ -226,17 +226,6 @@ static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm) u8 regs[8]; int err; - /* - * The hardware can only store values between 0 and 99 in it's YEAR - * register (with 99 overflowing to 0 on increment). - * After 2100-02-28 we could start interpreting the year to be in the - * interval [2100, 2199], but there is no path to switch in a smooth way - * because the chip handles YEAR=0x00 (and the out-of-spec - * YEAR=0xa0) as a leap year, but 2100 isn't. - */ - if (tm->tm_year < 100 || tm->tm_year >= 200) - return -EINVAL; - err = pcf8523_stop_rtc(client); if (err < 0) return err; @@ -361,6 +350,8 @@ static int pcf8523_probe(struct i2c_client *client, return PTR_ERR(rtc); rtc->ops = &pcf8523_rtc_ops; + rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; + rtc->range_max = RTC_TIMESTAMP_END_2099; return devm_rtc_register_device(rtc); } -- 2.28.0