Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.kernel > #57447
| From | Uwe Kleine-König <uwe@kleine-koenig.org> |
|---|---|
| Newsgroups | linux.debian.kernel |
| Subject | [PATCH 2/4] rtc: s35390a: make sure all members in the output are set |
| Date | 2017-04-04 00:00 +0200 |
| Message-ID | <tsib0-44j-25@gated-at.bofh.it> (permalink) |
| References | <tlzgC-45R-31@gated-at.bofh.it> <tsi1k-40v-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The rtc core calls the .read_alarm with all fields initialized to 0. As
the s35390a driver doesn't touch some fields the returned date is
interpreted as a date in January 1900. So make sure all fields are set
to -1; some of them are then overwritten with the right data depending
on the hardware state.
In mainline this is done by commit d68778b80dd7 ("rtc: initialize output
parameter for read alarm to "uninitialized"") in the core. This is
considered to dangerous for stable as it might have side effects for
other rtc drivers that might for example rely on alarm->time.tm_sec
being initialized to 0.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
drivers/rtc/rtc-s35390a.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 6507a01cf9ad..47b88bbe4ce7 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -267,6 +267,20 @@ static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
char buf[3], sts;
int i, err;
+ /*
+ * initialize all members to -1 to signal the core that they are not
+ * defined by the hardware.
+ */
+ alm->time.tm_sec = -1;
+ alm->time.tm_min = -1;
+ alm->time.tm_hour = -1;
+ alm->time.tm_mday = -1;
+ alm->time.tm_mon = -1;
+ alm->time.tm_year = -1;
+ alm->time.tm_wday = -1;
+ alm->time.tm_yday = -1;
+ alm->time.tm_isdst = -1;
+
err = s35390a_get_reg(s35390a, S35390A_CMD_STATUS2, &sts, sizeof(sts));
if (err < 0)
return err;
--
2.11.0
Back to linux.debian.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bug#854854: qcontrol: reboot/poweroff Uwe Kleine-König <uwe@kleine-koenig.org> - 2017-03-16 09:50 +0100
Bug#854854: AW: Bug#854854: qcontrol: reboot/poweroff "Peter Buechner" <ptrbucr3075@gmail.com> - 2017-03-16 11:00 +0100
Bug#854854: AW: Bug#854854: qcontrol: reboot/poweroff Uwe Kleine-König <uwe@kleine-koenig.org> - 2017-03-16 11:00 +0100
Bug#854854: qcontrol: reboot/poweroff Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-04-03 21:30 +0200
Bug#854854: Cherry pick and backport patches for rtc-s35390a (Was: Bug#854854: qcontrol: reboot/poweroff) Ian Campbell <ijc@debian.org> - 2017-04-19 15:00 +0200
[PATCH 3/4] rtc: s35390a: implement reset routine as suggested by the reference Uwe Kleine-König <uwe@kleine-koenig.org> - 2017-04-03 23:50 +0200
[PATCH 0/4] rtc: s35390a: add fixes from v4.8-rc1 to stable Uwe Kleine-König <uwe@kleine-koenig.org> - 2017-04-03 23:50 +0200
[PATCH 1/4] rtc: s35390a: fix reading out alarm Uwe Kleine-König <uwe@kleine-koenig.org> - 2017-04-04 00:00 +0200
[PATCH 2/4] rtc: s35390a: make sure all members in the output are set Uwe Kleine-König <uwe@kleine-koenig.org> - 2017-04-04 00:00 +0200
[PATCH 4/4] rtc: s35390a: improve irq handling Uwe Kleine-König <uwe@kleine-koenig.org> - 2017-04-04 00:00 +0200
csiph-web