refactor: make pci device driver loading passive, pci bus scanner will not load them...
[lunaix-os.git] / lunaix-os / kernel / device / input.c
index a96cb007f29e0e129c9d15cd0d427706fc5502a2..3d974a7987d84f12cea8251d778163b303a473ce 100644 (file)
@@ -1,5 +1,6 @@
 #include <lunaix/clock.h>
 #include <lunaix/input.h>
+#include <lunaix/mm/page.h>
 #include <lunaix/mm/valloc.h>
 #include <lunaix/spike.h>
 #include <lunaix/status.h>
@@ -69,7 +70,7 @@ __input_dev_read_pg(struct device* dev, void* buf, size_t offset)
 }
 
 struct input_device*
-input_add_device(char* name_fmt, ...)
+input_add_device(struct devclass* class, char* name_fmt, ...)
 {
     assert(input_devcat);
 
@@ -79,12 +80,14 @@ input_add_device(char* name_fmt, ...)
     va_list args;
     va_start(args, name_fmt);
 
-    struct device* dev =
-      device_add(input_devcat, idev, name_fmt, DEV_IFSEQ, args);
+    struct device* dev = device_allocseq(input_devcat, idev);
+
+    device_setname_vargs(dev, name_fmt, args);
+    device_register(dev, class, NULL);
 
     idev->dev_if = dev;
-    dev->read = __input_dev_read;
-    dev->read_page = __input_dev_read_pg;
+    dev->ops.read = __input_dev_read;
+    dev->ops.read_page = __input_dev_read_pg;
 
     va_end(args);