DEFINE_LLIST(rtcs);
-void
-hwrtc_init()
-{
- ptr_t init;
- int index;
- ldga_foreach(rtcdev, ptr_t, index, init)
- {
- ((void (*)())init)();
- }
-}
+// void
+// hwrtc_init()
+// {
+// ldga_invoke_fn0(rtcdev);
+// }
void
hwrtc_walltime(datetime_t* dt)
}
struct hwrtc*
-hwrtc_alloc_new(char* name)
+hwrtc_alloc_new(struct device_def* def, char* name)
{
struct hwrtc* rtc_instance = valloc(sizeof(struct hwrtc));
}
rtc_instance->name = name;
- struct device* rtcdev =
- device_addsys(NULL, rtc_instance, "rtc%d", rtc_count);
+ struct device* rtcdev = device_allocsys(NULL, rtc_instance);
rtcdev->ops.exec_cmd = hwrtc_ioctl;
rtcdev->ops.read = hwrtc_read;
rtc_instance->rtc_dev = rtcdev;
- rtc_count++;
+ device_register(rtcdev, &def->class, "rtc%d", def->class.variant);
+
+ def->class.variant++;
return rtc_instance;
}