* [PATCH 2/6] rtc: mv: remove artificial limitation
2018-03-19 23:48 [PATCH 1/6] rtc: hctosys: Ensure system time doesn't overflow time_t Alexandre Belloni
@ 2018-03-19 23:48 ` Alexandre Belloni
2018-03-19 23:48 ` [PATCH 3/6] rtc: mrst: " Alexandre Belloni
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2018-03-19 23:48 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Dates after 2038 actually fit on 32 bits. The counter will overflow in
2106. Also, it is bad practice to reset the RTC to a default value.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-mv.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index 944c5c0fadd0..bc52dbb0c0e2 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -223,7 +223,6 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
struct resource *res;
struct rtc_plat_data *pdata;
u32 rtc_time;
- u32 rtc_date;
int ret = 0;
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
@@ -259,17 +258,6 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
}
}
- /*
- * A date after January 19th, 2038 does not fit on 32 bits and
- * will confuse the kernel and userspace. Reset to a sane date
- * (January 1st, 2013) if we're after 2038.
- */
- rtc_date = readl(pdata->ioaddr + RTC_DATE_REG_OFFS);
- if (bcd2bin((rtc_date >> RTC_YEAR_OFFS) & 0xff) >= 38) {
- dev_info(&pdev->dev, "invalid RTC date, resetting to January 1st, 2013\n");
- writel(0x130101, pdata->ioaddr + RTC_DATE_REG_OFFS);
- }
-
pdata->irq = platform_get_irq(pdev, 0);
platform_set_drvdata(pdev, pdata);
--
2.16.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 3/6] rtc: mrst: remove artificial limitation
2018-03-19 23:48 [PATCH 1/6] rtc: hctosys: Ensure system time doesn't overflow time_t Alexandre Belloni
2018-03-19 23:48 ` [PATCH 2/6] rtc: mv: remove artificial limitation Alexandre Belloni
@ 2018-03-19 23:48 ` Alexandre Belloni
2018-03-19 23:48 ` [PATCH 4/6] rtc: st-lpc: " Alexandre Belloni
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2018-03-19 23:48 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
The hardware supports years up to 100 so don't limit the year to 2038
artificially.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-mrst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index 901a8d170f68..fcb9de5218b2 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -122,7 +122,7 @@ static int mrst_set_time(struct device *dev, struct rtc_time *time)
min = time->tm_min;
sec = time->tm_sec;
- if (yrs < 72 || yrs > 138)
+ if (yrs < 72 || yrs > 172)
return -EINVAL;
yrs -= 72;
--
2.16.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 4/6] rtc: st-lpc: remove artificial limitation
2018-03-19 23:48 [PATCH 1/6] rtc: hctosys: Ensure system time doesn't overflow time_t Alexandre Belloni
2018-03-19 23:48 ` [PATCH 2/6] rtc: mv: remove artificial limitation Alexandre Belloni
2018-03-19 23:48 ` [PATCH 3/6] rtc: mrst: " Alexandre Belloni
@ 2018-03-19 23:48 ` Alexandre Belloni
2018-03-19 23:48 ` [PATCH 5/6] rtc: 88pm80x: " Alexandre Belloni
2018-03-19 23:48 ` [PATCH 6/6] rtc: 88pm860x: " Alexandre Belloni
4 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2018-03-19 23:48 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
The LPC RTC supports dates way beyond 2038, don't limit it artificially as
the kernel handles dates after 2038 properly.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-st-lpc.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c
index 82b0af159a28..dcdd2b0a58f7 100644
--- a/drivers/rtc/rtc-st-lpc.c
+++ b/drivers/rtc/rtc-st-lpc.c
@@ -254,21 +254,6 @@ static int st_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rtc);
- /*
- * The RTC-LPC is able to manage date.year > 2038
- * but currently the kernel can not manage this date!
- * If the RTC-LPC has a date.year > 2038 then
- * it's set to the epoch "Jan 1st 2000"
- */
- st_rtc_read_time(&pdev->dev, &tm_check);
-
- if (tm_check.tm_year >= (2038 - 1900)) {
- memset(&tm_check, 0, sizeof(tm_check));
- tm_check.tm_year = 100;
- tm_check.tm_mday = 1;
- st_rtc_set_time(&pdev->dev, &tm_check);
- }
-
rtc->rtc_dev = rtc_device_register("st-lpc-rtc", &pdev->dev,
&st_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc->rtc_dev)) {
--
2.16.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 5/6] rtc: 88pm80x: remove artificial limitation
2018-03-19 23:48 [PATCH 1/6] rtc: hctosys: Ensure system time doesn't overflow time_t Alexandre Belloni
` (2 preceding siblings ...)
2018-03-19 23:48 ` [PATCH 4/6] rtc: st-lpc: " Alexandre Belloni
@ 2018-03-19 23:48 ` Alexandre Belloni
2018-03-19 23:48 ` [PATCH 6/6] rtc: 88pm860x: " Alexandre Belloni
4 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2018-03-19 23:48 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
The 88pm80x supports time up to 2106 (it is a 32 bit counter). Also, the
year will never be before 1970 as the RTC core forbids that.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-88pm80x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c
index 466bf7f9a285..6cbafefa80a2 100644
--- a/drivers/rtc/rtc-88pm80x.c
+++ b/drivers/rtc/rtc-88pm80x.c
@@ -134,9 +134,9 @@ static int pm80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
struct pm80x_rtc_info *info = dev_get_drvdata(dev);
unsigned char buf[4];
unsigned long ticks, base, data;
- if ((tm->tm_year < 70) || (tm->tm_year > 138)) {
+ if (tm->tm_year > 206) {
dev_dbg(info->dev,
- "Set time %d out of range. Please set time between 1970 to 2038.\n",
+ "Set time %d out of range. Please set time between 1970 to 2106.\n",
1900 + tm->tm_year);
return -EINVAL;
}
--
2.16.2
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 6/6] rtc: 88pm860x: remove artificial limitation
2018-03-19 23:48 [PATCH 1/6] rtc: hctosys: Ensure system time doesn't overflow time_t Alexandre Belloni
` (3 preceding siblings ...)
2018-03-19 23:48 ` [PATCH 5/6] rtc: 88pm80x: " Alexandre Belloni
@ 2018-03-19 23:48 ` Alexandre Belloni
4 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2018-03-19 23:48 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
The 88pm860x supports time up to 2106 (it is a 32 bit counter). Also, the
year will never be before 1970 as the RTC core forbids that.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-88pm860x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
index 19e53b3b8e00..01ffc0ef8033 100644
--- a/drivers/rtc/rtc-88pm860x.c
+++ b/drivers/rtc/rtc-88pm860x.c
@@ -135,9 +135,9 @@ static int pm860x_rtc_set_time(struct device *dev, struct rtc_time *tm)
unsigned char buf[4];
unsigned long ticks, base, data;
- if ((tm->tm_year < 70) || (tm->tm_year > 138)) {
+ if (tm->tm_year > 206) {
dev_dbg(info->dev, "Set time %d out of range. "
- "Please set time between 1970 to 2038.\n",
+ "Please set time between 1970 to 2106.\n",
1900 + tm->tm_year);
return -EINVAL;
}
--
2.16.2
^ permalink raw reply [flat|nested] 6+ messages in thread