summaryrefslogtreecommitdiff
path: root/DeviceModel/cembus/cembus.c
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-07-10 22:55:07 +0200
committerCarlos Maiolino <[email protected]>2025-07-10 22:56:55 +0200
commitd98f46ce647846b0aa30b2e16a30fd4e152a1bf5 (patch)
tree267474fcc77cf20b428f6f4c7f768ca09f4cfe0e /DeviceModel/cembus/cembus.c
parent869e68986aa8f69af6e7842260a68d1e5c6f796f (diff)
Add new code
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'DeviceModel/cembus/cembus.c')
-rw-r--r--DeviceModel/cembus/cembus.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/DeviceModel/cembus/cembus.c b/DeviceModel/cembus/cembus.c
new file mode 100644
index 0000000..7118aeb
--- /dev/null
+++ b/DeviceModel/cembus/cembus.c
@@ -0,0 +1,48 @@
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/string.h>
+
+/* cembus bus version */
+unsigned int bversion = 1;
+
+int cembus_match(struct device *dev, struct device_driver *drv)
+{
+ printk("cembus: Checking for device and driver compatibility...\n");
+ printk("bus_id: %s - driver: %s\n", "foo", drv->name);
+ return 0;
+}
+
+
+int cembus_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+ if (add_uevent_var(env, "CEMBUS_VERSION=%u", bversion));
+ return -ENOMEM;
+ return 0;
+}
+struct bus_type cem_bus_type = {
+ .name = "cembus",
+ .match = cembus_match,
+ .uevent = cembus_uevent,
+};
+
+static int __init cembus_init(void)
+{
+ int ret = 0;
+
+ ret = bus_register(&cem_bus_type);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static void cembus_exit(void)
+{
+ bus_unregister(&cem_bus_type);
+}
+
+MODULE_DESCRIPTION("cem virtual bus");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Carlos Maiolino");
+module_init(cembus_init);
+module_exit(cembus_exit);