Changeset 2dc5a9f in mainline
- Timestamp:
- 2013-01-26T18:59:37Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f4138ac
- Parents:
- b208b3b
- Location:
- uspace/lib/usbdev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/include/usb/dev/driver.h
rb208b3b r2dc5a9f 158 158 const usb_endpoint_description_t **, const uint8_t *, size_t, int, int, 159 159 usb_endpoint_mapping_t **, size_t *); 160 void usb_device_destroy_pipes(usb_ endpoint_mapping_t *, size_t);160 void usb_device_destroy_pipes(usb_device_t *); 161 161 162 162 usb_pipe_t *usb_device_get_default_pipe(usb_device_t *); -
uspace/lib/usbdev/src/devdrv.c
rb208b3b r2dc5a9f 54 54 } 55 55 56 /** Destroy existing pipes of a USB device.57 *58 * @param dev Device where to destroy the pipes.59 */60 static void destroy_current_pipes(usb_device_t *dev)61 {62 usb_device_destroy_pipes(dev->pipes, dev->pipes_count);63 dev->pipes = NULL;64 dev->pipes_count = 0;65 }66 67 56 /** Change interface setting of a device. 68 57 * This function selects new alternate setting of an interface by issuing … … 95 84 96 85 /* Destroy existing pipes. */ 97 destroy_current_pipes(dev);86 usb_device_destroy_pipes(dev); 98 87 99 88 /* Change the interface itself. */ … … 257 246 /** Destroy pipes previously created by usb_device_create_pipes. 258 247 * 259 * @param[in] pipes Endpoint mapping to be destroyed. 260 * @param[in] pipes_count Number of endpoints. 261 */ 262 void usb_device_destroy_pipes(usb_endpoint_mapping_t *pipes, size_t pipes_count) 263 { 248 * @param[in] usb_dev USB device. 249 */ 250 void usb_device_destroy_pipes(usb_device_t *usb_dev) 251 { 252 assert(usb_dev); 253 assert(usb_dev->pipes || usb_dev->pipes_count == 0); 264 254 /* Destroy the pipes. */ 265 for (size_t i = 0; i < pipes_count; ++i) { 266 assert(pipes); 255 for (size_t i = 0; i < usb_dev->pipes_count; ++i) { 267 256 usb_log_debug2("Unregistering pipe %zu: %spresent.\n", 268 i, pipes[i].present ? "" : "not "); 269 if (pipes[i].present) 270 usb_pipe_unregister(&pipes[i].pipe); 271 } 272 free(pipes); 257 i, usb_dev->pipes[i].present ? "" : "not "); 258 if (usb_dev->pipes[i].present) 259 usb_pipe_unregister(&usb_dev->pipes[i].pipe); 260 } 261 free(usb_dev->pipes); 262 usb_dev->pipes = NULL; 263 usb_dev->pipes_count = 0; 273 264 } 274 265 … … 424 415 usb_dev_session_close(dev->bus_session); 425 416 /* Destroy existing pipes. */ 426 destroy_current_pipes(dev);417 usb_device_destroy_pipes(dev); 427 418 /* Ignore errors and hope for the best. */ 428 419 usb_hc_connection_deinitialize(&dev->hc_conn);
Note:
See TracChangeset
for help on using the changeset viewer.