/*
* Tear down a previously set up bundle.
*/
-void gb_bundle_destroy(struct gb_interface *intf)
+void gb_bundle_destroy(struct gb_bundle *bundle)
{
- LIST_HEAD(list);
- struct gb_bundle *bundle;
- struct gb_bundle *temp;
-
- if (WARN_ON(!intf))
- return;
-
spin_lock_irq(&gb_bundles_lock);
- list_splice_init(&intf->bundles, &list);
+ list_del(&bundle->links);
spin_unlock_irq(&gb_bundles_lock);
- list_for_each_entry_safe(bundle, temp, &list, links) {
- list_del(&bundle->links);
- gb_bundle_connections_exit(bundle);
- device_unregister(&bundle->dev);
- }
+ gb_bundle_connections_exit(bundle);
+ device_unregister(&bundle->dev);
}
int gb_bundle_init(struct gb_bundle *bundle, u8 device_id)
/* Greybus "private" definitions" */
struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
u8 class);
-void gb_bundle_destroy(struct gb_interface *intf);
+void gb_bundle_destroy(struct gb_bundle *bundle);
int gb_bundle_init(struct gb_bundle *bundle, u8 device_id);
int gb_bundles_init(struct gb_interface *intf, u8 device_id);
static void gb_interface_destroy(struct gb_interface *intf)
{
struct gb_module *module;
+ struct gb_bundle *bundle;
+ struct gb_bundle *next;
if (WARN_ON(!intf))
return;
list_del(&intf->links);
spin_unlock_irq(&gb_interfaces_lock);
- gb_bundle_destroy(intf);
+ list_for_each_entry_safe(bundle, next, &intf->bundles, links)
+ gb_bundle_destroy(bundle);
kfree(intf->product_string);
kfree(intf->vendor_string);
- /* kref_put(module->hd); */
module = intf->module;
device_unregister(&intf->dev);