X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/8fce4520de1f257819b16f9253fa28dcdae743f4..1375eb51603466b723ab7dd1ca4194ee5d662f75:/lunaix-os/hal/char/devzero.c diff --git a/lunaix-os/hal/char/devzero.c b/lunaix-os/hal/char/devzero.c index d5f13c6..9c0b6c7 100644 --- a/lunaix-os/hal/char/devzero.c +++ b/lunaix-os/hal/char/devzero.c @@ -18,18 +18,19 @@ __zero_rd(struct device* dev, void* buf, size_t offset, size_t len) } static int -pdev_zerodev_init(struct device_def*) +pdev_zerodev_init(struct device_def* def) { - struct device* devzero = device_addseq(NULL, NULL, "zero"); + struct device* devzero = device_allocseq(NULL, NULL); devzero->ops.read_page = __zero_rd_pg; devzero->ops.read = __zero_rd; + device_register(devzero, &def->class, "zero"); + return 0; } static struct device_def devzero_def = { .name = "zero", - .class = DEVCLASS(DEVIF_NON, DEVFN_PSEUDO, DEV_BUILTIN, 1), - .init = pdev_zerodev_init -}; -EXPORT_DEVICE(zerodev, &devzero_def, load_earlystage); + .class = DEVCLASSV(DEVIF_NON, DEVFN_PSEUDO, DEV_ZERO, DEV_BUILTIN_ZERO), + .init = pdev_zerodev_init}; +EXPORT_DEVICE(zerodev, &devzero_def, load_onboot);