Changeset 3002434 in mainline
- Timestamp:
- 2011-10-14T12:19:42Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cc29622
- Parents:
- 87037cc9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/main.c
r87037cc9 r3002434 82 82 void *arg); 83 83 84 /** Callback when a device is removed from the system. 85 * 86 * @param dev Representation of USB device. 87 * @return Error code. 88 */ 89 static int usbmast_device_gone(usb_device_t *dev) 90 { 91 usbmast_dev_t *mdev = dev->driver_data; 92 assert(mdev); 93 94 for (size_t i = 0; i < mdev->lun_count; ++i) { 95 const int rc = ddf_fun_unbind(mdev->luns[i]); 96 if (rc != EOK) { 97 usb_log_error("Failed to unbind LUN function %zu: " 98 "%s\n", i, str_error(rc)); 99 return rc; 100 } 101 ddf_fun_destroy(mdev->luns[i]); 102 mdev->luns[i] = NULL; 103 } 104 free(mdev->luns); 105 free(mdev); 106 return EOK; 107 } 108 84 109 /** Callback when new device is attached and recognized as a mass storage. 85 110 * … … 128 153 return EOK; 129 154 error: 130 /* XXX Destroy functions */ 155 /* Destroy functions */ 156 for (size_t i = 0; i < mdev->lun_count; ++i) { 157 if (mdev->luns[i] == NULL) 158 continue; 159 const int rc = ddf_fun_unbind(mdev->luns[i]); 160 if (rc != EOK) { 161 usb_log_warning("Failed to unbind LUN function %zu: " 162 "%s.\n", i, str_error(rc)); 163 } 164 ddf_fun_destroy(mdev->luns[i]); 165 } 166 free(mdev->luns); 167 free(mdev); 131 168 return rc; 132 169 } … … 303 340 static usb_driver_ops_t usbmast_driver_ops = { 304 341 .device_add = usbmast_device_add, 342 .device_gone = usbmast_device_gone, 305 343 }; 306 344
Note:
See TracChangeset
for help on using the changeset viewer.