0001
0002
0003
0004
0005
0006
0007 #include <linux/kernel.h>
0008 #include <linux/module.h>
0009 #include <linux/time.h>
0010 #include <linux/platform_device.h>
0011 #include <linux/rtc.h>
0012
0013 static int __init generic_rtc_probe(struct platform_device *dev)
0014 {
0015 struct rtc_device *rtc;
0016 const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev);
0017
0018 rtc = devm_rtc_device_register(&dev->dev, "rtc-generic",
0019 ops, THIS_MODULE);
0020 if (IS_ERR(rtc))
0021 return PTR_ERR(rtc);
0022
0023 platform_set_drvdata(dev, rtc);
0024
0025 return 0;
0026 }
0027
0028 static struct platform_driver generic_rtc_driver = {
0029 .driver = {
0030 .name = "rtc-generic",
0031 },
0032 };
0033
0034 module_platform_driver_probe(generic_rtc_driver, generic_rtc_probe);
0035
0036 MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>");
0037 MODULE_LICENSE("GPL");
0038 MODULE_DESCRIPTION("Generic RTC driver");
0039 MODULE_ALIAS("platform:rtc-generic");