Changeset 59c163c in mainline
- Timestamp:
- 2011-10-31T11:49:15Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1e6dc5b
- Parents:
- 90d7033
- Location:
- uspace/lib/usbdev/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/hub.c
r90d7033 r59c163c 179 179 * @param[in] dev_ops Child device ops. Will use default if not provided. 180 180 * @param[in] new_dev_data Arbitrary pointer to be stored in the child 181 * as @c driver_data. 181 * as @c driver_data. Will allocate and assign usb_hub_attached_device_t 182 * structure if NULL. 182 183 * @param[out] new_fun Storage where pointer to allocated child function 183 184 * will be written. Must be non-null. … … 219 220 } 220 221 221 222 222 /* 223 223 * Request new address. … … 328 328 } 329 329 330 /*331 * And now inform the host controller about the handle.332 */333 330 const usb_hub_attached_device_t new_device = { 334 331 .address = dev_addr, 335 332 .fun = child_fun, 336 333 }; 334 335 336 /* 337 * And now inform the host controller about the handle. 338 */ 337 339 rc = usb_hc_register_device(&hc_conn, &new_device); 338 340 if (rc != EOK) { 341 /* We know nothing about that data. */ 342 if (new_dev_data) 343 child_fun->driver_data = NULL; 339 344 /* The child function is already created. */ 340 child_fun->driver_data = NULL;341 345 ddf_fun_destroy(child_fun); 342 346 rc = EDESTADDRREQ; -
uspace/lib/usbdev/src/recognise.c
r90d7033 r59c163c 35 35 #include <sys/types.h> 36 36 #include <fibril_synch.h> 37 #include <usb/debug.h> 38 #include <usb/dev/hub.h> 37 39 #include <usb/dev/pipes.h> 38 40 #include <usb/dev/recognise.h> … … 353 355 return EINVAL; 354 356 357 if (!dev_ops && dev_data) { 358 usb_log_warning("Using standard fun ops with arbitrary " 359 "driver data. This does not have to work.\n"); 360 } 361 355 362 size_t this_device_name_index; 356 363 … … 366 373 usb_pipe_t ctrl_pipe; 367 374 368 rc = usb_device_connection_initialize( &dev_connection, hc_handle, address);369 if (rc != EOK) {370 goto failure;371 }372 373 rc = usb_pipe_initialize_default_control(&ctrl_pipe, 374 375 rc = usb_device_connection_initialize( 376 &dev_connection, hc_handle, address); 377 if (rc != EOK) { 378 goto failure; 379 } 380 381 rc = usb_pipe_initialize_default_control(&ctrl_pipe, &dev_connection); 375 382 if (rc != EOK) { 376 383 goto failure; … … 405 412 406 413 child->driver_data = dev_data; 414 /* Store the attached device in fun driver data if there is no 415 * other data */ 416 if (!dev_data) { 417 usb_hub_attached_device_t *new_device = ddf_fun_data_alloc( 418 child, sizeof(usb_hub_attached_device_t)); 419 if (!new_device) { 420 rc = ENOMEM; 421 goto failure; 422 } 423 new_device->address = address; 424 new_device->fun = child; 425 } 426 407 427 408 428 rc = usb_device_create_match_ids(&ctrl_pipe, &child->match_ids); … … 421 441 failure: 422 442 if (child != NULL) { 423 /* This was not malloced by us, does not even have to be 424 * on heap. */ 425 child->driver_data = NULL; 443 /* We know nothing about the data if it came from outside. */ 444 if (dev_data) { 445 child->driver_data = NULL; 446 } 426 447 /* This takes care of match_id deallocation as well. */ 427 448 ddf_fun_destroy(child);
Note:
See TracChangeset
for help on using the changeset viewer.