diff options
Diffstat (limited to 'driver')
-rw-r--r-- | driver/main.c | 49 | ||||
-rw-r--r-- | driver/main.h | 2 |
2 files changed, 2 insertions, 49 deletions
diff --git a/driver/main.c b/driver/main.c index 2097edd..4dd4b88 100644 --- a/driver/main.c +++ b/driver/main.c @@ -2,54 +2,7 @@ #include <linux/i2c.h> #include "main.h" -#include "platform.h" -struct device *dev; -struct class *class; -dev_t node = 0; // do not register /dev/lork - -static int mod_init(void) { - int err; - - // create /sys/class/lork - class = class_create("lork"); - if (IS_ERR_OR_NULL(class)) { - err = PTR_ERR(class); - goto free_class; - } - - // create device (required for device attributes under /sys/class) - dev = device_create(class, NULL, node, NULL, "lork"); - if (IS_ERR_OR_NULL(dev)) { - err = PTR_ERR(dev); - goto free_device; - } - - // create platform driver - err = i2c_add_driver(&lork_driver); - if (err) goto free_platform_driver; - - printk("%s() OK\n", __PRETTY_FUNCTION__); - return 0; - -free_platform_driver: - i2c_del_driver(&lork_driver); -free_device: - device_destroy(class, node); -free_class: - class_destroy(class); - printk("%s() -> %d\n", __PRETTY_FUNCTION__, err); - return err; -} - -static void mod_exit(void) { - i2c_del_driver(&lork_driver); - device_destroy(class, node); - class_destroy(class); - printk("%s()\n", __PRETTY_FUNCTION__); -} - -module_init(mod_init); -module_exit(mod_exit); +module_i2c_driver(lork_driver); MODULE_LICENSE("Dual MIT/GPL"); diff --git a/driver/main.h b/driver/main.h index 666bcc1..77ebad5 100644 --- a/driver/main.h +++ b/driver/main.h @@ -11,7 +11,7 @@ static const struct of_device_id lork_match[] = { }; static const struct i2c_device_id lork_ids[] = { - { "foo", 0 }, + { "lork", 0 }, {}, }; |