* [PATCH 2/5] rtc: vt8500: remove useless label
2019-10-16 20:16 [PATCH 1/5] rtc: add timestamp for end of 2199 Alexandre Belloni
@ 2019-10-16 20:16 ` Alexandre Belloni
2019-10-16 20:16 ` [PATCH 3/5] rtc: vt8500: remove superfluous error message Alexandre Belloni
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2019-10-16 20:16 UTC (permalink / raw)
To: linux-rtc; +Cc: Tony Prisk, linux-arm-kernel, linux-kernel, Alexandre Belloni
err_return doesn't do anything special, simply return instead of goto.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-vt8500.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c
index 11859b95a9f5..f84e534a8793 100644
--- a/drivers/rtc/rtc-vt8500.c
+++ b/drivers/rtc/rtc-vt8500.c
@@ -225,10 +225,9 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
vt8500_rtc->rtc = devm_rtc_device_register(&pdev->dev, "vt8500-rtc",
&vt8500_rtc_ops, THIS_MODULE);
if (IS_ERR(vt8500_rtc->rtc)) {
- ret = PTR_ERR(vt8500_rtc->rtc);
dev_err(&pdev->dev,
"Failed to register RTC device -> %d\n", ret);
- goto err_return;
+ return PTR_ERR(vt8500_rtc->rtc);
}
ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm,
@@ -236,13 +235,10 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
if (ret < 0) {
dev_err(&pdev->dev, "can't get irq %i, err %d\n",
vt8500_rtc->irq_alarm, ret);
- goto err_return;
+ return ret;
}
return 0;
-
-err_return:
- return ret;
}
static int vt8500_rtc_remove(struct platform_device *pdev)
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/5] rtc: vt8500: remove superfluous error message
2019-10-16 20:16 [PATCH 1/5] rtc: add timestamp for end of 2199 Alexandre Belloni
2019-10-16 20:16 ` [PATCH 2/5] rtc: vt8500: remove useless label Alexandre Belloni
@ 2019-10-16 20:16 ` Alexandre Belloni
2019-10-16 20:16 ` [PATCH 4/5] rtc: vt8500: convert to devm_rtc_allocate_device Alexandre Belloni
2019-10-16 20:16 ` [PATCH 5/5] rtc: vt8500: let the core handle rtc range Alexandre Belloni
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2019-10-16 20:16 UTC (permalink / raw)
To: linux-rtc; +Cc: Tony Prisk, linux-arm-kernel, linux-kernel, Alexandre Belloni
The RTC core now has error messages in case of registration failure, there
is no need to have other messages in the drivers.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-vt8500.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c
index f84e534a8793..c2ab394912bb 100644
--- a/drivers/rtc/rtc-vt8500.c
+++ b/drivers/rtc/rtc-vt8500.c
@@ -224,11 +224,8 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
vt8500_rtc->rtc = devm_rtc_device_register(&pdev->dev, "vt8500-rtc",
&vt8500_rtc_ops, THIS_MODULE);
- if (IS_ERR(vt8500_rtc->rtc)) {
- dev_err(&pdev->dev,
- "Failed to register RTC device -> %d\n", ret);
+ if (IS_ERR(vt8500_rtc->rtc))
return PTR_ERR(vt8500_rtc->rtc);
- }
ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm,
vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc);
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/5] rtc: vt8500: convert to devm_rtc_allocate_device
2019-10-16 20:16 [PATCH 1/5] rtc: add timestamp for end of 2199 Alexandre Belloni
2019-10-16 20:16 ` [PATCH 2/5] rtc: vt8500: remove useless label Alexandre Belloni
2019-10-16 20:16 ` [PATCH 3/5] rtc: vt8500: remove superfluous error message Alexandre Belloni
@ 2019-10-16 20:16 ` Alexandre Belloni
2019-10-16 20:16 ` [PATCH 5/5] rtc: vt8500: let the core handle rtc range Alexandre Belloni
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2019-10-16 20:16 UTC (permalink / raw)
To: linux-rtc; +Cc: Tony Prisk, linux-arm-kernel, linux-kernel, Alexandre Belloni
This allows further improvement of the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-vt8500.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c
index c2ab394912bb..0761478861f8 100644
--- a/drivers/rtc/rtc-vt8500.c
+++ b/drivers/rtc/rtc-vt8500.c
@@ -222,11 +222,12 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
writel(VT8500_RTC_CR_ENABLE,
vt8500_rtc->regbase + VT8500_RTC_CR);
- vt8500_rtc->rtc = devm_rtc_device_register(&pdev->dev, "vt8500-rtc",
- &vt8500_rtc_ops, THIS_MODULE);
+ vt8500_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(vt8500_rtc->rtc))
return PTR_ERR(vt8500_rtc->rtc);
+ vt8500_rtc->rtc->ops = &vt8500_rtc_ops;
+
ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm,
vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc);
if (ret < 0) {
@@ -235,7 +236,7 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
return ret;
}
- return 0;
+ return rtc_register_device(vt8500_rtc->rtc);
}
static int vt8500_rtc_remove(struct platform_device *pdev)
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/5] rtc: vt8500: let the core handle rtc range
2019-10-16 20:16 [PATCH 1/5] rtc: add timestamp for end of 2199 Alexandre Belloni
` (2 preceding siblings ...)
2019-10-16 20:16 ` [PATCH 4/5] rtc: vt8500: convert to devm_rtc_allocate_device Alexandre Belloni
@ 2019-10-16 20:16 ` Alexandre Belloni
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2019-10-16 20:16 UTC (permalink / raw)
To: linux-rtc; +Cc: Tony Prisk, linux-arm-kernel, linux-kernel, Alexandre Belloni
Let the rtc core check the date/time against the RTC range.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-vt8500.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c
index 0761478861f8..e2588625025f 100644
--- a/drivers/rtc/rtc-vt8500.c
+++ b/drivers/rtc/rtc-vt8500.c
@@ -122,12 +122,6 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev);
- if (tm->tm_year < 100) {
- dev_warn(dev, "Only years 2000-2199 are supported by the "
- "hardware!\n");
- return -EINVAL;
- }
-
writel((bin2bcd(tm->tm_year % 100) << DATE_YEAR_S)
| (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S)
| (bin2bcd(tm->tm_mday))
@@ -227,6 +221,8 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
return PTR_ERR(vt8500_rtc->rtc);
vt8500_rtc->rtc->ops = &vt8500_rtc_ops;
+ vt8500_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ vt8500_rtc->rtc->range_max = RTC_TIMESTAMP_END_2199;
ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm,
vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc);
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread