diff mbox

[2/2] rtc: sa1100: add 2038 year constraint for set_time

Message ID 1352378494-23942-2-git-send-email-liangs@marvell.com
State Rejected
Headers show

Commit Message

Leo Song Nov. 8, 2012, 12:41 p.m. UTC
From: Yi Zhang <yizhang@marvell.com>

Change-Id: I77780c9f7143b0a6522d4f9092d1fc53d03ee3e1
Signed-off-by: Yi Zhang <yizhang@marvell.com>
---
 drivers/rtc/rtc-sa1100.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Leo Song Nov. 8, 2012, 12:50 p.m. UTC | #1
Hi Alessandro,

Would you please help to review and merge these two patches for rtc-sa1100.c?

[PATCH 1/2] rtc: sa1100: enable clk and request irq when probe
[PATCH 2/2] rtc: sa1100: add 2038 year constraint for set_time

Thanks a lot.

Best Wishes, 
  
Leo Song
Tel: 6194-9745, Marvell (Shanghai)
B3-F4-4D12, No. 399 of Keyuan Rd, Pudong District, Shanghai 


>-----Original Message-----
>From: Leo Song [mailto:liangs@marvell.com]
>Sent: 2012年11月8日 20:42
>To: Alessandro Zummo; rtc-linux@googlegroups.com
>Cc: Leo Song; Yi Zhang
>Subject: [PATCH 2/2] rtc: sa1100: add 2038 year constraint for set_time
>
>From: Yi Zhang <yizhang@marvell.com>
>
>Change-Id: I77780c9f7143b0a6522d4f9092d1fc53d03ee3e1
>Signed-off-by: Yi Zhang <yizhang@marvell.com>
>---
> drivers/rtc/rtc-sa1100.c |    6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
>diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
>index 25ac904..54a7b65 100644
>--- a/drivers/rtc/rtc-sa1100.c
>+++ b/drivers/rtc/rtc-sa1100.c
>@@ -34,6 +34,7 @@
> #include <linux/pm.h>
> #include <linux/bitops.h>
> #include <linux/io.h>
>+#include <linux/delay.h>
>
> #include <mach/hardware.h>
> #include <mach/irqs.h>
>@@ -126,9 +127,14 @@ static int sa1100_rtc_set_time(struct device *dev,
>struct rtc_time *tm)
> 	unsigned long time;
> 	int ret;
>
>+	if (tm->tm_year > 138)
>+		return -EINVAL;
>+
> 	ret = rtc_tm_to_time(tm, &time);
> 	if (ret == 0)
> 		RCNR = time;
>+
>+	udelay(200);
> 	return ret;
> }
>
>--
>1.7.5.4
diff mbox

Patch

diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 25ac904..54a7b65 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -34,6 +34,7 @@ 
 #include <linux/pm.h>
 #include <linux/bitops.h>
 #include <linux/io.h>
+#include <linux/delay.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -126,9 +127,14 @@  static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	unsigned long time;
 	int ret;
 
+	if (tm->tm_year > 138)
+		return -EINVAL;
+
 	ret = rtc_tm_to_time(tm, &time);
 	if (ret == 0)
 		RCNR = time;
+
+	udelay(200);
 	return ret;
 }