diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-04-02 17:53:47 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-04-05 16:23:22 +0200 |
commit | 2352a73212a503dfe77970c48a891c008b7edd5b (patch) | |
tree | 261e48edda13b9be7b968a016c22b9516879c0ef /drivers/staging/greybus/bundle.c | |
parent | 045235f118917210ab9574c768b2625231e2069b (diff) |
greybus: Unregister devices to get them freed
Devices registered with the device-core needs to be freed by calling
device_unregister(). For module we are calling just put_device() and for
bundle, connection and interface we are calling device_del().
All of these are incomplete and so none of them get freed, i.e. the
.release() routine is never called for their devices.
Module being a special case that it needs to maintain a refcount or a
list of interfaces to trace its usage count. I have chosen refcount.
And so once the refcount is zero, we can Unregister the device and
module will get free as well.
Because of this bug in freeing devices, their sysfs directories were not
getting removed properly and after a manifest is parsed with the help of
gbsim, removing modules was creating problems. The sysfs directory
'greybus' wasn't getting removed. And inserting the modules again
resulted in warnings and insmod failure.
WARNING: CPU: 3 PID: 4277 at
/build/buildd/linux-3.13.0/fs/sysfs/dir.c:486
sysfs_warn_dup+0x86/0xa0()
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/bundle.c')
-rw-r--r-- | drivers/staging/greybus/bundle.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/greybus/bundle.c b/drivers/staging/greybus/bundle.c index 93f80dc5a815..5ced992e17d4 100644 --- a/drivers/staging/greybus/bundle.c +++ b/drivers/staging/greybus/bundle.c @@ -140,7 +140,7 @@ void gb_bundle_destroy(struct gb_interface *intf) list_for_each_entry_safe(bundle, temp, &list, links) { list_del(&bundle->links); gb_bundle_connections_exit(bundle); - device_del(&bundle->dev); + device_unregister(&bundle->dev); } } |