Changeset 38e68ab in mainline
- Timestamp:
- 2011-10-14T09:36:23Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d8e698e7
- Parents:
- 344a0ac
- Location:
- uspace/drv/bus/usb/usbmid
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/main.c
r344a0ac r38e68ab 66 66 } 67 67 68 static int usbmid_device_gone(usb_device_t *dev) 69 { 70 assert(dev); 71 usb_log_info("USB MID gone: `%s'.\n", dev->ddf_dev->name); 72 73 /* Remove ctl function */ 74 usb_mid_t *usb_mid = dev->driver_data; 75 int ret = ddf_fun_unbind(usb_mid->ctl_fun); 76 if (ret != EOK) { 77 usb_log_error("Failed to unbind USB MID ctl function: %s.\n", 78 str_error(ret)); 79 return ret; 80 } 81 ddf_fun_destroy(usb_mid->ctl_fun); 82 83 /* Now remove all other functions */ 84 while (!list_empty(&usb_mid->interface_list)) { 85 link_t *item = list_first(&usb_mid->interface_list); 86 list_remove(item); 87 88 usbmid_interface_t *iface = list_get_instance(item, 89 usbmid_interface_t, link); 90 91 usb_log_info("Removing child for interface %d (%s).\n", 92 iface->interface_no, 93 usb_str_class(iface->interface->interface_class)); 94 95 const int pret = usbmid_interface_destroy(iface); 96 if (pret != EOK) { 97 usb_log_error("Failed to remove child for interface " 98 "%d (%s): %s\n", 99 iface->interface_no, 100 usb_str_class(iface->interface->interface_class), 101 str_error(pret)); 102 ret = pret; 103 } 104 } 105 free(usb_mid); 106 return ret; 107 } 108 68 109 /** USB MID driver ops. */ 69 110 static usb_driver_ops_t mid_driver_ops = { 70 111 .device_add = usbmid_device_add, 112 .device_gone = usbmid_device_gone, 71 113 }; 72 114 -
uspace/drv/bus/usb/usbmid/usbmid.c
r344a0ac r38e68ab 79 79 }; 80 80 81 int usbmid_interface_destroy(usbmid_interface_t *mid_iface) 82 { 83 assert(mid_iface); 84 assert_link_not_used(&mid_iface->link); 85 const int ret = ddf_fun_unbind(mid_iface->fun); 86 if (ret != EOK) { 87 return ret; 88 } 89 /* NOTE: interface memebr points somewhere, but we did not 90 * allocate that space, s leave it be */ 91 ddf_fun_destroy(mid_iface->fun); 92 free(mid_iface); 93 return EOK; 94 } 81 95 82 96 /** Spawn new child device from one interface. -
uspace/drv/bus/usb/usbmid/usbmid.h
r344a0ac r38e68ab 69 69 const usb_standard_interface_descriptor_t *); 70 70 void usbmid_dump_descriptors(uint8_t *, size_t); 71 int usbmid_interface_destroy(usbmid_interface_t *mid_iface); 71 72 72 73 #endif
Note:
See TracChangeset
for help on using the changeset viewer.