net: ipv6: Release route when device is unregistering
[linux/fpc-iii.git] / drivers / rtc / rtc-starfire.c
blob7fc36973fa330e4845b84f688800d6903556de38
1 /* rtc-starfire.c: Starfire platform RTC driver.
3 * Author: David S. Miller
4 * License: GPL
6 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
7 */
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11 #include <linux/rtc.h>
12 #include <linux/platform_device.h>
14 #include <asm/oplib.h>
16 static u32 starfire_get_time(void)
18 static char obp_gettod[32];
19 static u32 unix_tod;
21 sprintf(obp_gettod, "h# %08x unix-gettod",
22 (unsigned int) (long) &unix_tod);
23 prom_feval(obp_gettod);
25 return unix_tod;
28 static int starfire_read_time(struct device *dev, struct rtc_time *tm)
30 rtc_time_to_tm(starfire_get_time(), tm);
31 return rtc_valid_tm(tm);
34 static const struct rtc_class_ops starfire_rtc_ops = {
35 .read_time = starfire_read_time,
38 static int __init starfire_rtc_probe(struct platform_device *pdev)
40 struct rtc_device *rtc;
42 rtc = devm_rtc_device_register(&pdev->dev, "starfire",
43 &starfire_rtc_ops, THIS_MODULE);
44 if (IS_ERR(rtc))
45 return PTR_ERR(rtc);
47 platform_set_drvdata(pdev, rtc);
49 return 0;
52 static struct platform_driver starfire_rtc_driver = {
53 .driver = {
54 .name = "rtc-starfire",
58 builtin_platform_driver_probe(starfire_rtc_driver, starfire_rtc_probe);