All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
@ 2015-06-02  9:04 ` Xunlei Pang
  0 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang

From: Xunlei Pang <pang.xunlei@linaro.org>

pcf8563_rtc_set_alarm() uses deprecated rtc_tm_to_time()
and rtc_time_to_tm(), which will overflow in year 2106
on 32-bit machines.

This patch solves this by:
 - Replacing rtc_time_to_tm() with rtc_time64_to_tm()
 - Replacing rtc_tm_to_time() with rtc_tm_to_time64()

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-pcf8563.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 0ba7e59..5f87f84 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -363,13 +363,13 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
 	struct i2c_client *client = to_i2c_client(dev);
 	unsigned char buf[4];
 	int err;
-	unsigned long alarm_time;
 
 	/* The alarm has no seconds, round up to nearest minute */
 	if (tm->time.tm_sec) {
-		rtc_tm_to_time(&tm->time, &alarm_time);
-		alarm_time += 60-tm->time.tm_sec;
-		rtc_time_to_tm(alarm_time, &tm->time);
+		time64_t alarm_time = rtc_tm_to_time64(&tm->time);
+
+		alarm_time += 60 - tm->time.tm_sec;
+		rtc_time64_to_tm(alarm_time, &tm->time);
 	}
 
 	dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d "
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [rtc-linux] [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
@ 2015-06-02  9:04 ` Xunlei Pang
  0 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang

From: Xunlei Pang <pang.xunlei@linaro.org>

pcf8563_rtc_set_alarm() uses deprecated rtc_tm_to_time()
and rtc_time_to_tm(), which will overflow in year 2106
on 32-bit machines.

This patch solves this by:
 - Replacing rtc_time_to_tm() with rtc_time64_to_tm()
 - Replacing rtc_tm_to_time() with rtc_tm_to_time64()

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-pcf8563.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 0ba7e59..5f87f84 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -363,13 +363,13 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
 	struct i2c_client *client = to_i2c_client(dev);
 	unsigned char buf[4];
 	int err;
-	unsigned long alarm_time;
 
 	/* The alarm has no seconds, round up to nearest minute */
 	if (tm->time.tm_sec) {
-		rtc_tm_to_time(&tm->time, &alarm_time);
-		alarm_time += 60-tm->time.tm_sec;
-		rtc_time_to_tm(alarm_time, &tm->time);
+		time64_t alarm_time = rtc_tm_to_time64(&tm->time);
+
+		alarm_time += 60 - tm->time.tm_sec;
+		rtc_time64_to_tm(alarm_time, &tm->time);
 	}
 
 	dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d "
-- 
1.9.1


-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
  2015-06-02  9:04 ` [rtc-linux] " Xunlei Pang
@ 2015-06-02  9:04   ` Xunlei Pang
  -1 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang

From: Xunlei Pang <pang.xunlei@linaro.org>

There're many sites need comparing the two rtc_time variants for many
rtc drivers, especially in the instances of rtc_class_ops::set_alarm().

So add this common helper function to make things easy.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-lib.c | 9 +++++++++
 include/linux/rtc.h   | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c
index e6bfb9c..fdb94cc 100644
--- a/drivers/rtc/rtc-lib.c
+++ b/drivers/rtc/rtc-lib.c
@@ -124,6 +124,15 @@ time64_t rtc_tm_to_time64(struct rtc_time *tm)
 EXPORT_SYMBOL(rtc_tm_to_time64);
 
 /*
+ * rtc_tm_subtract - Return the difference in seconds.
+ */
+time64_t rtc_tm_subtract(struct rtc_time *minuend, struct rtc_time *subtrahend)
+{
+	return rtc_tm_to_time64(minuend) - rtc_tm_to_time64(subtrahend);
+}
+EXPORT_SYMBOL_GPL(rtc_tm_subtract);
+
+/*
  * Convert rtc_time to ktime
  */
 ktime_t rtc_tm_to_ktime(struct rtc_time tm)
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 8dcf682..13e4138 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -21,6 +21,8 @@ extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year
 extern int rtc_valid_tm(struct rtc_time *tm);
 extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
 extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
+extern time64_t rtc_tm_subtract(struct rtc_time *minuend,
+		struct rtc_time *subtrahend);
 ktime_t rtc_tm_to_ktime(struct rtc_time tm);
 struct rtc_time rtc_ktime_to_tm(ktime_t kt);
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [rtc-linux] [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
@ 2015-06-02  9:04   ` Xunlei Pang
  0 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang

From: Xunlei Pang <pang.xunlei@linaro.org>

There're many sites need comparing the two rtc_time variants for many
rtc drivers, especially in the instances of rtc_class_ops::set_alarm().

So add this common helper function to make things easy.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-lib.c | 9 +++++++++
 include/linux/rtc.h   | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c
index e6bfb9c..fdb94cc 100644
--- a/drivers/rtc/rtc-lib.c
+++ b/drivers/rtc/rtc-lib.c
@@ -124,6 +124,15 @@ time64_t rtc_tm_to_time64(struct rtc_time *tm)
 EXPORT_SYMBOL(rtc_tm_to_time64);
 
 /*
+ * rtc_tm_subtract - Return the difference in seconds.
+ */
+time64_t rtc_tm_subtract(struct rtc_time *minuend, struct rtc_time *subtrahend)
+{
+	return rtc_tm_to_time64(minuend) - rtc_tm_to_time64(subtrahend);
+}
+EXPORT_SYMBOL_GPL(rtc_tm_subtract);
+
+/*
  * Convert rtc_time to ktime
  */
 ktime_t rtc_tm_to_ktime(struct rtc_time tm)
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 8dcf682..13e4138 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -21,6 +21,8 @@ extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year
 extern int rtc_valid_tm(struct rtc_time *tm);
 extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
 extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
+extern time64_t rtc_tm_subtract(struct rtc_time *minuend,
+		struct rtc_time *subtrahend);
 ktime_t rtc_tm_to_ktime(struct rtc_time tm);
 struct rtc_time rtc_ktime_to_tm(ktime_t kt);
 
-- 
1.9.1


-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
  2015-06-02  9:04 ` [rtc-linux] " Xunlei Pang
@ 2015-06-02  9:04   ` Xunlei Pang
  -1 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang, Herbert Valerio Riedel

From: Xunlei Pang <pang.xunlei@linaro.org>

isl1208_i2c_set_alarm() uses deprecated rtc_tm_to_time(),
which will overflow in year 2106 on 32-bit machines.

This patch solves this by:
 - Replacing rtc_tm_to_time() with rtc_tm_subtract()

Cc: Herbert Valerio Riedel <hvr@gnu.org>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-isl1208.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index c3c549d..6eb5d36 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -370,22 +370,15 @@ isl1208_i2c_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alarm)
 	struct rtc_time *alarm_tm = &alarm->time;
 	u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, };
 	const int offs = ISL1208_REG_SCA;
-	unsigned long rtc_secs, alarm_secs;
 	struct rtc_time rtc_tm;
 	int err, enable;
 
 	err = isl1208_i2c_read_time(client, &rtc_tm);
 	if (err)
 		return err;
-	err = rtc_tm_to_time(&rtc_tm, &rtc_secs);
-	if (err)
-		return err;
-	err = rtc_tm_to_time(alarm_tm, &alarm_secs);
-	if (err)
-		return err;
 
 	/* If the alarm time is before the current time disable the alarm */
-	if (!alarm->enabled || alarm_secs <= rtc_secs)
+	if (!alarm->enabled || rtc_tm_subtract(alarm_tm, &rtc_tm) <= 0)
 		enable = 0x00;
 	else
 		enable = 0x80;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [rtc-linux] [PATCH v2 3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
@ 2015-06-02  9:04   ` Xunlei Pang
  0 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang, Herbert Valerio Riedel

From: Xunlei Pang <pang.xunlei@linaro.org>

isl1208_i2c_set_alarm() uses deprecated rtc_tm_to_time(),
which will overflow in year 2106 on 32-bit machines.

This patch solves this by:
 - Replacing rtc_tm_to_time() with rtc_tm_subtract()

Cc: Herbert Valerio Riedel <hvr@gnu.org>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-isl1208.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index c3c549d..6eb5d36 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -370,22 +370,15 @@ isl1208_i2c_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alarm)
 	struct rtc_time *alarm_tm = &alarm->time;
 	u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, };
 	const int offs = ISL1208_REG_SCA;
-	unsigned long rtc_secs, alarm_secs;
 	struct rtc_time rtc_tm;
 	int err, enable;
 
 	err = isl1208_i2c_read_time(client, &rtc_tm);
 	if (err)
 		return err;
-	err = rtc_tm_to_time(&rtc_tm, &rtc_secs);
-	if (err)
-		return err;
-	err = rtc_tm_to_time(alarm_tm, &alarm_secs);
-	if (err)
-		return err;
 
 	/* If the alarm time is before the current time disable the alarm */
-	if (!alarm->enabled || alarm_secs <= rtc_secs)
+	if (!alarm->enabled || rtc_tm_subtract(alarm_tm, &rtc_tm) <= 0)
 		enable = 0x00;
 	else
 		enable = 0x80;
-- 
1.9.1


-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 4/4] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()
  2015-06-02  9:04 ` [rtc-linux] " Xunlei Pang
@ 2015-06-02  9:04   ` Xunlei Pang
  -1 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang, Carlo Caione

From: Xunlei Pang <pang.xunlei@linaro.org>

sunxi_rtc_setalarm() uses deprecated rtc_tm_to_time(),
which will overflow in year 2106 on 32-bit machines.

This patch solves this by:
- Replacing rtc_tm_to_time() with rtc_tm_subtract()

Also remove the unnecessary initial zeroing of some
local variables in sunxi_rtc_setalarm().

Cc: Carlo Caione <carlo.caione@gmail.com>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-sunxi.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c
index 6e678fa..ecff5ed 100644
--- a/drivers/rtc/rtc-sunxi.c
+++ b/drivers/rtc/rtc-sunxi.c
@@ -269,14 +269,13 @@ static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
 	struct sunxi_rtc_dev *chip = dev_get_drvdata(dev);
 	struct rtc_time *alrm_tm = &wkalrm->time;
 	struct rtc_time tm_now;
-	u32 alrm = 0;
-	unsigned long time_now = 0;
-	unsigned long time_set = 0;
-	unsigned long time_gap = 0;
-	unsigned long time_gap_day = 0;
-	unsigned long time_gap_hour = 0;
-	unsigned long time_gap_min = 0;
-	int ret = 0;
+	u32 alrm;
+	time64_t diff;
+	unsigned long time_gap;
+	unsigned long time_gap_day;
+	unsigned long time_gap_hour;
+	unsigned long time_gap_min;
+	int ret;
 
 	ret = sunxi_rtc_gettime(dev, &tm_now);
 	if (ret < 0) {
@@ -284,14 +283,18 @@ static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
 		return -EINVAL;
 	}
 
-	rtc_tm_to_time(alrm_tm, &time_set);
-	rtc_tm_to_time(&tm_now, &time_now);
-	if (time_set <= time_now) {
+	diff = rtc_tm_subtract(alrm_tm, &tm_now);
+	if (diff <= 0) {
 		dev_err(dev, "Date to set in the past\n");
 		return -EINVAL;
 	}
 
-	time_gap = time_set - time_now;
+	if (diff > 255 * SEC_IN_DAY) {
+		dev_err(dev, "Day must be in the range 0 - 255\n");
+		return -EINVAL;
+	}
+
+	time_gap = diff;
 	time_gap_day = time_gap / SEC_IN_DAY;
 	time_gap -= time_gap_day * SEC_IN_DAY;
 	time_gap_hour = time_gap / SEC_IN_HOUR;
@@ -299,11 +302,6 @@ static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
 	time_gap_min = time_gap / SEC_IN_MIN;
 	time_gap -= time_gap_min * SEC_IN_MIN;
 
-	if (time_gap_day > 255) {
-		dev_err(dev, "Day must be in the range 0 - 255\n");
-		return -EINVAL;
-	}
-
 	sunxi_rtc_setaie(0, chip);
 	writel(0, chip->base + SUNXI_ALRM_DHMS);
 	usleep_range(100, 300);
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [rtc-linux] [PATCH v2 4/4] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()
@ 2015-06-02  9:04   ` Xunlei Pang
  0 siblings, 0 replies; 20+ messages in thread
From: Xunlei Pang @ 2015-06-02  9:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Alessandro Zummo, Alexandre Belloni, John Stultz,
	Arnd Bergmann, Xunlei Pang, Carlo Caione

From: Xunlei Pang <pang.xunlei@linaro.org>

sunxi_rtc_setalarm() uses deprecated rtc_tm_to_time(),
which will overflow in year 2106 on 32-bit machines.

This patch solves this by:
- Replacing rtc_tm_to_time() with rtc_tm_subtract()

Also remove the unnecessary initial zeroing of some
local variables in sunxi_rtc_setalarm().

Cc: Carlo Caione <carlo.caione@gmail.com>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 drivers/rtc/rtc-sunxi.c | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c
index 6e678fa..ecff5ed 100644
--- a/drivers/rtc/rtc-sunxi.c
+++ b/drivers/rtc/rtc-sunxi.c
@@ -269,14 +269,13 @@ static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
 	struct sunxi_rtc_dev *chip = dev_get_drvdata(dev);
 	struct rtc_time *alrm_tm = &wkalrm->time;
 	struct rtc_time tm_now;
-	u32 alrm = 0;
-	unsigned long time_now = 0;
-	unsigned long time_set = 0;
-	unsigned long time_gap = 0;
-	unsigned long time_gap_day = 0;
-	unsigned long time_gap_hour = 0;
-	unsigned long time_gap_min = 0;
-	int ret = 0;
+	u32 alrm;
+	time64_t diff;
+	unsigned long time_gap;
+	unsigned long time_gap_day;
+	unsigned long time_gap_hour;
+	unsigned long time_gap_min;
+	int ret;
 
 	ret = sunxi_rtc_gettime(dev, &tm_now);
 	if (ret < 0) {
@@ -284,14 +283,18 @@ static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
 		return -EINVAL;
 	}
 
-	rtc_tm_to_time(alrm_tm, &time_set);
-	rtc_tm_to_time(&tm_now, &time_now);
-	if (time_set <= time_now) {
+	diff = rtc_tm_subtract(alrm_tm, &tm_now);
+	if (diff <= 0) {
 		dev_err(dev, "Date to set in the past\n");
 		return -EINVAL;
 	}
 
-	time_gap = time_set - time_now;
+	if (diff > 255 * SEC_IN_DAY) {
+		dev_err(dev, "Day must be in the range 0 - 255\n");
+		return -EINVAL;
+	}
+
+	time_gap = diff;
 	time_gap_day = time_gap / SEC_IN_DAY;
 	time_gap -= time_gap_day * SEC_IN_DAY;
 	time_gap_hour = time_gap / SEC_IN_HOUR;
@@ -299,11 +302,6 @@ static int sunxi_rtc_setalarm(struct device *dev, struct rtc_wkalrm *wkalrm)
 	time_gap_min = time_gap / SEC_IN_MIN;
 	time_gap -= time_gap_min * SEC_IN_MIN;
 
-	if (time_gap_day > 255) {
-		dev_err(dev, "Day must be in the range 0 - 255\n");
-		return -EINVAL;
-	}
-
 	sunxi_rtc_setaie(0, chip);
 	writel(0, chip->base + SUNXI_ALRM_DHMS);
 	usleep_range(100, 300);
-- 
1.9.1


-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
  2015-06-02  9:04 ` [rtc-linux] " Xunlei Pang
@ 2015-06-02 10:26   ` Alexandre Belloni
  -1 siblings, 0 replies; 20+ messages in thread
From: Alexandre Belloni @ 2015-06-02 10:26 UTC (permalink / raw)
  To: Xunlei Pang
  Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
	Arnd Bergmann, Xunlei Pang

Xunlei,

Could you please include a cover letter describing what you are trying
to achieve when sending your series?

You have lot of pending patches (27 in patchwork right now) and until
now, I've pushed back on the reviews because it is really really a pain
to follow what you are sending, resending and dropping.

Also, for some series, you sent multiple v2 in a 3 days interval.

Thanks!

On 02/06/2015 at 17:04:19 +0800, Xunlei Pang wrote :
> From: Xunlei Pang <pang.xunlei@linaro.org>
> 
> pcf8563_rtc_set_alarm() uses deprecated rtc_tm_to_time()
> and rtc_time_to_tm(), which will overflow in year 2106
> on 32-bit machines.
> 
> This patch solves this by:
>  - Replacing rtc_time_to_tm() with rtc_time64_to_tm()
>  - Replacing rtc_tm_to_time() with rtc_tm_to_time64()
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
> ---
>  drivers/rtc/rtc-pcf8563.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
> index 0ba7e59..5f87f84 100644
> --- a/drivers/rtc/rtc-pcf8563.c
> +++ b/drivers/rtc/rtc-pcf8563.c
> @@ -363,13 +363,13 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
>  	struct i2c_client *client = to_i2c_client(dev);
>  	unsigned char buf[4];
>  	int err;
> -	unsigned long alarm_time;
>  
>  	/* The alarm has no seconds, round up to nearest minute */
>  	if (tm->time.tm_sec) {
> -		rtc_tm_to_time(&tm->time, &alarm_time);
> -		alarm_time += 60-tm->time.tm_sec;
> -		rtc_time_to_tm(alarm_time, &tm->time);
> +		time64_t alarm_time = rtc_tm_to_time64(&tm->time);
> +
> +		alarm_time += 60 - tm->time.tm_sec;
> +		rtc_time64_to_tm(alarm_time, &tm->time);
>  	}
>  
>  	dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d "
> -- 
> 1.9.1
> 
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [rtc-linux] Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
@ 2015-06-02 10:26   ` Alexandre Belloni
  0 siblings, 0 replies; 20+ messages in thread
From: Alexandre Belloni @ 2015-06-02 10:26 UTC (permalink / raw)
  To: Xunlei Pang
  Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
	Arnd Bergmann, Xunlei Pang

Xunlei,

Could you please include a cover letter describing what you are trying
to achieve when sending your series?

You have lot of pending patches (27 in patchwork right now) and until
now, I've pushed back on the reviews because it is really really a pain
to follow what you are sending, resending and dropping.

Also, for some series, you sent multiple v2 in a 3 days interval.

Thanks!

On 02/06/2015 at 17:04:19 +0800, Xunlei Pang wrote :
> From: Xunlei Pang <pang.xunlei@linaro.org>
> 
> pcf8563_rtc_set_alarm() uses deprecated rtc_tm_to_time()
> and rtc_time_to_tm(), which will overflow in year 2106
> on 32-bit machines.
> 
> This patch solves this by:
>  - Replacing rtc_time_to_tm() with rtc_time64_to_tm()
>  - Replacing rtc_tm_to_time() with rtc_tm_to_time64()
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
> ---
>  drivers/rtc/rtc-pcf8563.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
> index 0ba7e59..5f87f84 100644
> --- a/drivers/rtc/rtc-pcf8563.c
> +++ b/drivers/rtc/rtc-pcf8563.c
> @@ -363,13 +363,13 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
>  	struct i2c_client *client = to_i2c_client(dev);
>  	unsigned char buf[4];
>  	int err;
> -	unsigned long alarm_time;
>  
>  	/* The alarm has no seconds, round up to nearest minute */
>  	if (tm->time.tm_sec) {
> -		rtc_tm_to_time(&tm->time, &alarm_time);
> -		alarm_time += 60-tm->time.tm_sec;
> -		rtc_time_to_tm(alarm_time, &tm->time);
> +		time64_t alarm_time = rtc_tm_to_time64(&tm->time);
> +
> +		alarm_time += 60 - tm->time.tm_sec;
> +		rtc_time64_to_tm(alarm_time, &tm->time);
>  	}
>  
>  	dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d "
> -- 
> 1.9.1
> 
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
  2015-06-02 10:26   ` [rtc-linux] " Alexandre Belloni
@ 2015-06-02 15:23     ` pang.xunlei
  -1 siblings, 0 replies; 20+ messages in thread
From: pang.xunlei @ 2015-06-02 15:23 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux

Hi Alexandre,

Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote 2015-06-02 
PM 06:26:39:
> Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated 
> rtc_time_to_tm() and rtc_tm_to_time()
> 
> Xunlei,
> 
> Could you please include a cover letter describing what you are trying
> to achieve when sending your series?
> 
> You have lot of pending patches (27 in patchwork right now) and until
> now, I've pushed back on the reviews because it is really really a pain
> to follow what you are sending, resending and dropping.
> 
> Also, for some series, you sent multiple v2 in a 3 days interval.

Apologies for the spamming, please ignore all those former 27 pending 
patches.

I'll re-organize them with a cover letter, will resend them as new ones 
tomorrow.

Regards,
-Xunlei
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [rtc-linux] Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
@ 2015-06-02 15:23     ` pang.xunlei
  0 siblings, 0 replies; 20+ messages in thread
From: pang.xunlei @ 2015-06-02 15:23 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux

Hi Alexandre,

Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote 2015-06-02=
=20
PM 06:26:39:
> Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated=20
> rtc_time_to_tm() and rtc_tm_to_time()
>=20
> Xunlei,
>=20
> Could you please include a cover letter describing what you are trying
> to achieve when sending your series?
>=20
> You have lot of pending patches (27 in patchwork right now) and until
> now, I've pushed back on the reviews because it is really really a pain
> to follow what you are sending, resending and dropping.
>=20
> Also, for some series, you sent multiple v2 in a 3 days interval.

Apologies for the spamming, please ignore all those former 27 pending=20
patches.

I'll re-organize them with a cover letter, will resend them as new ones=20
tomorrow.

Regards,
-Xunlei
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (an=
d any attachment transmitted herewith) is privileged and confidential and i=
s intended for the exclusive use of the addressee(s).  If you are not an in=
tended recipient, any disclosure, reproduction, distribution or other disse=
mination or use of the information contained is strictly prohibited.  If yo=
u have received this mail in error, please delete it and notify us immediat=
ely.
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (an=
d any attachment transmitted herewith) is privileged and confidential and i=
s intended for the exclusive use of the addressee(s).  If you are not an in=
tended recipient, any disclosure, reproduction, distribution or other disse=
mination or use of the information contained is strictly prohibited.  If yo=
u have received this mail in error, please delete it and notify us immediat=
ely.

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
  2015-06-02 15:23     ` [rtc-linux] " pang.xunlei
@ 2015-06-02 16:41       ` Alexandre Belloni
  -1 siblings, 0 replies; 20+ messages in thread
From: Alexandre Belloni @ 2015-06-02 16:41 UTC (permalink / raw)
  To: pang.xunlei
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux

On 03/06/2015 at 00:23:40 +0900, pang.xunlei@zte.com.cn wrote :
> Apologies for the spamming, please ignore all those former 27 pending 
> patches.
> 
> I'll re-organize them with a cover letter, will resend them as new ones 
> tomorrow.
> 

Or maybe, instead of resending, you can give me the status of those
patches:
415468 [RFC,2/4] rtc: Convert rtc_class_ops.set_mmss() to use time64_t
415470 [RFC,3/4] rtc/lib: Provide interfaces to map between 32bit hardware and 64bit time
428475 [RFC,v2,2/9] time: Provide y2106 safe get_seconds() replacement
431162 [1/3] time: Don't bother to run rtc_resume() for nonstop clocksource
431649 [1/5] drivers/rtc/interface.c: Update code to use y2038-safe time interfaces
431650 [2/5] drivers/rtc/rtc-dev.c: Update code to use y2038-safe time interfaces
431798 [v2,3/3] time: clocksource: Add a comment to CLOCK_SOURCE_SUSPEND_NONSTOP
434592 [v3,1/2] time: Don't bother to run rtc_resume() for the nonstop clocksource
448780 [5/8] ARM: tegra: clock: Provide y2038-safe tegra_read_persistent_clock() replacement
448782 [6/8] ARM: time: Provide read_boot_clock64() and read_persistent_clock64()
448781 [7/8] s390: time: Provide read_boot_clock64() and read_persistent_clock64()
448783 [8/8] time: Remove read_boot_clock()

You just sent those so I guess I still have to review them:
477947 [RESEND,1/3] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
477949 [RESEND,2/3] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
477948 [RESEND,3/3] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()
479350 [v2,1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
479348 [v2,2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
479351 [v2,3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
479349 [v2,4/4] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()
479360 [v2,1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
479359 [v2,2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC
479358 [v2,3/4] drivers/rtc/interface.c: Remove rtc_set_mmss()
479357 [v2,4/4] cris: time: Cleanup of persistent clock stuff

Many thanks for your work.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [rtc-linux] Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
@ 2015-06-02 16:41       ` Alexandre Belloni
  0 siblings, 0 replies; 20+ messages in thread
From: Alexandre Belloni @ 2015-06-02 16:41 UTC (permalink / raw)
  To: pang.xunlei
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux

On 03/06/2015 at 00:23:40 +0900, pang.xunlei@zte.com.cn wrote :
> Apologies for the spamming, please ignore all those former 27 pending 
> patches.
> 
> I'll re-organize them with a cover letter, will resend them as new ones 
> tomorrow.
> 

Or maybe, instead of resending, you can give me the status of those
patches:
415468 [RFC,2/4] rtc: Convert rtc_class_ops.set_mmss() to use time64_t
415470 [RFC,3/4] rtc/lib: Provide interfaces to map between 32bit hardware and 64bit time
428475 [RFC,v2,2/9] time: Provide y2106 safe get_seconds() replacement
431162 [1/3] time: Don't bother to run rtc_resume() for nonstop clocksource
431649 [1/5] drivers/rtc/interface.c: Update code to use y2038-safe time interfaces
431650 [2/5] drivers/rtc/rtc-dev.c: Update code to use y2038-safe time interfaces
431798 [v2,3/3] time: clocksource: Add a comment to CLOCK_SOURCE_SUSPEND_NONSTOP
434592 [v3,1/2] time: Don't bother to run rtc_resume() for the nonstop clocksource
448780 [5/8] ARM: tegra: clock: Provide y2038-safe tegra_read_persistent_clock() replacement
448782 [6/8] ARM: time: Provide read_boot_clock64() and read_persistent_clock64()
448781 [7/8] s390: time: Provide read_boot_clock64() and read_persistent_clock64()
448783 [8/8] time: Remove read_boot_clock()

You just sent those so I guess I still have to review them:
477947 [RESEND,1/3] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
477949 [RESEND,2/3] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
477948 [RESEND,3/3] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()
479350 [v2,1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
479348 [v2,2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
479351 [v2,3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
479349 [v2,4/4] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()
479360 [v2,1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP synchronization
479359 [v2,2/4] sparc: time: Replace update_persistent_clock() with CONFIG_RTC_SYSTOHC
479358 [v2,3/4] drivers/rtc/interface.c: Remove rtc_set_mmss()
479357 [v2,4/4] cris: time: Cleanup of persistent clock stuff

Many thanks for your work.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
  2015-06-02 16:41       ` [rtc-linux] " Alexandre Belloni
@ 2015-06-03  1:19         ` pang.xunlei
  -1 siblings, 0 replies; 20+ messages in thread
From: pang.xunlei @ 2015-06-03  1:19 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux

Hi Alexandre,

Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote 2015-06-03 
AM 12:41:25:
> Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated 
> rtc_time_to_tm() and rtc_tm_to_time()
> 
> On 03/06/2015 at 00:23:40 +0900, pang.xunlei@zte.com.cn wrote :
> > Apologies for the spamming, please ignore all those former 27 pending 
> > patches.
> > 
> > I'll re-organize them with a cover letter, will resend them as new 
ones 
> > tomorrow.
> > 
> 
> Or maybe, instead of resending, you can give me the status of those
> patches:

Ok, I'll use a cover letter in future ones like so.

> 415468 [RFC,2/4] rtc: Convert rtc_class_ops.set_mmss() to use time64_t
> 415470 [RFC,3/4] rtc/lib: Provide interfaces to map between 32bit 
> hardware and 64bit time
> 428475 [RFC,v2,2/9] time: Provide y2106 safe get_seconds() replacement
> 431162 [1/3] time: Don't bother to run rtc_resume() for nonstop 
clocksource
> 431649 [1/5] drivers/rtc/interface.c: Update code to use y2038-safe 
> time interfaces
> 431650 [2/5] drivers/rtc/rtc-dev.c: Update code to use y2038-safe 
> time interfaces
> 431798 [v2,3/3] time: clocksource: Add a comment to 
> CLOCK_SOURCE_SUSPEND_NONSTOP
> 434592 [v3,1/2] time: Don't bother to run rtc_resume() for the 
> nonstop clocksource
> 448780 [5/8] ARM: tegra: clock: Provide y2038-safe 
> tegra_read_persistent_clock() replacement
> 448782 [6/8] ARM: time: Provide read_boot_clock64() and 
> read_persistent_clock64()
> 448781 [7/8] s390: time: Provide read_boot_clock64() and 
> read_persistent_clock64()
> 448783 [8/8] time: Remove read_boot_clock()

The above had already been merged into upstream, at least I can see them
in tip/master now.

> 
> You just sent those so I guess I still have to review them:
> 477947 [RESEND,1/3] drivers/rtc/pcf8563: Replace deprecated 
> rtc_time_to_tm() and rtc_tm_to_time()
> 477949 [RESEND,2/3] drivers/rtc/isl1208: Replace deprecated 
rtc_tm_to_time()
> 477948 [RESEND,3/3] drivers/rtc/sunxi: Replace deprecated 
rtc_tm_to_time()


Patch series below is about replacing deprecated 
rtc_tm_to_time()/rtc_time_to_tm()
mostly in rtc drivers with their y2038-safe substitutes 
rtc_tm_to_time64()/
rtc_time64_to_tm() which were merged into upstream last year.

> 479350 [v2,1/4] drivers/rtc/pcf8563: Replace deprecated 
> rtc_time_to_tm() and rtc_tm_to_time()
> 479348 [v2,2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
> 479351 [v2,3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
> 479349 [v2,4/4] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()

And in the following one, I want to replace all the xxx_persistent_clock()
architecture implementations with xxx_persistent_clock64() or simply 
remove
it if can(mainly for rtc-related persistent clock).

> 479360 [v2,1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP 
> synchronization
> 479359 [v2,2/4] sparc: time: Replace update_persistent_clock() with 
> CONFIG_RTC_SYSTOHC
> 479358 [v2,3/4] drivers/rtc/interface.c: Remove rtc_set_mmss()
> 479357 [v2,4/4] cris: time: Cleanup of persistent clock stuff
> 
> Many thanks for your work.

I think you can only review the two v2 series :-)

-Xunlei

--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [rtc-linux] Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time()
@ 2015-06-03  1:19         ` pang.xunlei
  0 siblings, 0 replies; 20+ messages in thread
From: pang.xunlei @ 2015-06-03  1:19 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux

Hi Alexandre,

Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote 2015-06-03=
=20
AM 12:41:25:
> Re: [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated=20
> rtc_time_to_tm() and rtc_tm_to_time()
>=20
> On 03/06/2015 at 00:23:40 +0900, pang.xunlei@zte.com.cn wrote :
> > Apologies for the spamming, please ignore all those former 27 pending=
=20
> > patches.
> >=20
> > I'll re-organize them with a cover letter, will resend them as new=20
ones=20
> > tomorrow.
> >=20
>=20
> Or maybe, instead of resending, you can give me the status of those
> patches:

Ok, I'll use a cover letter in future ones like so.

> 415468 [RFC,2/4] rtc: Convert rtc_class_ops.set_mmss() to use time64_t
> 415470 [RFC,3/4] rtc/lib: Provide interfaces to map between 32bit=20
> hardware and 64bit time
> 428475 [RFC,v2,2/9] time: Provide y2106 safe get_seconds() replacement
> 431162 [1/3] time: Don't bother to run rtc_resume() for nonstop=20
clocksource
> 431649 [1/5] drivers/rtc/interface.c: Update code to use y2038-safe=20
> time interfaces
> 431650 [2/5] drivers/rtc/rtc-dev.c: Update code to use y2038-safe=20
> time interfaces
> 431798 [v2,3/3] time: clocksource: Add a comment to=20
> CLOCK_SOURCE_SUSPEND_NONSTOP
> 434592 [v3,1/2] time: Don't bother to run rtc_resume() for the=20
> nonstop clocksource
> 448780 [5/8] ARM: tegra: clock: Provide y2038-safe=20
> tegra_read_persistent_clock() replacement
> 448782 [6/8] ARM: time: Provide read_boot_clock64() and=20
> read_persistent_clock64()
> 448781 [7/8] s390: time: Provide read_boot_clock64() and=20
> read_persistent_clock64()
> 448783 [8/8] time: Remove read_boot_clock()

The above had already been merged into upstream, at least I can see them
in tip/master now.

>=20
> You just sent those so I guess I still have to review them:
> 477947 [RESEND,1/3] drivers/rtc/pcf8563: Replace deprecated=20
> rtc_time_to_tm() and rtc_tm_to_time()
> 477949 [RESEND,2/3] drivers/rtc/isl1208: Replace deprecated=20
rtc_tm_to_time()
> 477948 [RESEND,3/3] drivers/rtc/sunxi: Replace deprecated=20
rtc_tm_to_time()


Patch series below is about replacing deprecated=20
rtc_tm_to_time()/rtc_time_to_tm()
mostly in rtc drivers with their y2038-safe substitutes=20
rtc_tm_to_time64()/
rtc_time64_to_tm() which were merged into upstream last year.

> 479350 [v2,1/4] drivers/rtc/pcf8563: Replace deprecated=20
> rtc_time_to_tm() and rtc_tm_to_time()
> 479348 [v2,2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
> 479351 [v2,3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time()
> 479349 [v2,4/4] drivers/rtc/sunxi: Replace deprecated rtc_tm_to_time()

And in the following one, I want to replace all the xxx_persistent_clock()
architecture implementations with xxx_persistent_clock64() or simply=20
remove
it if can(mainly for rtc-related persistent clock).

> 479360 [v2,1/4] NTP: rtc: Add CONFIG_RTC_SYSTOHC_DEVICE for NTP=20
> synchronization
> 479359 [v2,2/4] sparc: time: Replace update_persistent_clock() with=20
> CONFIG_RTC_SYSTOHC
> 479358 [v2,3/4] drivers/rtc/interface.c: Remove rtc_set_mmss()
> 479357 [v2,4/4] cris: time: Cleanup of persistent clock stuff
>=20
> Many thanks for your work.

I think you can only review the two v2 series :-)

-Xunlei

--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (an=
d any attachment transmitted herewith) is privileged and confidential and i=
s intended for the exclusive use of the addressee(s).  If you are not an in=
tended recipient, any disclosure, reproduction, distribution or other disse=
mination or use of the information contained is strictly prohibited.  If yo=
u have received this mail in error, please delete it and notify us immediat=
ely.
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (an=
d any attachment transmitted herewith) is privileged and confidential and i=
s intended for the exclusive use of the addressee(s).  If you are not an in=
tended recipient, any disclosure, reproduction, distribution or other disse=
mination or use of the information contained is strictly prohibited.  If yo=
u have received this mail in error, please delete it and notify us immediat=
ely.

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
  2015-06-02  9:04   ` [rtc-linux] " Xunlei Pang
@ 2015-06-11 17:06     ` Alexandre Belloni
  -1 siblings, 0 replies; 20+ messages in thread
From: Alexandre Belloni @ 2015-06-11 17:06 UTC (permalink / raw)
  To: Xunlei Pang
  Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
	Arnd Bergmann, Xunlei Pang

Hi,

I'm fine with the whole series, I would just rename things a bit:

On 02/06/2015 at 17:04:20 +0800, Xunlei Pang wrote :
>  /*
> + * rtc_tm_subtract - Return the difference in seconds.
> + */
> +time64_t rtc_tm_subtract(struct rtc_time *minuend, struct rtc_time *subtrahend)
> +{
> +	return rtc_tm_to_time64(minuend) - rtc_tm_to_time64(subtrahend);
> +}
> +EXPORT_SYMBOL_GPL(rtc_tm_subtract);
> +
> +/*
>   * Convert rtc_time to ktime
>   */
>  ktime_t rtc_tm_to_ktime(struct rtc_time tm)
> diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> index 8dcf682..13e4138 100644
> --- a/include/linux/rtc.h
> +++ b/include/linux/rtc.h
> @@ -21,6 +21,8 @@ extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year
>  extern int rtc_valid_tm(struct rtc_time *tm);
>  extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
>  extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
> +extern time64_t rtc_tm_subtract(struct rtc_time *minuend,
> +		struct rtc_time *subtrahend);

I would use something closer to what is done for timespecs in time.h,
like:

static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs)
{
	return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
}

and not modify rtc-lib.c

Can you make that modification ?

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [rtc-linux] Re: [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
@ 2015-06-11 17:06     ` Alexandre Belloni
  0 siblings, 0 replies; 20+ messages in thread
From: Alexandre Belloni @ 2015-06-11 17:06 UTC (permalink / raw)
  To: Xunlei Pang
  Cc: linux-kernel, rtc-linux, Alessandro Zummo, John Stultz,
	Arnd Bergmann, Xunlei Pang

Hi,

I'm fine with the whole series, I would just rename things a bit:

On 02/06/2015 at 17:04:20 +0800, Xunlei Pang wrote :
>  /*
> + * rtc_tm_subtract - Return the difference in seconds.
> + */
> +time64_t rtc_tm_subtract(struct rtc_time *minuend, struct rtc_time *subtrahend)
> +{
> +	return rtc_tm_to_time64(minuend) - rtc_tm_to_time64(subtrahend);
> +}
> +EXPORT_SYMBOL_GPL(rtc_tm_subtract);
> +
> +/*
>   * Convert rtc_time to ktime
>   */
>  ktime_t rtc_tm_to_ktime(struct rtc_time tm)
> diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> index 8dcf682..13e4138 100644
> --- a/include/linux/rtc.h
> +++ b/include/linux/rtc.h
> @@ -21,6 +21,8 @@ extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year
>  extern int rtc_valid_tm(struct rtc_time *tm);
>  extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
>  extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
> +extern time64_t rtc_tm_subtract(struct rtc_time *minuend,
> +		struct rtc_time *subtrahend);

I would use something closer to what is done for timespecs in time.h,
like:

static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time *rhs)
{
	return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
}

and not modify rtc-lib.c

Can you make that modification ?

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
  2015-06-11 17:06     ` [rtc-linux] " Alexandre Belloni
@ 2015-06-12  1:54       ` pang.xunlei
  -1 siblings, 0 replies; 20+ messages in thread
From: pang.xunlei @ 2015-06-12  1:54 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux, Xunlei Pang

Hi Alexandre,

Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote 2015-06-12 
AM 01:06:19:
> Re: [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
> 
> Hi,
> 
> I'm fine with the whole series, I would just rename things a bit:
> 
> On 02/06/2015 at 17:04:20 +0800, Xunlei Pang wrote :
> >  /*
> > + * rtc_tm_subtract - Return the difference in seconds.
> > + */
> > +time64_t rtc_tm_subtract(struct rtc_time *minuend, struct 
> rtc_time *subtrahend)
> > +{
> > +   return rtc_tm_to_time64(minuend) - rtc_tm_to_time64(subtrahend);
> > +}
> > +EXPORT_SYMBOL_GPL(rtc_tm_subtract);
> > +
> > +/*
> >   * Convert rtc_time to ktime
> >   */
> >  ktime_t rtc_tm_to_ktime(struct rtc_time tm)
> > diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> > index 8dcf682..13e4138 100644
> > --- a/include/linux/rtc.h
> > +++ b/include/linux/rtc.h
> > @@ -21,6 +21,8 @@ extern int rtc_year_days(unsigned int day, 
> unsigned int month, unsigned int year
> >  extern int rtc_valid_tm(struct rtc_time *tm);
> >  extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
> >  extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
> > +extern time64_t rtc_tm_subtract(struct rtc_time *minuend,
> > +      struct rtc_time *subtrahend);
> 
> I would use something closer to what is done for timespecs in time.h,
> like:
> 
> static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time 
*rhs)
> {
>    return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
> }
> 
> and not modify rtc-lib.c
> 
> Can you make that modification ?

OK, I like this as well, will do.

Thanks,
-Xunlei

--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (and any attachment transmitted herewith) is privileged and confidential and is intended for the exclusive use of the addressee(s).  If you are not an intended recipient, any disclosure, reproduction, distribution or other dissemination or use of the information contained is strictly prohibited.  If you have received this mail in error, please delete it and notify us immediately.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [rtc-linux] Re: [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
@ 2015-06-12  1:54       ` pang.xunlei
  0 siblings, 0 replies; 20+ messages in thread
From: pang.xunlei @ 2015-06-12  1:54 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Alessandro Zummo, Arnd Bergmann, John Stultz, linux-kernel,
	Xunlei Pang, rtc-linux, Xunlei Pang

Hi Alexandre,

Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote 2015-06-12=
=20
AM 01:06:19:
> Re: [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function
>=20
> Hi,
>=20
> I'm fine with the whole series, I would just rename things a bit:
>=20
> On 02/06/2015 at 17:04:20 +0800, Xunlei Pang wrote :
> >  /*
> > + * rtc_tm_subtract - Return the difference in seconds.
> > + */
> > +time64_t rtc_tm_subtract(struct rtc_time *minuend, struct=20
> rtc_time *subtrahend)
> > +{
> > +   return rtc_tm_to_time64(minuend) - rtc_tm_to_time64(subtrahend);
> > +}
> > +EXPORT_SYMBOL_GPL(rtc_tm_subtract);
> > +
> > +/*
> >   * Convert rtc_time to ktime
> >   */
> >  ktime_t rtc_tm_to_ktime(struct rtc_time tm)
> > diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> > index 8dcf682..13e4138 100644
> > --- a/include/linux/rtc.h
> > +++ b/include/linux/rtc.h
> > @@ -21,6 +21,8 @@ extern int rtc_year_days(unsigned int day,=20
> unsigned int month, unsigned int year
> >  extern int rtc_valid_tm(struct rtc_time *tm);
> >  extern time64_t rtc_tm_to_time64(struct rtc_time *tm);
> >  extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
> > +extern time64_t rtc_tm_subtract(struct rtc_time *minuend,
> > +      struct rtc_time *subtrahend);
>=20
> I would use something closer to what is done for timespecs in time.h,
> like:
>=20
> static inline time64_t rtc_tm_sub(struct rtc_time *lhs, struct rtc_time=
=20
*rhs)
> {
>    return rtc_tm_to_time64(lhs) - rtc_tm_to_time64(rhs);
> }
>=20
> and not modify rtc-lib.c
>=20
> Can you make that modification ?

OK, I like this as well, will do.

Thanks,
-Xunlei

--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (an=
d any attachment transmitted herewith) is privileged and confidential and i=
s intended for the exclusive use of the addressee(s).  If you are not an in=
tended recipient, any disclosure, reproduction, distribution or other disse=
mination or use of the information contained is strictly prohibited.  If yo=
u have received this mail in error, please delete it and notify us immediat=
ely.
--------------------------------------------------------
ZTE Information Security Notice: The information contained in this mail (an=
d any attachment transmitted herewith) is privileged and confidential and i=
s intended for the exclusive use of the addressee(s).  If you are not an in=
tended recipient, any disclosure, reproduction, distribution or other disse=
mination or use of the information contained is strictly prohibited.  If yo=
u have received this mail in error, please delete it and notify us immediat=
ely.

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2015-06-12  1:55 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-02  9:04 [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time() Xunlei Pang
2015-06-02  9:04 ` [rtc-linux] " Xunlei Pang
2015-06-02  9:04 ` [PATCH v2 2/4] rtc/lib: Introduce rtc_tm_subtract() helper function Xunlei Pang
2015-06-02  9:04   ` [rtc-linux] " Xunlei Pang
2015-06-11 17:06   ` Alexandre Belloni
2015-06-11 17:06     ` [rtc-linux] " Alexandre Belloni
2015-06-12  1:54     ` pang.xunlei
2015-06-12  1:54       ` [rtc-linux] " pang.xunlei
2015-06-02  9:04 ` [PATCH v2 3/4] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time() Xunlei Pang
2015-06-02  9:04   ` [rtc-linux] " Xunlei Pang
2015-06-02  9:04 ` [PATCH v2 4/4] drivers/rtc/sunxi: " Xunlei Pang
2015-06-02  9:04   ` [rtc-linux] " Xunlei Pang
2015-06-02 10:26 ` [PATCH v2 1/4] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time() Alexandre Belloni
2015-06-02 10:26   ` [rtc-linux] " Alexandre Belloni
2015-06-02 15:23   ` pang.xunlei
2015-06-02 15:23     ` [rtc-linux] " pang.xunlei
2015-06-02 16:41     ` Alexandre Belloni
2015-06-02 16:41       ` [rtc-linux] " Alexandre Belloni
2015-06-03  1:19       ` pang.xunlei
2015-06-03  1:19         ` [rtc-linux] " pang.xunlei

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.