Changeset a60e90b in mainline for uspace/srv/devman/driver.c
- Timestamp:
- 2013-09-10T20:15:58Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 08bc23d
- Parents:
- 59dc181
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/driver.c
r59dc181 ra60e90b 44 44 #include "devman.h" 45 45 #include "driver.h" 46 #include "match.h" 46 47 47 48 /** … … 511 512 } 512 513 514 /** Pass a device to running driver. 515 * 516 * @param drv The driver's structure. 517 * @param node The device's node in the device tree. 518 */ 519 void add_device(driver_t *drv, dev_node_t *dev, dev_tree_t *tree) 520 { 521 /* 522 * We do not expect to have driver's mutex locked as we do not 523 * access any structures that would affect driver_t. 524 */ 525 log_msg(LOG_DEFAULT, LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")", 526 drv->name, dev->pfun->name); 527 528 /* Send the device to the driver. */ 529 devman_handle_t parent_handle; 530 if (dev->pfun) { 531 parent_handle = dev->pfun->handle; 532 } else { 533 parent_handle = 0; 534 } 535 536 async_exch_t *exch = async_exchange_begin(drv->sess); 537 538 ipc_call_t answer; 539 aid_t req = async_send_2(exch, DRIVER_DEV_ADD, dev->handle, 540 parent_handle, &answer); 541 542 /* Send the device name to the driver. */ 543 sysarg_t rc = async_data_write_start(exch, dev->pfun->name, 544 str_size(dev->pfun->name) + 1); 545 546 async_exchange_end(exch); 547 548 if (rc != EOK) { 549 /* TODO handle error */ 550 } 551 552 /* Wait for answer from the driver. */ 553 async_wait_for(req, &rc); 554 555 switch(rc) { 556 case EOK: 557 dev->state = DEVICE_USABLE; 558 break; 559 case ENOENT: 560 dev->state = DEVICE_NOT_PRESENT; 561 break; 562 default: 563 dev->state = DEVICE_INVALID; 564 break; 565 } 566 567 dev->passed_to_driver = true; 568 569 return; 570 } 571 513 572 int driver_dev_remove(dev_tree_t *tree, dev_node_t *dev) 514 573 {
Note:
See TracChangeset
for help on using the changeset viewer.