From: Alexandre Belloni <alexandre.belloni@bootlin.com> To: linux-rtc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven <geert+renesas@glider.be>, Chris Brandt <chris.brandt@renesas.com>, linux-renesas-soc@vger.kernel.org, Alexandre Belloni <alexandre.belloni@bootlin.com> Subject: [PATCH 1/3] rtc: sh: stop resetting time to epoch Date: Wed, 20 Mar 2019 12:30:08 +0100 [thread overview] Message-ID: <20190320113010.8955-1-alexandre.belloni@bootlin.com> (raw) There is no point in resetting the time to epoch as this means that userspace will never get the valuable information that time is actually invalid. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> --- drivers/rtc/rtc-sh.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index d417b203cbc5..f4ac9ec8fbb6 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c @@ -276,6 +276,9 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) struct sh_rtc *rtc = dev_get_drvdata(dev); unsigned int sec128, sec2, yr, yr100, cf_bit; + if (!(readb(rtc->regbase + RCR2) & RCR2_RTCEN)) + return -EINVAL; + do { unsigned int tmp; @@ -600,12 +603,6 @@ static int __init sh_rtc_probe(struct platform_device *pdev) rtc->rtc_dev->max_user_freq = 256; - /* reset rtc to epoch 0 if time is invalid */ - if (rtc_read_time(rtc->rtc_dev, &r) < 0) { - rtc_time_to_tm(0, &r); - rtc_set_time(rtc->rtc_dev, &r); - } - device_init_wakeup(&pdev->dev, 1); return 0; -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com> To: linux-rtc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Alexandre Belloni <alexandre.belloni@bootlin.com>, Chris Brandt <chris.brandt@renesas.com>, Geert Uytterhoeven <geert+renesas@glider.be>, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] rtc: sh: stop resetting time to epoch Date: Wed, 20 Mar 2019 12:30:08 +0100 [thread overview] Message-ID: <20190320113010.8955-1-alexandre.belloni@bootlin.com> (raw) There is no point in resetting the time to epoch as this means that userspace will never get the valuable information that time is actually invalid. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> --- drivers/rtc/rtc-sh.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index d417b203cbc5..f4ac9ec8fbb6 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c @@ -276,6 +276,9 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) struct sh_rtc *rtc = dev_get_drvdata(dev); unsigned int sec128, sec2, yr, yr100, cf_bit; + if (!(readb(rtc->regbase + RCR2) & RCR2_RTCEN)) + return -EINVAL; + do { unsigned int tmp; @@ -600,12 +603,6 @@ static int __init sh_rtc_probe(struct platform_device *pdev) rtc->rtc_dev->max_user_freq = 256; - /* reset rtc to epoch 0 if time is invalid */ - if (rtc_read_time(rtc->rtc_dev, &r) < 0) { - rtc_time_to_tm(0, &r); - rtc_set_time(rtc->rtc_dev, &r); - } - device_init_wakeup(&pdev->dev, 1); return 0; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-03-20 11:30 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-20 11:30 Alexandre Belloni [this message] 2019-03-20 11:30 ` [PATCH 1/3] rtc: sh: stop resetting time to epoch Alexandre Belloni 2019-03-20 11:30 ` [PATCH 2/3] rtc: sh: fix possible race condition Alexandre Belloni 2019-03-20 11:30 ` Alexandre Belloni 2019-03-21 9:51 ` Geert Uytterhoeven 2019-03-21 9:51 ` Geert Uytterhoeven 2019-03-20 11:30 ` [PATCH 3/3] rtc: sh: set range Alexandre Belloni 2019-03-20 11:30 ` Alexandre Belloni 2019-03-21 10:22 ` Geert Uytterhoeven 2019-03-21 10:22 ` Geert Uytterhoeven 2019-03-22 6:12 ` Alexandre Belloni 2019-03-22 6:12 ` Alexandre Belloni 2019-03-22 7:26 ` Geert Uytterhoeven 2019-03-22 7:26 ` Geert Uytterhoeven 2019-03-21 9:46 ` [PATCH 1/3] rtc: sh: stop resetting time to epoch Geert Uytterhoeven 2019-03-21 9:46 ` Geert Uytterhoeven
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190320113010.8955-1-alexandre.belloni@bootlin.com \ --to=alexandre.belloni@bootlin.com \ --cc=chris.brandt@renesas.com \ --cc=geert+renesas@glider.be \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=linux-rtc@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.