diff options
author | Wendly Li <wendlyli@google.com> | 2022-11-03 11:15:39 +0000 |
---|---|---|
committer | Wendly Li <wendlyli@google.com> | 2022-11-29 05:26:24 +0000 |
commit | 87d111f12332e5425361cf48c5c6026c624e954c (patch) | |
tree | 8ba40d8167a5be0a865b2bd3e26db7f6a8b58664 /goog_touch_interface.c | |
parent | 948a178eb7210ff49d262648d11e2a01f5fbf63b (diff) | |
download | common-87d111f12332e5425361cf48c5c6026c624e954c.tar.gz |
touch/gti: fully remove sysfs when removing gti
Bug: 255257453
Test: Run rmmod touch_driver && insmod touch_driver.ko
Change-Id: I6023f1add1ce8624f76caf16ea78e906fba763d0
Signed-off-by: Wendly Li <wendlyli@google.com>
Diffstat (limited to 'goog_touch_interface.c')
-rw-r--r-- | goog_touch_interface.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/goog_touch_interface.c b/goog_touch_interface.c index d201956..ee64ce5 100644 --- a/goog_touch_interface.c +++ b/goog_touch_interface.c @@ -3092,15 +3092,23 @@ int goog_touch_interface_remove(struct goog_touch_interface *gti) if (!gti) return -ENODEV; - if (gti->vendor_dev) - sysfs_remove_link(>i->dev->kobj, "vendor"); - if (gti->vendor_input_dev) - sysfs_remove_link(>i->dev->kobj, "vendor_input"); + if (gti->dev) { + sysfs_remove_group(>i->dev->kobj, &goog_attr_group); + if (gti->vendor_dev) + sysfs_remove_link(>i->dev->kobj, "vendor"); + if (gti->vendor_input_dev) + sysfs_remove_link(>i->dev->kobj, "vendor_input"); + device_destroy(gti_class, gti->dev_id); + gti->dev = NULL; + gti_dev_num--; + } if (gti_class) { unregister_chrdev_region(gti->dev_id, 1); - device_destroy(gti_class, gti->dev_id); - gti_dev_num--; + if (!gti_dev_num) { + class_destroy(gti_class); + gti_class = NULL; + } } unregister_panel_bridge(>i->panel_bridge); @@ -3116,9 +3124,6 @@ int goog_touch_interface_remove(struct goog_touch_interface *gti) devm_kfree(gti->vendor_dev, gti->heatmap_buf); devm_kfree(gti->vendor_dev, gti); - if (gti_class && !gti_dev_num) - class_destroy(gti_class); - return 0; } EXPORT_SYMBOL(goog_touch_interface_remove); |