diff options
Diffstat (limited to 'drivers/platform/chrome/wilco_ec/telemetry.c')
| -rw-r--r-- | drivers/platform/chrome/wilco_ec/telemetry.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c index 54708aa6c700..b18043e31ae4 100644 --- a/drivers/platform/chrome/wilco_ec/telemetry.c +++ b/drivers/platform/chrome/wilco_ec/telemetry.c @@ -30,6 +30,7 @@ #include <linux/cdev.h> #include <linux/device.h> #include <linux/fs.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/platform_data/wilco-ec.h> #include <linux/platform_device.h> @@ -329,7 +330,6 @@ static const struct file_operations telem_fops = { .write = telem_write, .read = telem_read, .release = telem_release, - .llseek = no_llseek, .owner = THIS_MODULE, }; @@ -372,7 +372,7 @@ static int telem_device_probe(struct platform_device *pdev) dev_data = kzalloc(sizeof(*dev_data), GFP_KERNEL); if (!dev_data) { - ida_simple_remove(&telem_ida, minor); + ida_free(&telem_ida, minor); return -ENOMEM; } @@ -388,35 +388,40 @@ static int telem_device_probe(struct platform_device *pdev) dev_set_name(&dev_data->dev, TELEM_DEV_NAME_FMT, minor); device_initialize(&dev_data->dev); - /* Initialize the character device and add it to userspace */; + /* Initialize the character device and add it to userspace */ cdev_init(&dev_data->cdev, &telem_fops); error = cdev_device_add(&dev_data->cdev, &dev_data->dev); if (error) { put_device(&dev_data->dev); - ida_simple_remove(&telem_ida, minor); + ida_free(&telem_ida, minor); return error; } return 0; } -static int telem_device_remove(struct platform_device *pdev) +static void telem_device_remove(struct platform_device *pdev) { struct telem_device_data *dev_data = platform_get_drvdata(pdev); cdev_device_del(&dev_data->cdev, &dev_data->dev); - ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt)); + ida_free(&telem_ida, MINOR(dev_data->dev.devt)); put_device(&dev_data->dev); - - return 0; } +static const struct platform_device_id telem_id[] = { + { DRV_NAME, 0 }, + {} +}; +MODULE_DEVICE_TABLE(platform, telem_id); + static struct platform_driver telem_driver = { .probe = telem_device_probe, .remove = telem_device_remove, .driver = { .name = DRV_NAME, }, + .id_table = telem_id, }; static int __init telem_module_init(void) @@ -468,4 +473,3 @@ module_exit(telem_module_exit); MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>"); MODULE_DESCRIPTION("Wilco EC telemetry driver"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:" DRV_NAME); |
