Skip to contentSkip to conversation

rtc: mv: convert to SPDX identifier

PATCH In review Alexandre Belloni 2 participants 8 messages Mar 15, 2019 Real time clock (RTC)

lore
Share & tools
lore

Alexandre Belloni

author maintainer
#0 lore raw

PATCH 1/3 rtc: mv: convert to SPDX identifier

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".

---
 drivers/rtc/rtc-mv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/rtc/rtc-mv.c +2 -5
index e7f14bd12fe3..d13d06ea6709 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("Marvell RTC driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:rtc-mv");
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 1/3 rtc: mv: convert to SPDX identifier

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".

---
 drivers/rtc/rtc-mv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/rtc/rtc-mv.c +2 -5
index e7f14bd12fe3..d13d06ea6709 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("Marvell RTC driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:rtc-mv");
Signature · 1 line
2.20.1
author maintainer
#2 lore raw

PATCH 2/3 rtc: mv: convert to devm_rtc_allocate_device

In reply to Alexandre Belloni

This allows further improvement of the driver.

---
 drivers/rtc/rtc-mv.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/rtc/rtc-mv.c +11 -10
index d13d06ea6709..ef704aef8663 100644
@@ -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);
Signature · 1 line
2.20.1
Tested-by on v1 2/3
#3 lore raw

Re: [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device

Hi Alexandre,

Quoted 3 lines · Alexandre Belloni

This allows further improvement of the driver.

on Armada XP GP

Thanks,

Gregory

Quoted 51 lines
---
 drivers/rtc/rtc-mv.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/rtc/rtc-mv.c +11 -10
index d13d06ea6709..ef704aef8663 100644
@@ -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);
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
author maintainer
#4 lore raw

PATCH 2/3 rtc: mv: convert to devm_rtc_allocate_device

In reply to Alexandre Belloni

This allows further improvement of the driver.

---
 drivers/rtc/rtc-mv.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/rtc/rtc-mv.c +11 -10
index d13d06ea6709..ef704aef8663 100644
@@ -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);
Signature · 1 line
2.20.1
author maintainer
#5 lore raw

PATCH 3/3 rtc: mv: add range

In reply to 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.

---
 drivers/rtc/rtc-mv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/rtc/rtc-mv.c +5 -2
index ef704aef8663..e357a0b3f612 100644
@@ -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;
Signature · 1 line
2.20.1
Tested-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] rtc: mv: add range

Hi Alexandre,

Quoted 4 lines · 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.

on Armada XP GP

Thanks,

Gregory

Quoted 44 lines
---
 drivers/rtc/rtc-mv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/rtc/rtc-mv.c +5 -2
index ef704aef8663..e357a0b3f612 100644
@@ -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;
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com
Reviewed-by on v1 1/3
#7 lore raw
In reply to Alexandre Belloni

Hi Alexandre,

Quoted 6 lines · 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".

Thanks,

Gregory

Quoted 34 lines
---
 drivers/rtc/rtc-mv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/rtc/rtc-mv.c +2 -5
index e7f14bd12fe3..d13d06ea6709 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("Marvell RTC driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:rtc-mv");
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com