diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-11-04 18:55:22 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-11-04 20:35:18 -0800 |
commit | c1700479845bc36cb48719b2ae341d4df89a73f6 (patch) | |
tree | 60aefe5a11e470a52aa53cc81e5962422df262b9 /drivers/staging/greybus/es2.c | |
parent | b4bd3617ed069a0aae701ed451cb6ec370fbd45f (diff) | |
download | op-kernel-dev-c1700479845bc36cb48719b2ae341d4df89a73f6.zip op-kernel-dev-c1700479845bc36cb48719b2ae341d4df89a73f6.tar.gz |
greybus: hd: fix host-device life time issues
Fix host-device life time issues by separating host-device allocation
from registration.
This is needed both to make sure that all host-device resources are
available before registering the device and to prevent such resources
from being deallocated while the device is still in use during device
removal.
This specifically fixes the following warnings during es1 and es2
disconnect:
usb 1-1.1: No free CPort OUT urbs, having to dynamically allocate one!
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/es2.c')
-rw-r--r-- | drivers/staging/greybus/es2.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c index 96ba1a7..aad6451 100644 --- a/drivers/staging/greybus/es2.c +++ b/drivers/staging/greybus/es2.c @@ -585,7 +585,7 @@ static void es2_destroy(struct es2_ap_dev *es2) 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); @@ -599,6 +599,8 @@ static void ap_disconnect(struct usb_interface *interface) for (i = 0; i < NUM_BULKS; ++i) es2_cport_in_disable(es2, &es2->cport_in[i]); + gb_hd_del(es2->hd); + es2_destroy(es2); } @@ -942,6 +944,10 @@ static int ap_probe(struct usb_interface *interface, 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) @@ -953,6 +959,7 @@ static int ap_probe(struct usb_interface *interface, 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); |