All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alexandre Belloni
	<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	deller-Mmb7MZpHnFY@public.gmane.org,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org,
	mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org,
	dalias-8zAoT0mYgF4@public.gmane.org,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v4 07/16] rtc: parisc: provide rtc_class_ops directly
Date: Mon, 30 May 2016 18:57:55 +0000	[thread overview]
Message-ID: <1464634684-1248135-8-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1464634684-1248135-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>

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 +++++++++++++++++++++++++++++++++++-
 drivers/rtc/rtc-generic.c |  3 +--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 58dd6801f5be..744878789752 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;
 }
 
+#if IS_ENABLED(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)
 {
diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c
index 3958e87a05fa..92b5e02a3750 100644
--- a/drivers/rtc/rtc-generic.c
+++ b/drivers/rtc/rtc-generic.c
@@ -9,8 +9,7 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 
-#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \
-    defined(CONFIG_PPC)
+#if defined(CONFIG_M68K) || defined(CONFIG_PPC)
 #include <asm/rtc.h>
 
 static int generic_get_time(struct device *dev, struct rtc_time *tm)
-- 
2.7.0


WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Alexandre Belloni
	<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	deller-Mmb7MZpHnFY@public.gmane.org,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org,
	mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org,
	dalias-8zAoT0mYgF4@public.gmane.org,
	dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v4 07/16] rtc: parisc: provide rtc_class_ops directly
Date: Mon, 30 May 2016 20:57:55 +0200	[thread overview]
Message-ID: <1464634684-1248135-8-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1464634684-1248135-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>

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-r2nGTMty4D4@public.gmane.org>
---
 arch/parisc/kernel/time.c | 36 +++++++++++++++++++++++++++++++++++-
 drivers/rtc/rtc-generic.c |  3 +--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 58dd6801f5be..744878789752 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;
 }
 
+#if IS_ENABLED(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)
 {
diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c
index 3958e87a05fa..92b5e02a3750 100644
--- a/drivers/rtc/rtc-generic.c
+++ b/drivers/rtc/rtc-generic.c
@@ -9,8 +9,7 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 
-#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \
-    defined(CONFIG_PPC)
+#if defined(CONFIG_M68K) || defined(CONFIG_PPC)
 #include <asm/rtc.h>
 
 static int generic_get_time(struct device *dev, struct rtc_time *tm)
-- 
2.7.0

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	geert@linux-m68k.org, gregkh@linuxfoundation.org, deller@gmx.de,
	benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org,
	dhowells@redhat.com, linux-alpha@vger.kernel.org,
	a.zummo@towertech.it, linux-kernel@vger.kernel.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-sh@vger.kernel.org, linux-m68k@vger.kernel.org,
	rtc-linux@googlegroups.com, linux-arch@vger.kernel.org
Subject: [PATCH v4 07/16] rtc: parisc: provide rtc_class_ops directly
Date: Mon, 30 May 2016 20:57:55 +0200	[thread overview]
Message-ID: <1464634684-1248135-8-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1464634684-1248135-1-git-send-email-arnd@arndb.de>

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 +++++++++++++++++++++++++++++++++++-
 drivers/rtc/rtc-generic.c |  3 +--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 58dd6801f5be..744878789752 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;
 }
 
+#if IS_ENABLED(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)
 {
diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c
index 3958e87a05fa..92b5e02a3750 100644
--- a/drivers/rtc/rtc-generic.c
+++ b/drivers/rtc/rtc-generic.c
@@ -9,8 +9,7 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 
-#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \
-    defined(CONFIG_PPC)
+#if defined(CONFIG_M68K) || defined(CONFIG_PPC)
 #include <asm/rtc.h>
 
 static int generic_get_time(struct device *dev, struct rtc_time *tm)
-- 
2.7.0

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	geert@linux-m68k.org, gregkh@linuxfoundation.org, deller@gmx.de,
	benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org,
	dhowells@redhat.com, linux-alpha@vger.kernel.org,
	a.zummo@towertech.it, linux-kernel@vger.kernel.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	rtc-linux@googlegroups.com, linux-arch@vger.kernel.org
Subject: [rtc-linux] [PATCH v4 07/16] rtc: parisc: provide rtc_class_ops directly
Date: Mon, 30 May 2016 20:57:55 +0200	[thread overview]
Message-ID: <1464634684-1248135-8-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1464634684-1248135-1-git-send-email-arnd@arndb.de>

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 +++++++++++++++++++++++++++++++++++-
 drivers/rtc/rtc-generic.c |  3 +--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 58dd6801f5be..744878789752 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;
 }
 
+#if IS_ENABLED(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)
 {
diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c
index 3958e87a05fa..92b5e02a3750 100644
--- a/drivers/rtc/rtc-generic.c
+++ b/drivers/rtc/rtc-generic.c
@@ -9,8 +9,7 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 
-#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \
-    defined(CONFIG_PPC)
+#if defined(CONFIG_M68K) || defined(CONFIG_PPC)
 #include <asm/rtc.h>
 
 static int generic_get_time(struct device *dev, struct rtc_time *tm)
-- 
2.7.0

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	geert@linux-m68k.org, gregkh@linuxfoundation.org, deller@gmx.de,
	benh@kernel.crashing.org, mpe@ellerman.id.au, dalias@libc.org,
	dhowells@redhat.com, linux-alpha@vger.kernel.org,
	a.zummo@towertech.it, linux-kernel@vger.kernel.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-sh@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	rtc-linux@googlegroups.com, linux-arch@vger.kernel.org
Subject: [PATCH v4 07/16] rtc: parisc: provide rtc_class_ops directly
Date: Mon, 30 May 2016 20:57:55 +0200	[thread overview]
Message-ID: <1464634684-1248135-8-git-send-email-arnd@arndb.de> (raw)
Message-ID: <20160530185755.pjuQI1Zmo_TYm21IxWUDhhsj7qZIaE9_9yGZAvn0KU4@z> (raw)
In-Reply-To: <1464634684-1248135-1-git-send-email-arnd@arndb.de>

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 +++++++++++++++++++++++++++++++++++-
 drivers/rtc/rtc-generic.c |  3 +--
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 58dd6801f5be..744878789752 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;
 }
 
+#if IS_ENABLED(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)
 {
diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c
index 3958e87a05fa..92b5e02a3750 100644
--- a/drivers/rtc/rtc-generic.c
+++ b/drivers/rtc/rtc-generic.c
@@ -9,8 +9,7 @@
 #include <linux/platform_device.h>
 #include <linux/rtc.h>
 
-#if defined(CONFIG_M68K) || defined(CONFIG_PARISC) || \
-    defined(CONFIG_PPC)
+#if defined(CONFIG_M68K) || defined(CONFIG_PPC)
 #include <asm/rtc.h>
 
 static int generic_get_time(struct device *dev, struct rtc_time *tm)
-- 
2.7.0


  parent reply	other threads:[~2016-05-30 18:57 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30 18:57 [PATCH v4 00/16] genrtc removal Arnd Bergmann
2016-05-30 18:57 ` Arnd Bergmann
2016-05-30 18:57 ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57 ` Arnd Bergmann
2016-05-30 18:57 ` Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 01/16] rtc: cmos: remove empty asm/mc146818rtc.h files Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 02/16] rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 03/16] char/genrtc: x86: remove remnants of asm/rtc.h Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 04/16] rtc: sh: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 05/16] char/genrtc: remove alpha support Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 06/16] char/genrtc: remove mn10300 support Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 07/16] rtc: parisc: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 08/16] char/genrtc: remove parisc support Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 09/16] rtc: m68k: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 10/16] rtc: m68k: provide ioctl for q40 Arnd Bergmann
2016-05-30 18:57 ` [PATCH v4 11/16] char/genrtc: remove m68k support Arnd Bergmann
2016-05-30 18:58 ` [PATCH v4 12/16] rtc: powerpc: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:58 ` [PATCH v4 13/16] char/genrtc: remove powerpc support Arnd Bergmann
2016-05-30 18:58 ` [PATCH v4 14/16] rtc: generic: remove get_rtc_time/set_rtc_time wrappers Arnd Bergmann
     [not found] ` <1464634684-1248135-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2016-05-30 18:57   ` [PATCH v4 01/16] rtc: cmos: remove empty asm/mc146818rtc.h files Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 02/16] rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 03/16] char/genrtc: x86: remove remnants of asm/rtc.h Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 04/16] rtc: sh: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-06-01 21:58     ` Rich Felker
     [not found]     ` <1464634684-1248135-5-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2016-06-01 21:58       ` Rich Felker
2016-06-01 21:58         ` Rich Felker
2016-06-01 21:58         ` [rtc-linux] " Rich Felker
2016-06-01 21:58         ` Rich Felker
2016-06-01 21:58         ` Rich Felker
2016-05-30 18:57   ` [PATCH v4 05/16] char/genrtc: remove alpha support Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 06/16] char/genrtc: remove mn10300 support Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` Arnd Bergmann [this message]
2016-05-30 18:57     ` [PATCH v4 07/16] rtc: parisc: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 08/16] char/genrtc: remove parisc support Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 09/16] rtc: m68k: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 10/16] rtc: m68k: provide ioctl for q40 Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57   ` [PATCH v4 11/16] char/genrtc: remove m68k support Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:57     ` Arnd Bergmann
2016-05-30 18:58   ` [PATCH v4 12/16] rtc: powerpc: provide rtc_class_ops directly Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58   ` [PATCH v4 13/16] char/genrtc: remove powerpc support Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58   ` [PATCH v4 14/16] rtc: generic: remove get_rtc_time/set_rtc_time wrappers Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58   ` [PATCH v4 15/16] char/genrtc: remove asm-generic/rtc.h from mips Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58   ` [PATCH v4 16/16] char/genrtc: remove the rest of the driver Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` [rtc-linux] " Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 18:58     ` Arnd Bergmann
2016-05-30 20:32   ` [PATCH v4 00/16] genrtc removal Alexandre Belloni
2016-05-30 20:32     ` Alexandre Belloni
2016-05-30 20:32     ` [rtc-linux] " Alexandre Belloni
2016-05-30 20:32     ` Alexandre Belloni
2016-05-30 20:32     ` Alexandre Belloni
     [not found]     ` <20160530203207.GY3451-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2016-05-31  6:56       ` Geert Uytterhoeven
2016-05-31  6:56         ` Geert Uytterhoeven
2016-05-31  6:56         ` [rtc-linux] " Geert Uytterhoeven
2016-05-31  6:56         ` Geert Uytterhoeven
2016-05-31  6:56         ` Geert Uytterhoeven
2016-05-31  6:56     ` Geert Uytterhoeven
2016-05-30 18:58 ` [PATCH v4 15/16] char/genrtc: remove asm-generic/rtc.h from mips Arnd Bergmann
2016-05-30 18:58 ` [PATCH v4 16/16] char/genrtc: remove the rest of the driver Arnd Bergmann
2016-05-30 20:32 ` [PATCH v4 00/16] genrtc removal Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464634684-1248135-8-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org \
    --cc=alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=dalias-8zAoT0mYgF4@public.gmane.org \
    --cc=deller-Mmb7MZpHnFY@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org \
    --cc=linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org \
    --cc=rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.