diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 0fca4d74c76b..9d3ffc217163 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -527,6 +527,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 b9ec4a16db1f..02b71afa330c 100644 --- a/drivers/rtc/hctosys.c +++ b/drivers/rtc/hctosys.c @@ -24,7 +24,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; @@ -73,5 +73,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 ccc17a2e293d..57a8a18e6eb4 100644 --- a/drivers/rtc/rtc-core.h +++ b/drivers/rtc/rtc-core.h @@ -60,3 +60,7 @@ int rtc_add_groups(struct rtc_device *rtc, const struct attribute_group **grps) return 0; } #endif + +#ifdef CONFIG_RTC_HCTOSYS +extern int rtc_hctosys(void); +#endif