mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
To: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux@googlegroups.com, Kyle McMartin <kyle@mcmartin.ca>,
	David Woodhouse <dwmw2@infradead.org>,
	Richard Zidlicky <rz@linux-m68k.org>,
	linux-parisc@vger.kernel.org, linuxppc-dev@ozlabs.org,
	linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Subject: [PATCH/RFC 4/5] powerpc: Enable rtc-generic, and kill rtc-ppc
Date: Fri, 20 Feb 2009 16:46:48 +0100	[thread overview]
Message-ID: <1235144809-32468-5-git-send-email-Geert.Uytterhoeven@sonycom.com> (raw)
In-Reply-To: <1235144809-32468-4-git-send-email-Geert.Uytterhoeven@sonycom.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4535 bytes --]

Create the "rtc-generic" platform device if ppc_md.get_rtc_time is set.
Kill rtc-ppc, as rtc-generic offers the same functionality in a more generic
way.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
---
 arch/powerpc/Kconfig       |    4 ++
 arch/powerpc/kernel/time.c |   22 ++++++++++++++
 drivers/rtc/Kconfig        |    8 -----
 drivers/rtc/Makefile       |    1 -
 drivers/rtc/rtc-ppc.c      |   69 --------------------------------------------
 5 files changed, 26 insertions(+), 78 deletions(-)
 delete mode 100644 drivers/rtc/rtc-ppc.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 40b7981..82e47b0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -85,6 +85,10 @@ config ARCH_HAS_ILOG2_U64
 	bool
 	default y if 64BIT
 
+config ARCH_HAS_GENERIC_RTC
+	bool
+	default y
+
 config GENERIC_HWEIGHT
 	bool
 	default y
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c956403..616c7d3 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1127,3 +1127,25 @@ void div128_by_32(u64 dividend_high, u64 dividend_low,
 	dr->result_low  = ((u64)y << 32) + z;
 
 }
+
+static struct platform_device rtc_generic_dev = {
+	.name = "rtc-generic",
+	.id = -1,
+};
+
+static int __init rtc_init(void)
+{
+	int ret;
+
+	if (!ppc_md.get_rtc_time)
+		return -ENODEV;
+
+	ret = platform_device_register(&rtc_generic_dev);
+	if (ret < 0)
+		pr_err("Unable to register rtc device...\n");
+
+	/* not necessarily an error */
+	return 0;
+}
+
+module_init(rtc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 3e58182..9964a72 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -685,14 +685,6 @@ config RTC_DRV_GENERIC
 	  RTC abstraction. If you do not know what you are doing, you should
 	  just say Y.
 
-config RTC_DRV_PPC
-       tristate "PowerPC machine dependent RTC support"
-       depends on PPC
-       help
-	 The PowerPC kernel has machine-specific functions for accessing
-	 the RTC. This exposes that functionality through the generic RTC
-	 class.
-
 config RTC_DRV_PXA
        tristate "PXA27x/PXA3xx"
        depends on ARCH_PXA
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 9c18a01..bd209a5 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -56,7 +56,6 @@ obj-$(CONFIG_RTC_DRV_PCF8583)	+= rtc-pcf8583.o
 obj-$(CONFIG_RTC_DRV_PL030)	+= rtc-pl030.o
 obj-$(CONFIG_RTC_DRV_PL031)	+= rtc-pl031.o
 obj-$(CONFIG_RTC_DRV_GENERIC)	+= rtc-generic.o
-obj-$(CONFIG_RTC_DRV_PPC)	+= rtc-ppc.o
 obj-$(CONFIG_RTC_DRV_PXA)	+= rtc-pxa.o
 obj-$(CONFIG_RTC_DRV_R9701)	+= rtc-r9701.o
 obj-$(CONFIG_RTC_DRV_RS5C313)	+= rtc-rs5c313.o
diff --git a/drivers/rtc/rtc-ppc.c b/drivers/rtc/rtc-ppc.c
deleted file mode 100644
index c8e97e2..0000000
--- a/drivers/rtc/rtc-ppc.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * RTC driver for ppc_md RTC functions
- *
- * © 2007 Red Hat, Inc.
- *
- * Author: David Woodhouse <dwmw2@infradead.org>
- *
- * 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>
-#include <linux/err.h>
-#include <linux/rtc.h>
-#include <linux/platform_device.h>
-#include <asm/machdep.h>
-
-static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
-	ppc_md.get_rtc_time(tm);
-	return 0;
-}
-
-static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
-	return ppc_md.set_rtc_time(tm);
-}
-
-static const struct rtc_class_ops ppc_rtc_ops = {
-	.set_time = ppc_rtc_set_time,
-	.read_time = ppc_rtc_read_time,
-};
-
-static struct rtc_device *rtc;
-static struct platform_device *ppc_rtc_pdev;
-
-static int __init ppc_rtc_init(void)
-{
-	if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time)
-		return -ENODEV;
-
-	ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0);
-	if (IS_ERR(ppc_rtc_pdev))
-		return PTR_ERR(ppc_rtc_pdev);
-
-	rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev,
-				  &ppc_rtc_ops, THIS_MODULE);
-	if (IS_ERR(rtc)) {
-		platform_device_unregister(ppc_rtc_pdev);
-		return PTR_ERR(rtc);
-	}
-
-	return 0;
-}
-
-static void __exit ppc_rtc_exit(void)
-{
-	rtc_device_unregister(rtc);
-	platform_device_unregister(ppc_rtc_pdev);
-}
-
-module_init(ppc_rtc_init);
-module_exit(ppc_rtc_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
-MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");
-- 
1.6.0.4


  reply	other threads:[~2009-02-20 15:48 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 15:46 [PATCH/RFC 0/5] Generic RTC class driver Geert Uytterhoeven
2009-02-20 15:46 ` [PATCH/RFC 1/5] rtc-parisc: Add missing module alias Geert Uytterhoeven
2009-02-20 15:46   ` [PATCH/RFC 2/5] pa-risc: Rename rtc-parisc to rtc-generic Geert Uytterhoeven
2009-02-20 15:46     ` [PATCH/RFC 3/5] m68k: Enable rtc-generic Geert Uytterhoeven
2009-02-20 15:46       ` Geert Uytterhoeven [this message]
2009-02-20 15:46         ` [PATCH/RFC 5/5] rtc: Kill genrtc, as all its users have been converted to rtc-generic Geert Uytterhoeven
2009-02-20 16:04 ` [rtc-linux] [PATCH/RFC 0/5] Generic RTC class driver Alessandro Zummo
2009-02-23 12:34   ` Geert Uytterhoeven
2009-02-23 15:05     ` [rtc-linux] " Alessandro Zummo
2009-02-24 17:56       ` Geert Uytterhoeven
2009-02-24 18:37         ` Alessandro Zummo
2009-02-25  1:14           ` Brad Boyer
2009-02-25  9:58             ` Geert Uytterhoeven
2009-02-24 21:35     ` [rtc-linux] " David Woodhouse
2009-02-24 22:11       ` Alessandro Zummo
2009-02-24 22:32         ` David Woodhouse
2009-02-25 10:00           ` Geert Uytterhoeven
2009-02-25 10:18             ` [rtc-linux] " Alessandro Zummo
2009-02-27 17:17               ` Maciej W. Rozycki
2009-02-27 17:19                 ` Alessandro Zummo
2009-02-27 18:55               ` Richard Zidlicky
2009-03-02  9:54                 ` Geert Uytterhoeven
2009-03-02 10:03                   ` Alessandro Zummo
2009-03-02 10:28                     ` Geert Uytterhoeven
2009-03-02 11:09                       ` Alessandro Zummo
2009-03-03 10:41                         ` Geert Uytterhoeven
2009-03-03 13:53                           ` Alessandro Zummo
2009-03-03 19:06                           ` Paul Mundt
2009-03-04  8:26                             ` Geert Uytterhoeven
2009-03-04 12:47                               ` Alessandro Zummo
2009-03-04 12:51                                 ` Geert Uytterhoeven
2009-02-25  9:54       ` [rtc-linux] " Geert Uytterhoeven
2009-02-24 18:46 ` Helge Deller
2009-02-25  9:54   ` Geert Uytterhoeven

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=1235144809-32468-5-git-send-email-Geert.Uytterhoeven@sonycom.com \
    --to=geert.uytterhoeven@sonycom.com \
    --cc=a.zummo@towertech.it \
    --cc=dwmw2@infradead.org \
    --cc=kyle@mcmartin.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=rz@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®