* [PATCH 1/4] rtc: wm831x: set range
@ 2019-03-22 7:16 Alexandre Belloni
2019-03-22 7:16 ` [PATCH 2/4] rtc: wm831x: remove unnecessary goto Alexandre Belloni
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Alexandre Belloni @ 2019-03-22 7:16 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, patches, Alexandre Belloni
The wm831x has a 32bit second counter.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-wm831x.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index 7b824dabf104..deaffe0eaf2f 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -436,12 +436,16 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, 1);
- wm831x_rtc->rtc = devm_rtc_device_register(&pdev->dev, "wm831x",
- &wm831x_rtc_ops, THIS_MODULE);
- if (IS_ERR(wm831x_rtc->rtc)) {
- ret = PTR_ERR(wm831x_rtc->rtc);
- goto err;
- }
+ wm831x_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(wm831x_rtc->rtc))
+ return PTR_ERR(wm831x_rtc->rtc);
+
+ wm831x_rtc->rtc->ops = &wm831x_rtc_ops;
+ wm831x_rtc->rtc->range_max = U32_MAX;
+
+ ret = rtc_register_device(wm831x_rtc->rtc);
+ if (ret)
+ return ret;
ret = devm_request_threaded_irq(&pdev->dev, alm_irq, NULL,
wm831x_alm_irq,
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] rtc: wm831x: remove unnecessary goto
2019-03-22 7:16 [PATCH 1/4] rtc: wm831x: set range Alexandre Belloni
@ 2019-03-22 7:16 ` Alexandre Belloni
2019-03-22 9:36 ` Charles Keepax
2019-03-22 7:16 ` [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Alexandre Belloni @ 2019-03-22 7:16 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, patches, Alexandre Belloni
There is no specific handling in the error path of wm831x_rtc_probe, remove
the unnecessary goto and label.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-wm831x.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index deaffe0eaf2f..1b0c3b3f63e8 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -429,7 +429,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
ret = wm831x_reg_read(wm831x, WM831X_RTC_CONTROL);
if (ret < 0) {
dev_err(&pdev->dev, "Failed to read RTC control: %d\n", ret);
- goto err;
+ return ret;
}
if (ret & WM831X_RTC_ALM_ENA)
wm831x_rtc->alarm_enabled = 1;
@@ -459,9 +459,6 @@ static int wm831x_rtc_probe(struct platform_device *pdev)
wm831x_rtc_add_randomness(wm831x);
return 0;
-
-err:
- return ret;
}
static const struct dev_pm_ops wm831x_rtc_pm_ops = {
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64
2019-03-22 7:16 [PATCH 1/4] rtc: wm831x: set range Alexandre Belloni
2019-03-22 7:16 ` [PATCH 2/4] rtc: wm831x: remove unnecessary goto Alexandre Belloni
@ 2019-03-22 7:16 ` Alexandre Belloni
2019-03-22 9:37 ` Charles Keepax
2019-03-22 7:16 ` [PATCH 4/4] rtc: wm831x: convert to SPDX identifier Alexandre Belloni
2019-03-22 9:36 ` [PATCH 1/4] rtc: wm831x: set range Charles Keepax
3 siblings, 1 reply; 9+ messages in thread
From: Alexandre Belloni @ 2019-03-22 7:16 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, patches, Alexandre Belloni
Call the 64bit versions of rtc_tm time conversion now that the range is
enforced by the core.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-wm831x.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index 1b0c3b3f63e8..d286dd1dfcf9 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -155,7 +155,7 @@ static int wm831x_rtc_readtime(struct device *dev, struct rtc_time *tm)
if (memcmp(time1, time2, sizeof(time1)) == 0) {
u32 time = (time1[0] << 16) | time1[1];
- rtc_time_to_tm(time, tm);
+ rtc_time64_to_tm(time, tm);
return 0;
}
@@ -215,11 +215,7 @@ static int wm831x_rtc_set_mmss(struct device *dev, unsigned long time)
if (ret < 0)
return ret;
- ret = rtc_tm_to_time(&new_tm, &new_time);
- if (ret < 0) {
- dev_err(dev, "Failed to convert time: %d\n", ret);
- return ret;
- }
+ new_time = rtc_tm_to_time64(&new_tm);
/* Allow a second of change in case of tick */
if (new_time - time > 1) {
@@ -249,7 +245,7 @@ static int wm831x_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
time = (data[0] << 16) | data[1];
- rtc_time_to_tm(time, &alrm->time);
+ rtc_time64_to_tm(time, &alrm->time);
ret = wm831x_reg_read(wm831x_rtc->wm831x, WM831X_RTC_CONTROL);
if (ret < 0) {
@@ -288,11 +284,7 @@ static int wm831x_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
int ret;
unsigned long time;
- ret = rtc_tm_to_time(&alrm->time, &time);
- if (ret < 0) {
- dev_err(dev, "Failed to convert time: %d\n", ret);
- return ret;
- }
+ time = rtc_tm_to_time64(&alrm->time);
ret = wm831x_rtc_stop_alarm(wm831x_rtc);
if (ret < 0) {
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] rtc: wm831x: convert to SPDX identifier
2019-03-22 7:16 [PATCH 1/4] rtc: wm831x: set range Alexandre Belloni
2019-03-22 7:16 ` [PATCH 2/4] rtc: wm831x: remove unnecessary goto Alexandre Belloni
2019-03-22 7:16 ` [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
@ 2019-03-22 7:16 ` Alexandre Belloni
2019-03-22 9:37 ` Charles Keepax
2019-03-22 9:36 ` [PATCH 1/4] rtc: wm831x: set range Charles Keepax
3 siblings, 1 reply; 9+ messages in thread
From: Alexandre Belloni @ 2019-03-22 7:16 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, patches, Alexandre Belloni
Use SPDX-License-Identifier instead of a verbose license text.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-wm831x.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index d286dd1dfcf9..6a0defd16088 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
/*
* Real Time Clock driver for Wolfson Microelectronics WM831x
*
@@ -5,11 +6,6 @@
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
*/
#include <linux/module.h>
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] rtc: wm831x: set range
2019-03-22 7:16 [PATCH 1/4] rtc: wm831x: set range Alexandre Belloni
` (2 preceding siblings ...)
2019-03-22 7:16 ` [PATCH 4/4] rtc: wm831x: convert to SPDX identifier Alexandre Belloni
@ 2019-03-22 9:36 ` Charles Keepax
3 siblings, 0 replies; 9+ messages in thread
From: Charles Keepax @ 2019-03-22 9:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, patches
On Fri, Mar 22, 2019 at 08:16:08AM +0100, Alexandre Belloni wrote:
> The wm831x has a 32bit second counter.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] rtc: wm831x: remove unnecessary goto
2019-03-22 7:16 ` [PATCH 2/4] rtc: wm831x: remove unnecessary goto Alexandre Belloni
@ 2019-03-22 9:36 ` Charles Keepax
0 siblings, 0 replies; 9+ messages in thread
From: Charles Keepax @ 2019-03-22 9:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, patches
On Fri, Mar 22, 2019 at 08:16:09AM +0100, Alexandre Belloni wrote:
> There is no specific handling in the error path of wm831x_rtc_probe, remove
> the unnecessary goto and label.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64
2019-03-22 7:16 ` [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
@ 2019-03-22 9:37 ` Charles Keepax
0 siblings, 0 replies; 9+ messages in thread
From: Charles Keepax @ 2019-03-22 9:37 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, patches
On Fri, Mar 22, 2019 at 08:16:10AM +0100, Alexandre Belloni wrote:
> Call the 64bit versions of rtc_tm time conversion now that the range is
> enforced by the core.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] rtc: wm831x: convert to SPDX identifier
2019-03-22 7:16 ` [PATCH 4/4] rtc: wm831x: convert to SPDX identifier Alexandre Belloni
@ 2019-03-22 9:37 ` Charles Keepax
0 siblings, 0 replies; 9+ messages in thread
From: Charles Keepax @ 2019-03-22 9:37 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, patches
On Fri, Mar 22, 2019 at 08:16:11AM +0100, Alexandre Belloni wrote:
> Use SPDX-License-Identifier instead of a verbose license text.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64
2019-03-22 7:13 Alexandre Belloni
@ 2019-03-22 7:13 ` Alexandre Belloni
0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Belloni @ 2019-03-22 7:13 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Call the 64bit versions of rtc_tm time conversion now that the range is
enforced by the core.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-wm831x.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index 1b0c3b3f63e8..d286dd1dfcf9 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -155,7 +155,7 @@ static int wm831x_rtc_readtime(struct device *dev, struct rtc_time *tm)
if (memcmp(time1, time2, sizeof(time1)) == 0) {
u32 time = (time1[0] << 16) | time1[1];
- rtc_time_to_tm(time, tm);
+ rtc_time64_to_tm(time, tm);
return 0;
}
@@ -215,11 +215,7 @@ static int wm831x_rtc_set_mmss(struct device *dev, unsigned long time)
if (ret < 0)
return ret;
- ret = rtc_tm_to_time(&new_tm, &new_time);
- if (ret < 0) {
- dev_err(dev, "Failed to convert time: %d\n", ret);
- return ret;
- }
+ new_time = rtc_tm_to_time64(&new_tm);
/* Allow a second of change in case of tick */
if (new_time - time > 1) {
@@ -249,7 +245,7 @@ static int wm831x_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
time = (data[0] << 16) | data[1];
- rtc_time_to_tm(time, &alrm->time);
+ rtc_time64_to_tm(time, &alrm->time);
ret = wm831x_reg_read(wm831x_rtc->wm831x, WM831X_RTC_CONTROL);
if (ret < 0) {
@@ -288,11 +284,7 @@ static int wm831x_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
int ret;
unsigned long time;
- ret = rtc_tm_to_time(&alrm->time, &time);
- if (ret < 0) {
- dev_err(dev, "Failed to convert time: %d\n", ret);
- return ret;
- }
+ time = rtc_tm_to_time64(&alrm->time);
ret = wm831x_rtc_stop_alarm(wm831x_rtc);
if (ret < 0) {
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-03-22 9:37 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 7:16 [PATCH 1/4] rtc: wm831x: set range Alexandre Belloni
2019-03-22 7:16 ` [PATCH 2/4] rtc: wm831x: remove unnecessary goto Alexandre Belloni
2019-03-22 9:36 ` Charles Keepax
2019-03-22 7:16 ` [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
2019-03-22 9:37 ` Charles Keepax
2019-03-22 7:16 ` [PATCH 4/4] rtc: wm831x: convert to SPDX identifier Alexandre Belloni
2019-03-22 9:37 ` Charles Keepax
2019-03-22 9:36 ` [PATCH 1/4] rtc: wm831x: set range Charles Keepax
-- strict thread matches above, loose matches on Subject: below --
2019-03-22 7:13 Alexandre Belloni
2019-03-22 7:13 ` [PATCH 3/4] rtc: wm831x: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
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.