Commit 6892537f authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 6ff5e00a
...@@ -266,6 +266,35 @@ static int check_urb_status(struct urb *urb) ...@@ -266,6 +266,35 @@ static int check_urb_status(struct urb *urb)
return -EAGAIN; 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 */ /* Callback for when we get a SVC message */
static void svc_in_callback(struct urb *urb) static void svc_in_callback(struct urb *urb)
{ {
...@@ -503,35 +532,6 @@ static int ap_probe(struct usb_interface *interface, ...@@ -503,35 +532,6 @@ static int ap_probe(struct usb_interface *interface,
return retval; 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 = { static struct usb_driver es1_ap_driver = {
.name = "es1_ap_driver", .name = "es1_ap_driver",
.probe = ap_probe, .probe = ap_probe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment