Changes in uspace/drv/bus/usb/usbmid/main.c [5203e256:065064e6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/main.c
r5203e256 r065064e6 49 49 * @return Error code. 50 50 */ 51 static int usbmid_ add_device(usb_device_t *dev)51 static int usbmid_device_add(usb_device_t *dev) 52 52 { 53 53 usb_log_info("Taking care of new MID `%s'.\n", dev->ddf_dev->name); … … 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 return ret; 106 } 107 68 108 /** USB MID driver ops. */ 69 109 static usb_driver_ops_t mid_driver_ops = { 70 .add_device = usbmid_add_device, 110 .device_add = usbmid_device_add, 111 .device_gone = usbmid_device_gone, 71 112 }; 72 113
Note:
See TracChangeset
for help on using the changeset viewer.