* [PATCH 1/8] rtc: ep93xx: stop setting platform_data
@ 2019-04-19 7:59 Alexandre Belloni
2019-04-19 7:59 ` [PATCH 2/8] rtc: ep93xx: convert to devm_rtc_allocate_device Alexandre Belloni
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 7:59 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Since commit 28dc5f803899 ("drivers/rtc/rtc-ep93xx.c: use
dev_get_platdata()"), platform_data is not used directly, it is not
necessary to set it anymore.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ep93xx.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 1932a4f861d1..db04ac445c69 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -28,10 +28,6 @@
#define EP93XX_RTC_SWCOMP_INT_MASK 0x0000ffff
#define EP93XX_RTC_SWCOMP_INT_SHIFT 0
-/*
- * struct device dev.platform_data is used to store our private data
- * because struct rtc_device does not have a variable to hold it.
- */
struct ep93xx_rtc {
void __iomem *mmio_base;
struct rtc_device *rtc;
@@ -140,31 +136,23 @@ static int ep93xx_rtc_probe(struct platform_device *pdev)
if (IS_ERR(ep93xx_rtc->mmio_base))
return PTR_ERR(ep93xx_rtc->mmio_base);
- pdev->dev.platform_data = ep93xx_rtc;
platform_set_drvdata(pdev, ep93xx_rtc);
ep93xx_rtc->rtc = devm_rtc_device_register(&pdev->dev,
pdev->name, &ep93xx_rtc_ops, THIS_MODULE);
- if (IS_ERR(ep93xx_rtc->rtc)) {
- err = PTR_ERR(ep93xx_rtc->rtc);
- goto exit;
- }
+ if (IS_ERR(ep93xx_rtc->rtc))
+ return PTR_ERR(ep93xx_rtc->rtc);
err = sysfs_create_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
if (err)
- goto exit;
+ return err;
return 0;
-
-exit:
- pdev->dev.platform_data = NULL;
- return err;
}
static int ep93xx_rtc_remove(struct platform_device *pdev)
{
sysfs_remove_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
- pdev->dev.platform_data = NULL;
return 0;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/8] rtc: ep93xx: convert to devm_rtc_allocate_device
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
@ 2019-04-19 7:59 ` Alexandre Belloni
2019-04-19 8:00 ` [PATCH 3/8] rtc: ep93xx: use rtc_add_group Alexandre Belloni
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 7:59 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-ep93xx.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index db04ac445c69..f15391bc4597 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -138,11 +138,16 @@ static int ep93xx_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ep93xx_rtc);
- ep93xx_rtc->rtc = devm_rtc_device_register(&pdev->dev,
- pdev->name, &ep93xx_rtc_ops, THIS_MODULE);
+ ep93xx_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(ep93xx_rtc->rtc))
return PTR_ERR(ep93xx_rtc->rtc);
+ ep93xx_rtc->rtc->ops = &ep93xx_rtc_ops;
+
+ err = rtc_register_device(ep93xx_rtc->rtc);
+ if (err)
+ return err;
+
err = sysfs_create_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
if (err)
return err;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/8] rtc: ep93xx: use rtc_add_group
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
2019-04-19 7:59 ` [PATCH 2/8] rtc: ep93xx: convert to devm_rtc_allocate_device Alexandre Belloni
@ 2019-04-19 8:00 ` Alexandre Belloni
2019-04-19 8:00 ` [PATCH 4/8] rtc: ep93xx: set range Alexandre Belloni
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 8:00 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Use rtc_add_group to add the sysfs group in a race free manner.
This has the side effect of moving the files to their proper location.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ep93xx.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index f15391bc4597..27417b4a8095 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -94,7 +94,7 @@ static ssize_t ep93xx_rtc_show_comp_preload(struct device *dev,
{
unsigned short preload;
- ep93xx_rtc_get_swcomp(dev, &preload, NULL);
+ ep93xx_rtc_get_swcomp(dev->parent, &preload, NULL);
return sprintf(buf, "%d\n", preload);
}
@@ -105,7 +105,7 @@ static ssize_t ep93xx_rtc_show_comp_delete(struct device *dev,
{
unsigned short delete;
- ep93xx_rtc_get_swcomp(dev, NULL, &delete);
+ ep93xx_rtc_get_swcomp(dev->parent, NULL, &delete);
return sprintf(buf, "%d\n", delete);
}
@@ -144,22 +144,11 @@ static int ep93xx_rtc_probe(struct platform_device *pdev)
ep93xx_rtc->rtc->ops = &ep93xx_rtc_ops;
- err = rtc_register_device(ep93xx_rtc->rtc);
+ err = rtc_add_group(ep93xx_rtc->rtc, &ep93xx_rtc_sysfs_files);
if (err)
return err;
- err = sysfs_create_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
- if (err)
- return err;
-
- return 0;
-}
-
-static int ep93xx_rtc_remove(struct platform_device *pdev)
-{
- sysfs_remove_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
-
- return 0;
+ return rtc_register_device(ep93xx_rtc->rtc);
}
static struct platform_driver ep93xx_rtc_driver = {
@@ -167,7 +156,6 @@ static struct platform_driver ep93xx_rtc_driver = {
.name = "ep93xx-rtc",
},
.probe = ep93xx_rtc_probe,
- .remove = ep93xx_rtc_remove,
};
module_platform_driver(ep93xx_rtc_driver);
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/8] rtc: ep93xx: set range
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
2019-04-19 7:59 ` [PATCH 2/8] rtc: ep93xx: convert to devm_rtc_allocate_device Alexandre Belloni
2019-04-19 8:00 ` [PATCH 3/8] rtc: ep93xx: use rtc_add_group Alexandre Belloni
@ 2019-04-19 8:00 ` Alexandre Belloni
2019-04-19 8:00 ` [PATCH 5/8] rtc: ep93xx: switch to rtc_time64_to_tm Alexandre Belloni
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 8:00 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
The ep93xx RTC is a 32-bit seconds counter.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ep93xx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 27417b4a8095..32d7b3ec816d 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -143,6 +143,7 @@ static int ep93xx_rtc_probe(struct platform_device *pdev)
return PTR_ERR(ep93xx_rtc->rtc);
ep93xx_rtc->rtc->ops = &ep93xx_rtc_ops;
+ ep93xx_rtc->rtc->range_max = U32_MAX;
err = rtc_add_group(ep93xx_rtc->rtc, &ep93xx_rtc_sysfs_files);
if (err)
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/8] rtc: ep93xx: switch to rtc_time64_to_tm
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
` (2 preceding siblings ...)
2019-04-19 8:00 ` [PATCH 4/8] rtc: ep93xx: set range Alexandre Belloni
@ 2019-04-19 8:00 ` Alexandre Belloni
2019-04-19 8:00 ` [PATCH 6/8] rtc: ep93xx: use .set_time Alexandre Belloni
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 8:00 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Call the 64bit version of rtc_time_to_tm now that the range is enforced by
the core.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ep93xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 32d7b3ec816d..60e390c6ef06 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -59,7 +59,7 @@ static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm)
time = readl(ep93xx_rtc->mmio_base + EP93XX_RTC_DATA);
- rtc_time_to_tm(time, tm);
+ rtc_time64_to_tm(time, tm);
return 0;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/8] rtc: ep93xx: use .set_time
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
` (3 preceding siblings ...)
2019-04-19 8:00 ` [PATCH 5/8] rtc: ep93xx: switch to rtc_time64_to_tm Alexandre Belloni
@ 2019-04-19 8:00 ` Alexandre Belloni
2019-04-19 8:00 ` [PATCH 7/8] rtc: ep93xx: convert to SPDX identifier Alexandre Belloni
2019-04-19 8:00 ` [PATCH 8/8] rtc: ep93xx: fix checkpatch issues Alexandre Belloni
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 8:00 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Use .set_time instead of the deprecated .set_mmss.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ep93xx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 60e390c6ef06..a243bd85b842 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -63,9 +63,10 @@ static int ep93xx_rtc_read_time(struct device *dev, struct rtc_time *tm)
return 0;
}
-static int ep93xx_rtc_set_mmss(struct device *dev, unsigned long secs)
+static int ep93xx_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev);
+ unsigned long secs = rtc_tm_to_time64(tm);
writel(secs + 1, ep93xx_rtc->mmio_base + EP93XX_RTC_LOAD);
return 0;
@@ -85,7 +86,7 @@ static int ep93xx_rtc_proc(struct device *dev, struct seq_file *seq)
static const struct rtc_class_ops ep93xx_rtc_ops = {
.read_time = ep93xx_rtc_read_time,
- .set_mmss = ep93xx_rtc_set_mmss,
+ .set_time = ep93xx_rtc_set_time,
.proc = ep93xx_rtc_proc,
};
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 7/8] rtc: ep93xx: convert to SPDX identifier
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
` (4 preceding siblings ...)
2019-04-19 8:00 ` [PATCH 6/8] rtc: ep93xx: use .set_time Alexandre Belloni
@ 2019-04-19 8:00 ` Alexandre Belloni
2019-04-19 8:00 ` [PATCH 8/8] rtc: ep93xx: fix checkpatch issues Alexandre Belloni
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 8:00 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Use SPDX-License-Identifier instead of a verbose license text.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ep93xx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index a243bd85b842..8dd85d602afd 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -1,12 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* A driver for the RTC embedded in the Cirrus Logic EP93XX processors
* Copyright (c) 2006 Tower Technologies
*
* Author: Alessandro Zummo <a.zummo@towertech.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
#include <linux/module.h>
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 8/8] rtc: ep93xx: fix checkpatch issues
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
` (5 preceding siblings ...)
2019-04-19 8:00 ` [PATCH 7/8] rtc: ep93xx: convert to SPDX identifier Alexandre Belloni
@ 2019-04-19 8:00 ` Alexandre Belloni
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-19 8:00 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Fix sysfs attribute declaration as suggested by checkpatch.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-ep93xx.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 8dd85d602afd..1766496385fe 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -15,10 +15,10 @@
#define EP93XX_RTC_DATA 0x000
#define EP93XX_RTC_MATCH 0x004
#define EP93XX_RTC_STATUS 0x008
-#define EP93XX_RTC_STATUS_INTR (1<<0)
+#define EP93XX_RTC_STATUS_INTR BIT(0)
#define EP93XX_RTC_LOAD 0x00C
#define EP93XX_RTC_CONTROL 0x010
-#define EP93XX_RTC_CONTROL_MIE (1<<0)
+#define EP93XX_RTC_CONTROL_MIE BIT(0)
#define EP93XX_RTC_SWCOMP 0x108
#define EP93XX_RTC_SWCOMP_DEL_MASK 0x001f0000
#define EP93XX_RTC_SWCOMP_DEL_SHIFT 16
@@ -31,7 +31,7 @@ struct ep93xx_rtc {
};
static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload,
- unsigned short *delete)
+ unsigned short *delete)
{
struct ep93xx_rtc *ep93xx_rtc = dev_get_platdata(dev);
unsigned long comp;
@@ -87,8 +87,8 @@ static const struct rtc_class_ops ep93xx_rtc_ops = {
.proc = ep93xx_rtc_proc,
};
-static ssize_t ep93xx_rtc_show_comp_preload(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t comp_preload_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
unsigned short preload;
@@ -96,10 +96,10 @@ static ssize_t ep93xx_rtc_show_comp_preload(struct device *dev,
return sprintf(buf, "%d\n", preload);
}
-static DEVICE_ATTR(comp_preload, S_IRUGO, ep93xx_rtc_show_comp_preload, NULL);
+static DEVICE_ATTR_RO(comp_preload);
-static ssize_t ep93xx_rtc_show_comp_delete(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t comp_delete_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
unsigned short delete;
@@ -107,7 +107,7 @@ static ssize_t ep93xx_rtc_show_comp_delete(struct device *dev,
return sprintf(buf, "%d\n", delete);
}
-static DEVICE_ATTR(comp_delete, S_IRUGO, ep93xx_rtc_show_comp_delete, NULL);
+static DEVICE_ATTR_RO(comp_delete);
static struct attribute *ep93xx_rtc_attrs[] = {
&dev_attr_comp_preload.attr,
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-04-19 20:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-19 7:59 [PATCH 1/8] rtc: ep93xx: stop setting platform_data Alexandre Belloni
2019-04-19 7:59 ` [PATCH 2/8] rtc: ep93xx: convert to devm_rtc_allocate_device Alexandre Belloni
2019-04-19 8:00 ` [PATCH 3/8] rtc: ep93xx: use rtc_add_group Alexandre Belloni
2019-04-19 8:00 ` [PATCH 4/8] rtc: ep93xx: set range Alexandre Belloni
2019-04-19 8:00 ` [PATCH 5/8] rtc: ep93xx: switch to rtc_time64_to_tm Alexandre Belloni
2019-04-19 8:00 ` [PATCH 6/8] rtc: ep93xx: use .set_time Alexandre Belloni
2019-04-19 8:00 ` [PATCH 7/8] rtc: ep93xx: convert to SPDX identifier Alexandre Belloni
2019-04-19 8:00 ` [PATCH 8/8] rtc: ep93xx: fix checkpatch issues 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).