summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-09-06 08:40:32 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-09-11 13:31:47 +0200
commitb895498df9be02eba1c285c5cdc58eb088bb86fc (patch)
tree724d99c61b5a0d2cf83dc69025bc7f432869a25c /src
parentc9869466ddfab7e7f6258397d1b8863c27e37149 (diff)
downloadsecure-hid-b895498df9be02eba1c285c5cdc58eb088bb86fc.tar.gz
secure-hid-b895498df9be02eba1c285c5cdc58eb088bb86fc.tar.bz2
secure-hid-b895498df9be02eba1c285c5cdc58eb088bb86fc.zip
hub: use common code to remove device
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/usbh_core.c2
-rw-r--r--src/usbh_driver_hub.c7
2 files changed, 2 insertions, 7 deletions
diff --git a/src/usbh_core.c b/src/usbh_core.c
index e673a59..fd1dca5 100644
--- a/src/usbh_core.c
+++ b/src/usbh_core.c
@@ -52,7 +52,7 @@ static bool enumeration(void)
return usbh_data.enumeration_run;
}
-static void device_remove(usbh_device_t *dev)
+void device_remove(usbh_device_t *dev)
{
if (dev->drv && dev->drvdata) {
dev->drv->remove(dev->drvdata);
diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c
index 87f8578..7dc99ea 100644
--- a/src/usbh_driver_hub.c
+++ b/src/usbh_driver_hub.c
@@ -449,13 +449,8 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
}
} else {
LOG_PRINTF("\t\t\t\tDISCONNECT EVENT\n");
- if (hub->device[port]->drv && hub->device[port]->drvdata) {
- hub->device[port]->drv->remove(hub->device[port]->drvdata);
- }
- hub->device[port]->address = -1;
+ device_remove(hub->device[port]);
- hub->device[port]->drv = 0;
- hub->device[port]->drvdata = 0;
hub->device[port] = 0;
hub->current_port = CURRENT_PORT_NONE;
hub->state = EVENT_STATE_POLL_REQ;