linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] rtc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64
@ 2019-03-20 12:44 Alexandre Belloni
  2019-03-20 12:44 ` [PATCH 2/4] rtc: ps3: convert to SPDX identifier Alexandre Belloni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:44 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni

Call the 64bit versions of rtc_tm time conversion as the PS3 handles 64bit
values.

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

diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
index 347288bff438..bffc5713e16f 100644
--- a/drivers/rtc/rtc-ps3.c
+++ b/drivers/rtc/rtc-ps3.c
@@ -40,16 +40,13 @@ static u64 read_rtc(void)
 
 static int ps3_get_time(struct device *dev, struct rtc_time *tm)
 {
-	rtc_time_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
+	rtc_time64_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
 	return 0;
 }
 
 static int ps3_set_time(struct device *dev, struct rtc_time *tm)
 {
-	unsigned long now;
-
-	rtc_tm_to_time(tm, &now);
-	ps3_os_area_set_rtc_diff(now - read_rtc());
+	ps3_os_area_set_rtc_diff(rtc_tm_to_time64(tm) - read_rtc());
 	return 0;
 }
 
-- 
2.20.1


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

* [PATCH 2/4] rtc: ps3: convert to SPDX identifier
  2019-03-20 12:44 [PATCH 1/4] rtc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
@ 2019-03-20 12:44 ` Alexandre Belloni
  2019-03-20 15:56   ` Geert Uytterhoeven
  2019-04-01  5:46   ` Mukesh Ojha
  2019-03-20 12:44 ` [PATCH 3/4] rtc: ps3: convert to devm_rtc_allocate_device Alexandre Belloni
  2019-03-20 12:44 ` [PATCH 4/4] rtc: ps3: set range Alexandre Belloni
  2 siblings, 2 replies; 6+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:44 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-kernel, 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-ps3.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
index bffc5713e16f..7e2a941a195b 100644
--- a/drivers/rtc/rtc-ps3.c
+++ b/drivers/rtc/rtc-ps3.c
@@ -1,20 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * PS3 RTC Driver
  *
  * Copyright 2009 Sony Corporation
- *
- * 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; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.
- * If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/kernel.h>
@@ -77,6 +65,6 @@ static struct platform_driver ps3_rtc_driver = {
 module_platform_driver_probe(ps3_rtc_driver, ps3_rtc_probe);
 
 MODULE_AUTHOR("Sony Corporation");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("ps3 RTC driver");
 MODULE_ALIAS("platform:rtc-ps3");
-- 
2.20.1


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

* [PATCH 3/4] rtc: ps3: convert to devm_rtc_allocate_device
  2019-03-20 12:44 [PATCH 1/4] rtc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
  2019-03-20 12:44 ` [PATCH 2/4] rtc: ps3: convert to SPDX identifier Alexandre Belloni
@ 2019-03-20 12:44 ` Alexandre Belloni
  2019-03-20 12:44 ` [PATCH 4/4] rtc: ps3: set range Alexandre Belloni
  2 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:44 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni

This allows further improvement of the driver.

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

diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
index 7e2a941a195b..f8b56f3b2529 100644
--- a/drivers/rtc/rtc-ps3.c
+++ b/drivers/rtc/rtc-ps3.c
@@ -47,13 +47,15 @@ static int __init ps3_rtc_probe(struct platform_device *dev)
 {
 	struct rtc_device *rtc;
 
-	rtc = devm_rtc_device_register(&dev->dev, "rtc-ps3", &ps3_rtc_ops,
-				  THIS_MODULE);
+	rtc = devm_rtc_allocate_device(&dev->dev);
 	if (IS_ERR(rtc))
 		return PTR_ERR(rtc);
 
+	rtc->ops = &ps3_rtc_ops;
+
 	platform_set_drvdata(dev, rtc);
-	return 0;
+
+	return rtc_register_device(rtc);
 }
 
 static struct platform_driver ps3_rtc_driver = {
-- 
2.20.1


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

* [PATCH 4/4] rtc: ps3: set range
  2019-03-20 12:44 [PATCH 1/4] rtc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
  2019-03-20 12:44 ` [PATCH 2/4] rtc: ps3: convert to SPDX identifier Alexandre Belloni
  2019-03-20 12:44 ` [PATCH 3/4] rtc: ps3: convert to devm_rtc_allocate_device Alexandre Belloni
@ 2019-03-20 12:44 ` Alexandre Belloni
  2 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2019-03-20 12:44 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni

The PS3 has a 64bit second counter from 2000. While this exceeds the 64bit
UNIX timestamp, there is not doubt that non of them will still be working
by then.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-ps3.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
index f8b56f3b2529..3ee80693f141 100644
--- a/drivers/rtc/rtc-ps3.c
+++ b/drivers/rtc/rtc-ps3.c
@@ -52,6 +52,7 @@ static int __init ps3_rtc_probe(struct platform_device *dev)
 		return PTR_ERR(rtc);
 
 	rtc->ops = &ps3_rtc_ops;
+	rtc->range_max = U64_MAX;
 
 	platform_set_drvdata(dev, rtc);
 
-- 
2.20.1


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

* Re: [PATCH 2/4] rtc: ps3: convert to SPDX identifier
  2019-03-20 12:44 ` [PATCH 2/4] rtc: ps3: convert to SPDX identifier Alexandre Belloni
@ 2019-03-20 15:56   ` Geert Uytterhoeven
  2019-04-01  5:46   ` Mukesh Ojha
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-03-20 15:56 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, Linux Kernel Mailing List

On Wed, Mar 20, 2019 at 1:46 PM 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: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 2/4] rtc: ps3: convert to SPDX identifier
  2019-03-20 12:44 ` [PATCH 2/4] rtc: ps3: convert to SPDX identifier Alexandre Belloni
  2019-03-20 15:56   ` Geert Uytterhoeven
@ 2019-04-01  5:46   ` Mukesh Ojha
  1 sibling, 0 replies; 6+ messages in thread
From: Mukesh Ojha @ 2019-04-01  5:46 UTC (permalink / raw)
  To: Alexandre Belloni, linux-rtc; +Cc: linux-kernel


On 3/20/2019 6:14 PM, Alexandre Belloni 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>
> ---
>   drivers/rtc/rtc-ps3.c | 16 ++--------------
>   1 file changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
> index bffc5713e16f..7e2a941a195b 100644
> --- a/drivers/rtc/rtc-ps3.c
> +++ b/drivers/rtc/rtc-ps3.c
> @@ -1,20 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0


Should we not keep it like.
https://lkml.org/lkml/2019/2/13/570

Cheers,
Mukesh

>   /*
>    * PS3 RTC Driver
>    *
>    * Copyright 2009 Sony Corporation
> - *
> - * 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; version 2 of the License.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program.
> - * If not, see <http://www.gnu.org/licenses/>.
>    */
>   
>   #include <linux/kernel.h>
> @@ -77,6 +65,6 @@ static struct platform_driver ps3_rtc_driver = {
>   module_platform_driver_probe(ps3_rtc_driver, ps3_rtc_probe);
>   
>   MODULE_AUTHOR("Sony Corporation");
> -MODULE_LICENSE("GPL");
> +MODULE_LICENSE("GPL v2");
>   MODULE_DESCRIPTION("ps3 RTC driver");
>   MODULE_ALIAS("platform:rtc-ps3");

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

end of thread, other threads:[~2019-04-01  5:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 12:44 [PATCH 1/4] rtc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
2019-03-20 12:44 ` [PATCH 2/4] rtc: ps3: convert to SPDX identifier Alexandre Belloni
2019-03-20 15:56   ` Geert Uytterhoeven
2019-04-01  5:46   ` Mukesh Ojha
2019-03-20 12:44 ` [PATCH 3/4] rtc: ps3: convert to devm_rtc_allocate_device Alexandre Belloni
2019-03-20 12:44 ` [PATCH 4/4] rtc: ps3: set range Alexandre Belloni

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