* [PATCH v2 4/6] rtc: parisc: provide rtc_class_ops directly
[not found] <1461707551-1337971-1-git-send-email-arnd@arndb.de>
@ 2016-04-26 21:52 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-04-26 21:52 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Arnd Bergmann, geert, deller, benh, mpe, dalias, dhowells,
linux-alpha, a.zummo, linux-kernel, linux-parisc, linuxppc-dev,
linux-sh, linux-m68k, rtc-linux, linux-arch
The rtc-generic driver provides an architecture specific
wrapper on top of the generic rtc_class_ops abstraction,
and on pa-risc, that is implemented using an open-coded
version of rtc_time_to_tm/rtc_tm_to_time.
This changes the parisc rtc-generic device to provide its
rtc_class_ops directly, using the normal helper functions,
which makes this y2038 safe (on 32-bit) and simplifies
the implementation.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/parisc/kernel/time.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 58dd6801f5be..1338d92fc87b 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -12,6 +12,7 @@
*/
#include <linux/errno.h>
#include <linux/module.h>
+#include <linux/rtc.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
@@ -248,14 +249,47 @@ void __init start_cpu_itimer(void)
per_cpu(cpu_data, cpu).it_value = next_tick;
}
+#ifdef CONFIG_RTC_DRV_GENERIC
+static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm)
+{
+ struct pdc_tod tod_data;
+
+ memset(tm, 0, sizeof(*tm));
+ if (pdc_tod_read(&tod_data) < 0)
+ return -EOPNOTSUPP;
+
+ /* we treat tod_sec as unsigned, so this can work until year 2106 */
+ rtc_time64_to_tm(tod_data.tod_sec, &tm);
+ return rtc_valid_tm(tm);
+}
+
+static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm)
+{
+ time64_t secs = rtc_tm_to_time64(tm);
+
+ if (pdc_tod_set(secs, 0) < 0)
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
+static const struct rtc_class_ops rtc_generic_ops = {
+ .read_time = rtc_generic_get_time,
+ .set_time = rtc_generic_set_time,
+};
+
static int __init rtc_init(void)
{
struct platform_device *pdev;
- pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
+ pdev = platform_device_register_data(NULL, "rtc-generic", -1,
+ &rtc_generic_ops,
+ sizeof(rtc_generic_ops));
+
return PTR_ERR_OR_ZERO(pdev);
}
device_initcall(rtc_init);
+#endif
void read_persistent_clock(struct timespec *ts)
{
--
2.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 4/6] rtc: parisc: provide rtc_class_ops directly
[not found] <1461707551-1337971-5-git-send-email-arnd@arndb.de>
@ 2016-04-27 0:22 ` kbuild test robot
2016-04-27 10:10 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2016-04-27 0:22 UTC (permalink / raw)
Cc: kbuild-all, Alexandre Belloni, Arnd Bergmann, geert, deller, benh,
mpe, dalias, dhowells, linux-alpha, a.zummo, linux-kernel,
linux-parisc, linuxppc-dev, linux-sh, linux-m68k, rtc-linux,
linux-arch
[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]
Hi,
[auto build test ERROR on next-20160426]
[cannot apply to m68k/for-next abelloni/rtc-next v4.6-rc5 v4.6-rc4 v4.6-rc3 v4.6-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Arnd-Bergmann/simplify-rtc-generic-driver/20160427-055751
config: parisc-c3000_defconfig (attached as .config)
compiler: hppa-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=parisc
Note: the linux-review/Arnd-Bergmann/simplify-rtc-generic-driver/20160427-055751 HEAD ba518829eb442ee7f7806864a806fa45791f787f builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
arch/parisc/kernel/time.c: In function 'rtc_generic_get_time':
>> arch/parisc/kernel/time.c:262:37: error: passing argument 2 of 'rtc_time64_to_tm' from incompatible pointer type [-Werror=incompatible-pointer-types]
rtc_time64_to_tm(tod_data.tod_sec, &tm);
^
In file included from arch/parisc/kernel/time.c:15:0:
include/linux/rtc.h:23:13: note: expected 'struct rtc_time *' but argument is of type 'struct rtc_time **'
extern void rtc_time64_to_tm(time64_t time, struct rtc_time *tm);
^
cc1: some warnings being treated as errors
vim +/rtc_time64_to_tm +262 arch/parisc/kernel/time.c
256
257 memset(tm, 0, sizeof(*tm));
258 if (pdc_tod_read(&tod_data) < 0)
259 return -EOPNOTSUPP;
260
261 /* we treat tod_sec as unsigned, so this can work until year 2106 */
> 262 rtc_time64_to_tm(tod_data.tod_sec, &tm);
263 return rtc_valid_tm(tm);
264 }
265
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 14216 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 4/6] rtc: parisc: provide rtc_class_ops directly
2016-04-27 0:22 ` [PATCH v2 4/6] rtc: parisc: provide rtc_class_ops directly kbuild test robot
@ 2016-04-27 10:10 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-04-27 10:10 UTC (permalink / raw)
To: linuxppc-dev
Cc: kbuild test robot, linux-arch, a.zummo, dalias, linux-parisc,
linux-sh, deller, linux-alpha, linux-kernel, dhowells, linux-m68k,
geert, kbuild-all, rtc-linux, Alexandre Belloni
On Wednesday 27 April 2016 08:22:24 kbuild test robot wrote:
>
> 256
> 257 memset(tm, 0, sizeof(*tm));
> 258 if (pdc_tod_read(&tod_data) < 0)
> 259 return -EOPNOTSUPP;
> 260
> 261 /* we treat tod_sec as unsigned, so this can work until year 2106 */
> > 262 rtc_time64_to_tm(tod_data.tod_sec, &tm);
> 263 return rtc_valid_tm(tm);
> 264 }
>
Fixed, thanks!
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-27 10:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1461707551-1337971-5-git-send-email-arnd@arndb.de>
2016-04-27 0:22 ` [PATCH v2 4/6] rtc: parisc: provide rtc_class_ops directly kbuild test robot
2016-04-27 10:10 ` Arnd Bergmann
[not found] <1461707551-1337971-1-git-send-email-arnd@arndb.de>
2016-04-26 21:52 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox