avr32: Make atstk1006_nand_data definition static
[linux-2.6/mini2440.git] / drivers / rtc / rtc-ppc.c
blobc8e97e25ef7e8cea33b27f7c9448d03dbb6d0788
1 /*
2 * RTC driver for ppc_md RTC functions
4 * © 2007 Red Hat, Inc.
6 * Author: David Woodhouse <dwmw2@infradead.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
14 #include <linux/module.h>
15 #include <linux/err.h>
16 #include <linux/rtc.h>
17 #include <linux/platform_device.h>
18 #include <asm/machdep.h>
20 static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm)
22 ppc_md.get_rtc_time(tm);
23 return 0;
26 static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
28 return ppc_md.set_rtc_time(tm);
31 static const struct rtc_class_ops ppc_rtc_ops = {
32 .set_time = ppc_rtc_set_time,
33 .read_time = ppc_rtc_read_time,
36 static struct rtc_device *rtc;
37 static struct platform_device *ppc_rtc_pdev;
39 static int __init ppc_rtc_init(void)
41 if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time)
42 return -ENODEV;
44 ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0);
45 if (IS_ERR(ppc_rtc_pdev))
46 return PTR_ERR(ppc_rtc_pdev);
48 rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev,
49 &ppc_rtc_ops, THIS_MODULE);
50 if (IS_ERR(rtc)) {
51 platform_device_unregister(ppc_rtc_pdev);
52 return PTR_ERR(rtc);
55 return 0;
58 static void __exit ppc_rtc_exit(void)
60 rtc_device_unregister(rtc);
61 platform_device_unregister(ppc_rtc_pdev);
64 module_init(ppc_rtc_init);
65 module_exit(ppc_rtc_exit);
67 MODULE_LICENSE("GPL");
68 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
69 MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");