linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] rtc: mv: convert to SPDX identifier
@ 2019-03-15 13:35 Alexandre Belloni
  2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-03-15 13:35 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-arm-kernel, Gregory Clement, Alexandre Belloni

Use SPDX-License-Identifier instead of a verbose license text.

The original text refers to version 2 so also update MODULE_LICENSE() to
"GPL v2" instead of "GPL".

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-mv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index e7f14bd12fe3..d13d06ea6709 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -1,9 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Driver for the RTC in Marvell SoCs.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
  */
 
 #include <linux/init.h>
@@ -322,5 +319,5 @@ module_platform_driver_probe(mv_rtc_driver, mv_rtc_probe);
 
 MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>");
 MODULE_DESCRIPTION("Marvell RTC driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:rtc-mv");
-- 
2.20.1


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

* [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device
  2019-03-15 13:35 [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
@ 2019-03-15 13:35 ` Alexandre Belloni
  2019-03-15 13:42   ` Gregory CLEMENT
  2019-03-15 13:35 ` [PATCH 3/3] rtc: mv: add range Alexandre Belloni
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Alexandre Belloni @ 2019-03-15 13:35 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-arm-kernel, Gregory Clement, Alexandre Belloni

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-mv.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index d13d06ea6709..ef704aef8663 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -254,15 +254,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pdata);
 
-	if (pdata->irq >= 0) {
-		device_init_wakeup(&pdev->dev, 1);
-		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-						 &mv_rtc_alarm_ops,
-						 THIS_MODULE);
-	} else {
-		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-						 &mv_rtc_ops, THIS_MODULE);
-	}
+	pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(pdata->rtc)) {
 		ret = PTR_ERR(pdata->rtc);
 		goto out;
@@ -278,7 +270,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
 		}
 	}
 
-	return 0;
+	if (pdata->irq >= 0) {
+		device_init_wakeup(&pdev->dev, 1);
+		pdata->rtc->ops = &mv_rtc_alarm_ops;
+	} else {
+		pdata->rtc->ops = &mv_rtc_ops;
+	}
+
+	ret = rtc_register_device(pdata->rtc);
+	if (!ret)
+		return 0;
 out:
 	if (!IS_ERR(pdata->clk))
 		clk_disable_unprepare(pdata->clk);
-- 
2.20.1


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

* [PATCH 3/3] rtc: mv: add range
  2019-03-15 13:35 [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
  2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
@ 2019-03-15 13:35 ` Alexandre Belloni
  2019-03-15 13:49   ` Gregory CLEMENT
  2019-03-15 13:35 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Alexandre Belloni @ 2019-03-15 13:35 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-arm-kernel, Gregory Clement, Alexandre Belloni

This RTC handles time from 2000-01-01 00:00:00 to 2099-12-31 23:59:59 with
a weird rollover to 2000-06-23 00:00:00.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-mv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index ef704aef8663..e357a0b3f612 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -57,7 +57,7 @@ static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm)
 
 	rtc_reg = (bin2bcd(tm->tm_mday) << RTC_MDAY_OFFS) |
 		(bin2bcd(tm->tm_mon + 1) << RTC_MONTH_OFFS) |
-		(bin2bcd(tm->tm_year % 100) << RTC_YEAR_OFFS);
+		(bin2bcd(tm->tm_year - 100) << RTC_YEAR_OFFS);
 	writel(rtc_reg, ioaddr + RTC_DATE_REG_OFFS);
 
 	return 0;
@@ -156,7 +156,7 @@ static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 			<< RTC_MONTH_OFFS;
 
 	if (alm->time.tm_year >= 0)
-		rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year % 100))
+		rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year - 100))
 			<< RTC_YEAR_OFFS;
 
 	writel(rtc_reg, ioaddr + RTC_ALARM_DATE_REG_OFFS);
@@ -277,6 +277,9 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
 		pdata->rtc->ops = &mv_rtc_ops;
 	}
 
+	pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+	pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
+
 	ret = rtc_register_device(pdata->rtc);
 	if (!ret)
 		return 0;
-- 
2.20.1


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

* [PATCH 1/3] rtc: mv: convert to SPDX identifier
  2019-03-15 13:35 [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
  2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
  2019-03-15 13:35 ` [PATCH 3/3] rtc: mv: add range Alexandre Belloni
@ 2019-03-15 13:35 ` Alexandre Belloni
  2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
  2019-03-15 13:41 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Gregory CLEMENT
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-03-15 13:35 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-arm-kernel, Gregory Clement, Alexandre Belloni

Use SPDX-License-Identifier instead of a verbose license text.

The original text refers to version 2 so also update MODULE_LICENSE() to
"GPL v2" instead of "GPL".

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-mv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index e7f14bd12fe3..d13d06ea6709 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -1,9 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Driver for the RTC in Marvell SoCs.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
  */
 
 #include <linux/init.h>
@@ -322,5 +319,5 @@ module_platform_driver_probe(mv_rtc_driver, mv_rtc_probe);
 
 MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>");
 MODULE_DESCRIPTION("Marvell RTC driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:rtc-mv");
-- 
2.20.1


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

* [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device
  2019-03-15 13:35 [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
                   ` (2 preceding siblings ...)
  2019-03-15 13:35 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
@ 2019-03-15 13:35 ` Alexandre Belloni
  2019-03-15 13:41 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Gregory CLEMENT
  4 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-03-15 13:35 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-arm-kernel, Gregory Clement, Alexandre Belloni

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-mv.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index d13d06ea6709..ef704aef8663 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -254,15 +254,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pdata);
 
-	if (pdata->irq >= 0) {
-		device_init_wakeup(&pdev->dev, 1);
-		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-						 &mv_rtc_alarm_ops,
-						 THIS_MODULE);
-	} else {
-		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-						 &mv_rtc_ops, THIS_MODULE);
-	}
+	pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(pdata->rtc)) {
 		ret = PTR_ERR(pdata->rtc);
 		goto out;
@@ -278,7 +270,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
 		}
 	}
 
-	return 0;
+	if (pdata->irq >= 0) {
+		device_init_wakeup(&pdev->dev, 1);
+		pdata->rtc->ops = &mv_rtc_alarm_ops;
+	} else {
+		pdata->rtc->ops = &mv_rtc_ops;
+	}
+
+	ret = rtc_register_device(pdata->rtc);
+	if (!ret)
+		return 0;
 out:
 	if (!IS_ERR(pdata->clk))
 		clk_disable_unprepare(pdata->clk);
-- 
2.20.1


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

* Re: [PATCH 1/3] rtc: mv: convert to SPDX identifier
  2019-03-15 13:35 [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
                   ` (3 preceding siblings ...)
  2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
@ 2019-03-15 13:41 ` Gregory CLEMENT
  4 siblings, 0 replies; 8+ messages in thread
From: Gregory CLEMENT @ 2019-03-15 13:41 UTC (permalink / raw)
  To: Alexandre Belloni, linux-rtc; +Cc: Alexandre Belloni, linux-arm-kernel

Hi Alexandre,
 
 On ven., mars 15 2019, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:

> Use SPDX-License-Identifier instead of a verbose license text.
>
> The original text refers to version 2 so also update MODULE_LICENSE() to
> "GPL v2" instead of "GPL".
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>

Thanks,

Gregory

> ---
>  drivers/rtc/rtc-mv.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
> index e7f14bd12fe3..d13d06ea6709 100644
> --- a/drivers/rtc/rtc-mv.c
> +++ b/drivers/rtc/rtc-mv.c
> @@ -1,9 +1,6 @@
> +// SPDX-License-Identifier: GPL-2.0
>  /*
>   * Driver for the RTC in Marvell SoCs.
> - *
> - * This file is licensed under the terms of the GNU General Public
> - * License version 2.  This program is licensed "as is" without any
> - * warranty of any kind, whether express or implied.
>   */
>  
>  #include <linux/init.h>
> @@ -322,5 +319,5 @@ module_platform_driver_probe(mv_rtc_driver, mv_rtc_probe);
>  
>  MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>");
>  MODULE_DESCRIPTION("Marvell RTC driver");
> -MODULE_LICENSE("GPL");
> +MODULE_LICENSE("GPL v2");
>  MODULE_ALIAS("platform:rtc-mv");
> -- 
> 2.20.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

* Re: [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device
  2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
@ 2019-03-15 13:42   ` Gregory CLEMENT
  0 siblings, 0 replies; 8+ messages in thread
From: Gregory CLEMENT @ 2019-03-15 13:42 UTC (permalink / raw)
  To: Alexandre Belloni, linux-rtc; +Cc: Alexandre Belloni, linux-arm-kernel

Hi Alexandre,
 
 On ven., mars 15 2019, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:

> This allows further improvement of the driver.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>

on Armada XP GP

Thanks,

Gregory

> ---
>  drivers/rtc/rtc-mv.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
> index d13d06ea6709..ef704aef8663 100644
> --- a/drivers/rtc/rtc-mv.c
> +++ b/drivers/rtc/rtc-mv.c
> @@ -254,15 +254,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pdata);
>  
> -	if (pdata->irq >= 0) {
> -		device_init_wakeup(&pdev->dev, 1);
> -		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
> -						 &mv_rtc_alarm_ops,
> -						 THIS_MODULE);
> -	} else {
> -		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
> -						 &mv_rtc_ops, THIS_MODULE);
> -	}
> +	pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
>  	if (IS_ERR(pdata->rtc)) {
>  		ret = PTR_ERR(pdata->rtc);
>  		goto out;
> @@ -278,7 +270,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	return 0;
> +	if (pdata->irq >= 0) {
> +		device_init_wakeup(&pdev->dev, 1);
> +		pdata->rtc->ops = &mv_rtc_alarm_ops;
> +	} else {
> +		pdata->rtc->ops = &mv_rtc_ops;
> +	}
> +
> +	ret = rtc_register_device(pdata->rtc);
> +	if (!ret)
> +		return 0;
>  out:
>  	if (!IS_ERR(pdata->clk))
>  		clk_disable_unprepare(pdata->clk);
> -- 
> 2.20.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

* Re: [PATCH 3/3] rtc: mv: add range
  2019-03-15 13:35 ` [PATCH 3/3] rtc: mv: add range Alexandre Belloni
@ 2019-03-15 13:49   ` Gregory CLEMENT
  0 siblings, 0 replies; 8+ messages in thread
From: Gregory CLEMENT @ 2019-03-15 13:49 UTC (permalink / raw)
  To: Alexandre Belloni, linux-rtc; +Cc: Alexandre Belloni, linux-arm-kernel

Hi Alexandre,
 
 On ven., mars 15 2019, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:

> This RTC handles time from 2000-01-01 00:00:00 to 2099-12-31 23:59:59 with
> a weird rollover to 2000-06-23 00:00:00.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>

on Armada XP GP

Thanks,

Gregory

> ---
>  drivers/rtc/rtc-mv.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
> index ef704aef8663..e357a0b3f612 100644
> --- a/drivers/rtc/rtc-mv.c
> +++ b/drivers/rtc/rtc-mv.c
> @@ -57,7 +57,7 @@ static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  
>  	rtc_reg = (bin2bcd(tm->tm_mday) << RTC_MDAY_OFFS) |
>  		(bin2bcd(tm->tm_mon + 1) << RTC_MONTH_OFFS) |
> -		(bin2bcd(tm->tm_year % 100) << RTC_YEAR_OFFS);
> +		(bin2bcd(tm->tm_year - 100) << RTC_YEAR_OFFS);
>  	writel(rtc_reg, ioaddr + RTC_DATE_REG_OFFS);
>  
>  	return 0;
> @@ -156,7 +156,7 @@ static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
>  			<< RTC_MONTH_OFFS;
>  
>  	if (alm->time.tm_year >= 0)
> -		rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year % 100))
> +		rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year - 100))
>  			<< RTC_YEAR_OFFS;
>  
>  	writel(rtc_reg, ioaddr + RTC_ALARM_DATE_REG_OFFS);
> @@ -277,6 +277,9 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
>  		pdata->rtc->ops = &mv_rtc_ops;
>  	}
>  
> +	pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
> +	pdata->rtc->range_max = RTC_TIMESTAMP_END_2099;
> +
>  	ret = rtc_register_device(pdata->rtc);
>  	if (!ret)
>  		return 0;
> -- 
> 2.20.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

end of thread, other threads:[~2019-03-15 13:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 13:35 [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
2019-03-15 13:42   ` Gregory CLEMENT
2019-03-15 13:35 ` [PATCH 3/3] rtc: mv: add range Alexandre Belloni
2019-03-15 13:49   ` Gregory CLEMENT
2019-03-15 13:35 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Alexandre Belloni
2019-03-15 13:35 ` [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Alexandre Belloni
2019-03-15 13:41 ` [PATCH 1/3] rtc: mv: convert to SPDX identifier Gregory CLEMENT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).