input: ldc2114: fix rmmod

DLKM was not properly unloading in response to rmmod command.

Change-Id: I23b958727cd245edccdf477adbb43183e927abff
Signed-off-by: Konstantin Makariev <hcv867@motorola.com>
Reviewed-on: https://gerrit.mot.com/1128638
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Konstantin Makariev 2018-02-01 13:58:29 -06:00 • committed by Konstantin Makariev
commit 0e8c506758
2 changed files with 22 additions and 4 deletions

View file

@ -314,8 +314,9 @@ void ldc2114_cdev_remove(void)
if (!cxt)
return;
unregister_chrdev(cxt->major, DRVNAME);
device_destroy(cxt->class, MKDEV(cxt->major, 0));
class_destroy(cxt->class);
unregister_chrdev(cxt->major, DRVNAME);
platform_device_unregister(cxt->pdev);
kfree(cxt);
}

View file

@ -963,8 +963,9 @@ static irqreturn_t ldc2114_irq(int irq, void *data)
#ifdef CONFIG_OF
static const struct of_device_id ldc2114_of_match[] = {
{ .compatible = "ti,ldc2114", },
{ /* sentinel */ }
{},
};
MODULE_DEVICE_TABLE(of, ldc2114_of_match);
static struct ldc2114_config *read_config_data(struct ldc2114_data *ldc,
@ -1385,25 +1386,41 @@ static int ldc2114_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &ldc2114_attr_group);
unregister_reboot_notifier(&ldc->reboot_nb);
return 0;
}
static const struct i2c_device_id ldc2114_ids[] = {
{ "ldc2114", 0 },
{ /* sentinel */ }
{},
};
MODULE_DEVICE_TABLE(i2c, ldc2114_ids);
static struct i2c_driver ldc2114_i2c_driver = {
.driver = {
.name = LDC2114_DRIVER_NAME,
#ifdef CONFIG_OF
.of_match_table = of_match_ptr(ldc2114_of_match),
#endif
},
.probe = ldc2114_probe,
.remove = ldc2114_remove,
.id_table = ldc2114_ids,
};
module_i2c_driver(ldc2114_i2c_driver);
static int __init ldc2114_init(void)
{
return i2c_add_driver(&ldc2114_i2c_driver);
}
static void __exit ldc2114_exit(void)
{
i2c_del_driver(&ldc2114_i2c_driver);
}
module_init(ldc2114_init);
module_exit(ldc2114_exit);
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
MODULE_DESCRIPTION("TI LDC2114 Metal Touch Inductance-to-Digital Converter");