rtc-generic.c 911 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* rtc-generic: RTC driver using the generic RTC abstraction
  2. *
  3. * Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca>
  4. */
  5. #include <linux/kernel.h>
  6. #include <linux/module.h>
  7. #include <linux/time.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/rtc.h>
  10. static int __init generic_rtc_probe(struct platform_device *dev)
  11. {
  12. struct rtc_device *rtc;
  13. const struct rtc_class_ops *ops = dev_get_platdata(&dev->dev);
  14. rtc = devm_rtc_device_register(&dev->dev, "rtc-generic",
  15. ops, THIS_MODULE);
  16. if (IS_ERR(rtc))
  17. return PTR_ERR(rtc);
  18. platform_set_drvdata(dev, rtc);
  19. return 0;
  20. }
  21. static struct platform_driver generic_rtc_driver = {
  22. .driver = {
  23. .name = "rtc-generic",
  24. },
  25. };
  26. module_platform_driver_probe(generic_rtc_driver, generic_rtc_probe);
  27. MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>");
  28. MODULE_LICENSE("GPL");
  29. MODULE_DESCRIPTION("Generic RTC driver");
  30. MODULE_ALIAS("platform:rtc-generic");