diff mbox series

rtc: cpcap: fix range

Message ID 20200629114123.27956-1-sebastian.reichel@collabora.com (mailing list archive)
State New, archived
Headers show
Series rtc: cpcap: fix range | expand

Commit Message

Sebastian Reichel June 29, 2020, 11:41 a.m. UTC
Unbreak CPCAP driver, which has one more bit in the day counter
increasing the max. range from 2014 to 2058. The original commit
introducing the range limit was obviously wrong, since the driver
has only been written in 2017 (3 years after 14 bits would have
run out).

Reported-by: Sicelo A. Mhlongo <absicsz@gmail.com>
Reported-by: Dev Null <devnull@uvos.xyz>
Fixes: d2377f8cc5a7 ("rtc: cpcap: set range")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/rtc/rtc-cpcap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Merlijn Wajer June 29, 2020, 5:25 p.m. UTC | #1
Hi,

On 29/06/2020 13:41, Sebastian Reichel wrote:
> Unbreak CPCAP driver, which has one more bit in the day counter
> increasing the max. range from 2014 to 2058. The original commit
> introducing the range limit was obviously wrong, since the driver
> has only been written in 2017 (3 years after 14 bits would have
> run out).

This seems to work for me, thanks.

Please add as you deem appropriate:

Tested-by: Merlijn Wajer <merlijn@wizzup.org>
Acked-by: Merlijn Wajer <merlijn@wizzup.org>

Cheers,
Merlijn
Alexandre Belloni July 2, 2020, 8:23 p.m. UTC | #2
On Mon, 29 Jun 2020 13:41:23 +0200, Sebastian Reichel wrote:
> Unbreak CPCAP driver, which has one more bit in the day counter
> increasing the max. range from 2014 to 2058. The original commit
> introducing the range limit was obviously wrong, since the driver
> has only been written in 2017 (3 years after 14 bits would have
> run out).

Applied, thanks!

What happen is that I can't count bits and so I though PCAP had 13 bits and
CPCAP 14 bits while it is indeed 14 and 15. I did the correct thing in the PCAP
driver though.

Thanks for the fix!

[1/1] rtc: cpcap: fix range
      commit: d6ac11f677ded28180fc9e59b01db79036c3ec31

Best regards,
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-cpcap.c b/drivers/rtc/rtc-cpcap.c
index a603f1f21125..800667d73a6f 100644
--- a/drivers/rtc/rtc-cpcap.c
+++ b/drivers/rtc/rtc-cpcap.c
@@ -261,7 +261,7 @@  static int cpcap_rtc_probe(struct platform_device *pdev)
 		return PTR_ERR(rtc->rtc_dev);
 
 	rtc->rtc_dev->ops = &cpcap_rtc_ops;
-	rtc->rtc_dev->range_max = (1 << 14) * SECS_PER_DAY - 1;
+	rtc->rtc_dev->range_max = (timeu64_t) (DAY_MASK + 1) * SECS_PER_DAY - 1;
 
 	err = cpcap_get_vendor(dev, rtc->regmap, &rtc->vendor);
 	if (err)