Thread (4 messages) 4 messages, 3 authors, 2017-11-09

Re: [PATCH v2 2/2] rtc: sprd: Add Spreadtrum RTC driver

From: Alexandre Belloni <hidden>
Date: 2017-11-09 01:27:14
Also in: linux-rtc, lkml

Hi,

On 08/11/2017 at 17:16:15 +0800, Baolin Wang wrote:
+static int sprd_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+	struct sprd_rtc *rtc = dev_get_drvdata(dev);
+	time64_t secs;
+	int ret;
+
I would have expected a check for SPRD_RTC_POWER_RESET_FLAG here.

+	ret = sprd_rtc_get_secs(rtc, SPRD_RTC_TIME, &secs);
+	if (ret)
+		return ret;
+
+	rtc_time64_to_tm(secs, tm);
+	return rtc_valid_tm(tm);
+}
+
+static int sprd_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+	struct sprd_rtc *rtc = dev_get_drvdata(dev);
+	time64_t secs = rtc_tm_to_time64(tm);
+
And you need to reset SPRD_RTC_POWER_RESET_FLAG here
+	return sprd_rtc_set_secs(rtc, SPRD_RTC_TIME, secs);
+}
+
-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help