Changes in uspace/drv/bus/usb/usbmid/main.c [5153b58:aa05b29] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/main.c
r5153b58 raa05b29 68 68 /** Callback when a MID device is about to be removed from the host. 69 69 * 70 * @param dev USBdevice representing the removed device.70 * @param gen_dev Generic DDF device representing the removed device. 71 71 * @return Error code. 72 72 */ … … 74 74 { 75 75 assert(dev); 76 int ret = ENOTSUP; 76 77 usb_mid_t *usb_mid = dev->driver_data; 77 78 assert(usb_mid); 78 79 79 /* Remove ctl function */ 80 int ret = ddf_fun_unbind(usb_mid->ctl_fun); 81 if (ret != EOK) { 82 usb_log_error("Failed to unbind USB MID ctl function: %s.\n", 83 str_error(ret)); 84 return ret; 85 } 86 ddf_fun_destroy(usb_mid->ctl_fun); 87 88 /* Remove all children */ 89 while (!list_empty(&usb_mid->interface_list)) { 90 link_t *item = list_first(&usb_mid->interface_list); 91 list_remove(item); 92 80 /* Signal all interface functions */ 81 list_foreach(usb_mid->interface_list, item) { 93 82 usbmid_interface_t *iface = usbmid_interface_from_link(item); 94 83 95 usb_log_info(" Removing child for interface %d (%s).\n",96 iface->interface_no,84 usb_log_info("Signaling remove to child for interface " 85 "%d (%s).\n", iface->interface_no, 97 86 usb_str_class(iface->interface->interface_class)); 98 99 /* Tell the child to go off-line. */ 100 int pret = ddf_fun_offline(iface->fun); 101 if (pret != EOK) { 102 usb_log_warning("Failed to turn off child for interface" 103 " %d (%s): %s\n", iface->interface_no, 104 usb_str_class(iface->interface->interface_class), 105 str_error(pret)); 106 ret = pret; 107 } 108 109 /* Now remove the child. */ 110 pret = usbmid_interface_destroy(iface); 111 if (pret != EOK) { 112 usb_log_error("Failed to destroy child for interface " 113 "%d (%s): %s\n", iface->interface_no, 114 usb_str_class(iface->interface->interface_class), 115 str_error(pret)); 116 ret = pret; 117 } 87 // TODO cascade the call. 118 88 } 119 89 return ret; … … 122 92 /** Callback when a MID device was removed from the host. 123 93 * 124 * @param dev USBdevice representing the removed device.94 * @param gen_dev Generic DDF device representing the removed device. 125 95 * @return Error code. 126 96 */ … … 128 98 { 129 99 assert(dev); 130 usb_mid_t *usb_mid = dev->driver_data;131 assert(usb_mid);132 133 100 usb_log_info("USB MID gone: `%s'.\n", dev->ddf_dev->name); 134 101 135 102 /* Remove ctl function */ 103 usb_mid_t *usb_mid = dev->driver_data; 136 104 int ret = ddf_fun_unbind(usb_mid->ctl_fun); 137 105 if (ret != EOK) { … … 149 117 usbmid_interface_t *iface = usbmid_interface_from_link(item); 150 118 151 usb_log_info(" Child for interface %d (%s) gone.\n",119 usb_log_info("Removing child for interface %d (%s).\n", 152 120 iface->interface_no, 153 121 usb_str_class(iface->interface->interface_class));
Note:
See TracChangeset
for help on using the changeset viewer.