2019-03-20 12:45:56

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 1/4] rtc: ps3: switch to rtc_time64_to_tm/rtc_tm_to_time64

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

Signed-off-by: Alexandre Belloni <[email protected]>
---
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



2019-03-20 12:46:16

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 4/4] rtc: ps3: set range

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 <[email protected]>
---
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


2019-03-20 12:47:23

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 2/4] rtc: ps3: 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".

Signed-off-by: Alexandre Belloni <[email protected]>
---
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


2019-03-20 12:47:30

by Alexandre Belloni

[permalink] [raw]
Subject: [PATCH 3/4] rtc: ps3: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <[email protected]>
---
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


2019-03-20 15:57:22

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 2/4] rtc: ps3: convert to SPDX identifier

On Wed, Mar 20, 2019 at 1:46 PM Alexandre Belloni
<[email protected]> 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 <[email protected]>

Reviewed-by: Geert Uytterhoeven <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

2019-04-01 05:47:54

by Mukesh Ojha

[permalink] [raw]
Subject: Re: [PATCH 2/4] rtc: ps3: convert to SPDX identifier


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 <[email protected]>
> ---
> 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");