}
udev = es1->usb_dev;
- gb_hd_remove(es1->hd);
+ gb_hd_put(es1->hd);
usb_put_dev(udev);
}
for (i = 0; i < NUM_CPORT_IN_URB; ++i)
usb_kill_urb(es1->cport_in_urb[i]);
+ gb_hd_del(es1->hd);
+
es1_destroy(es1);
}
gb_debugfs_get(), es1,
&apb1_log_enable_fops);
+ retval = gb_hd_add(hd);
+ if (retval)
+ goto error;
+
for (i = 0; i < NUM_CPORT_IN_URB; ++i) {
retval = usb_submit_urb(es1->cport_in_urb[i], GFP_KERNEL);
if (retval)
err_kill_in_urbs:
for (--i; i >= 0; --i)
usb_kill_urb(es1->cport_in_urb[i]);
+ gb_hd_del(hd);
error:
es1_destroy(es1);
udev = es2->usb_dev;
cport_to_ep = es2->cport_to_ep;
- gb_hd_remove(es2->hd);
+ gb_hd_put(es2->hd);
kfree(cport_to_ep);
usb_put_dev(udev);
for (i = 0; i < NUM_BULKS; ++i)
es2_cport_in_disable(es2, &es2->cport_in[i]);
+ gb_hd_del(es2->hd);
+
es2_destroy(es2);
}
gb_debugfs_get(), es2,
&apb_log_enable_fops);
+ retval = gb_hd_add(hd);
+ if (retval)
+ goto error;
+
for (i = 0; i < NUM_BULKS; ++i) {
retval = es2_cport_in_enable(es2, &es2->cport_in[i]);
if (retval)
err_disable_cport_in:
for (--i; i >= 0; --i)
es2_cport_in_disable(es2, &es2->cport_in[i]);
+ gb_hd_del(hd);
error:
es2_destroy(es2);
hd->buffer_size_max = buffer_size_max;
hd->num_cports = num_cports;
+ return hd;
+}
+EXPORT_SYMBOL_GPL(gb_hd_create);
+
+int gb_hd_add(struct gb_host_device *hd)
+{
/*
* Initialize AP's SVC protocol connection:
*
* time we will create a fully initialized svc-connection, as we need
* endo-id and AP's interface id for that.
*/
- if (!gb_ap_svc_connection_create(hd)) {
- kref_put_mutex(&hd->kref, free_hd, &hd_mutex);
- return ERR_PTR(-ENOMEM);
- }
+ if (!gb_ap_svc_connection_create(hd))
+ return -ENOMEM;
- return hd;
+ return 0;
}
-EXPORT_SYMBOL_GPL(gb_hd_create);
+EXPORT_SYMBOL_GPL(gb_hd_add);
-void gb_hd_remove(struct gb_host_device *hd)
+void gb_hd_del(struct gb_host_device *hd)
{
/*
* Tear down all interfaces, modules, and the endo that is associated
/* Is the SVC still using the partially uninitialized connection ? */
if (hd->initial_svc_connection)
gb_connection_destroy(hd->initial_svc_connection);
+}
+EXPORT_SYMBOL_GPL(gb_hd_del);
+void gb_hd_put(struct gb_host_device *hd)
+{
kref_put_mutex(&hd->kref, free_hd, &hd_mutex);
}
-EXPORT_SYMBOL_GPL(gb_hd_remove);
+EXPORT_SYMBOL_GPL(gb_hd_put);