From 6892537f61b1eac275ad50e093708e5e3c8664bd Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 20 Oct 2014 10:27:59 -0500 Subject: [PATCH] greybus: move ap_disconnect() The next patch has ap_probe() reference ap_disconnect(). To prepare for that, move ap_disconnect() up in the file. This is done as a separate commit to make it easier to see this move involves no other change to that function. This and the next commit can be squashed if desired. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/es1-ap-usb.c | 58 ++++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/staging/greybus/es1-ap-usb.c b/drivers/staging/greybus/es1-ap-usb.c index 21db78fb863f..4473c9af97c6 100644 --- a/drivers/staging/greybus/es1-ap-usb.c +++ b/drivers/staging/greybus/es1-ap-usb.c @@ -266,6 +266,35 @@ static int check_urb_status(struct urb *urb) return -EAGAIN; } +static void ap_disconnect(struct usb_interface *interface) +{ + struct es1_ap_dev *es1; + int i; + + es1 = usb_get_intfdata(interface); + if (!es1) + return; + + /* Tear down everything! */ + for (i = 0; i < NUM_CPORT_OUT_URB; ++i) { + usb_kill_urb(es1->cport_out_urb[i]); + usb_free_urb(es1->cport_out_urb[i]); + } + + for (i = 0; i < NUM_CPORT_IN_URB; ++i) { + usb_kill_urb(es1->cport_in_urb[i]); + usb_free_urb(es1->cport_in_urb[i]); + kfree(es1->cport_in_buffer[i]); + } + + usb_kill_urb(es1->svc_urb); + usb_free_urb(es1->svc_urb); + usb_put_dev(es1->usb_dev); + kfree(es1->svc_buffer); + greybus_remove_hd(es1->hd); + usb_set_intfdata(interface, NULL); +} + /* Callback for when we get a SVC message */ static void svc_in_callback(struct urb *urb) { @@ -503,35 +532,6 @@ error: return retval; } -static void ap_disconnect(struct usb_interface *interface) -{ - struct es1_ap_dev *es1; - int i; - - es1 = usb_get_intfdata(interface); - if (!es1) - return; - - /* Tear down everything! */ - for (i = 0; i < NUM_CPORT_OUT_URB; ++i) { - usb_kill_urb(es1->cport_out_urb[i]); - usb_free_urb(es1->cport_out_urb[i]); - } - - for (i = 0; i < NUM_CPORT_IN_URB; ++i) { - usb_kill_urb(es1->cport_in_urb[i]); - usb_free_urb(es1->cport_in_urb[i]); - kfree(es1->cport_in_buffer[i]); - } - - usb_kill_urb(es1->svc_urb); - usb_free_urb(es1->svc_urb); - usb_put_dev(es1->usb_dev); - kfree(es1->svc_buffer); - greybus_remove_hd(es1->hd); - usb_set_intfdata(interface, NULL); -} - static struct usb_driver es1_ap_driver = { .name = "es1_ap_driver", .probe = ap_probe, -- 2.39.5