diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 9458e6d6686a..970b19c0fead 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -375,6 +375,11 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc) dev_info(rtc->dev.parent, "registered as %s\n", dev_name(&rtc->dev)); +#ifdef CONFIG_RTC_HCTOSYS_DEVICE + if (!strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE)) + rtc_hctosys(); +#endif + return 0; } EXPORT_SYMBOL_GPL(__rtc_register_device); diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c index a74d0d890600..e3a4f2646f8b 100644 --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c @@ -21,7 +21,7 @@ * the best guess is to add 0.5s. */ -static int __init rtc_hctosys(void) +int rtc_hctosys(void) { int err = -ENODEV; struct rtc_time tm; @@ -65,5 +65,3 @@ static int __init rtc_hctosys(void) return err; } - -late_initcall(rtc_hctosys); diff --git a/drivers/rtc/rtc-core.h b/drivers/rtc/rtc-core.h index 0abf98983e13..c38ef33a4bff 100644 --- a/drivers/rtc/rtc-core.h +++ b/drivers/rtc/rtc-core.h @@ -46,3 +46,7 @@ static inline const struct attribute_group **rtc_get_dev_attribute_groups(void) return NULL; } #endif + +#ifdef CONFIG_RTC_HCTOSYS +extern int rtc_hctosys(void); +#endif