mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 01:49:36 +00:00
rtc: mv: remove artificial limitation
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>
This commit is contained in:
parent
b3a5ac42ab
commit
844cba65bf
1 changed files with 0 additions and 12 deletions
|
@ -223,7 +223,6 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct rtc_plat_data *pdata;
|
struct rtc_plat_data *pdata;
|
||||||
u32 rtc_time;
|
u32 rtc_time;
|
||||||
u32 rtc_date;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
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);
|
pdata->irq = platform_get_irq(pdev, 0);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, pdata);
|
platform_set_drvdata(pdev, pdata);
|
||||||
|
|
Loading…
Reference in a new issue