feat: device subsystem rework
[lunaix-os.git] / lunaix-os / hal / rng / rngx86.c
index aea9b691cd7b6e7a169890cd33a1c7baba0f2c19..bb069d7f61d13025f05ad19a05abd248e360b343 100644 (file)
@@ -28,11 +28,19 @@ __rand_rd(struct device* dev, void* buf, size_t offset, size_t len)
     return len;
 }
 
-void
-pdev_randdev_init()
+int
+pdev_randdev_init(struct device_def* devdef)
 {
     struct device* devrand = device_addseq(NULL, NULL, "rand");
     devrand->ops.read = __rand_rd;
     devrand->ops.read_page = __rand_rd_pg;
+
+    return 0;
 }
-EXPORT_PSEUDODEV(randdev, pdev_randdev_init);
\ No newline at end of file
+
+static struct device_def devrandx86_def = {
+    .name = "null",
+    .class = DEVCLASS(DEVIF_SOC, DEVFN_CHAR, DEV_RNG, 0),
+    .init = pdev_randdev_init
+};
+EXPORT_DEVICE(randdev, &devrandx86_def, load_earlystage);
\ No newline at end of file