feat: owloysius - dynamic init function invocator
[lunaix-os.git] / lunaix-os / hal / rtc / mc146818a.c
index dce0a5179ad8386212d9552d1f417259c50a5a2e..5083444e29bdf7523e96b4637aa35df23e7b963c 100644 (file)
@@ -195,7 +195,7 @@ rtc_init(struct device_def* devdef)
     // Make sure the rtc timer is disabled by default
     rtc_disable_timer();
 
-    struct hwrtc* rtc = hwrtc_alloc_new(devdef, "mc146818");
+    struct hwrtc* rtc = hwrtc_alloc_new("mc146818");
     struct mc146818* state = valloc(sizeof(struct mc146818));
 
     state->rtc_context = rtc;
@@ -212,12 +212,14 @@ rtc_init(struct device_def* devdef)
     rtc->get_counts = rtc_getcnt;
     rtc->chfreq = rtc_chfreq;
 
+    hwrtc_register(&devdef->class, rtc);
+
     return 0;
 }
 
 static struct device_def devrtc_mc146818 = {
     .name = "MC146818 RTC",
-    .class = DEVCLASS(DEVIF_SOC, DEVFN_TIME, DEV_RTC, 1),
+    .class = DEVCLASS(DEVIF_SOC, DEVFN_TIME, DEV_RTC),
     .init = rtc_init
 };
-EXPORT_DEVICE(mc146818, &devrtc_mc146818, load_earlystage);
\ No newline at end of file
+EXPORT_DEVICE(mc146818, &devrtc_mc146818, load_timedev);
\ No newline at end of file