summary refs log tree commit diff
path: root/drivers/rtc/rtc-r9701.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2020-10-15 21:11:31 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2020-10-19 22:48:55 +0200
commit7390bec4ed5d510d1a637257ff75e9ab49030411 (patch)
tree09891d072d528b7483a8cf483b7e5b785ef17fe9 /drivers/rtc/rtc-r9701.c
parent92c6dcfbd1eb803d4669c82b3d8a0fcbb803e3f9 (diff)
downloadlinux-7390bec4ed5d510d1a637257ff75e9ab49030411.tar.gz
rtc: r9701: stop setting a default time
It doesn't make sense to set the RTC to a default value at probe time. Let
the core handle invalid date and time.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20201015191135.471249-2-alexandre.belloni@bootlin.com
Diffstat (limited to 'drivers/rtc/rtc-r9701.c')
-rw-r--r--drivers/rtc/rtc-r9701.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index eb00879f7c9a..f8f7044ff808 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -115,7 +115,6 @@ static const struct rtc_class_ops r9701_rtc_ops = {
 static int r9701_probe(struct spi_device *spi)
 {
 	struct rtc_device *rtc;
-	struct rtc_time dt;
 	unsigned char tmp;
 	int res;
 
@@ -126,27 +125,6 @@ static int r9701_probe(struct spi_device *spi)
 		return -ENODEV;
 	}
 
-	/*
-	 * The device seems to be present. Now check if the registers
-	 * contain invalid values. If so, try to write a default date:
-	 * 2000/1/1 00:00:00
-	 */
-	if (r9701_get_datetime(&spi->dev, &dt)) {
-		dev_info(&spi->dev, "trying to repair invalid date/time\n");
-		dt.tm_sec  = 0;
-		dt.tm_min  = 0;
-		dt.tm_hour = 0;
-		dt.tm_mday = 1;
-		dt.tm_mon  = 0;
-		dt.tm_year = 100;
-
-		if (r9701_set_datetime(&spi->dev, &dt) ||
-				r9701_get_datetime(&spi->dev, &dt)) {
-			dev_err(&spi->dev, "cannot repair RTC register\n");
-			return -ENODEV;
-		}
-	}
-
 	rtc = devm_rtc_device_register(&spi->dev, "r9701",
 				&r9701_rtc_ops, THIS_MODULE);
 	if (IS_ERR(rtc))