Changes in uspace/srv/devman/driver.c [5aa06ad:c3d9aaf5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/driver.c
r5aa06ad rc3d9aaf5 1 1 /* 2 * Copyright (c) 20 18Jiri Svoboda2 * Copyright (c) 2025 Jiri Svoboda 3 3 * Copyright (c) 2010 Lenka Trochtova 4 4 * All rights reserved. … … 284 284 dev->drv = drv; 285 285 dev->passed_to_driver = false; 286 dev->state = DEVICE_NOT_INITIALIZED; 286 fibril_mutex_lock(&dev->state_lock); 287 dev->state = DEVICE_ATTACHING; 288 fibril_mutex_unlock(&dev->state_lock); 289 fibril_condvar_broadcast(&dev->state_cv); 287 290 list_append(&dev->driver_devices, &drv->devices); 288 291 … … 631 634 void add_device(driver_t *drv, dev_node_t *dev, dev_tree_t *tree) 632 635 { 636 link_t *link; 637 fun_node_t *fun; 638 633 639 /* 634 640 * We do not expect to have driver's mutex locked as we do not … … 664 670 async_wait_for(req, &rc); 665 671 } 672 673 if (rc == EOK) { 674 log_msg(LOG_DEFAULT, LVL_DEBUG, "Device was added. Wait for " 675 "child functions' devices to stabilize."); 676 fibril_rwlock_read_lock(&tree->rwlock); 677 link = list_first(&dev->functions); 678 while (link != NULL) { 679 fun = list_get_instance(link, fun_node_t, 680 dev_functions); 681 682 if (fun->child != NULL) { 683 log_msg(LOG_DEFAULT, LVL_DEBUG2, "Wait for " 684 "child device %p.", (void *)fun->child); 685 fun_add_ref(fun); 686 fibril_rwlock_read_unlock(&tree->rwlock); 687 dev_wait_stable(fun->child); 688 fibril_rwlock_read_lock(&tree->rwlock); 689 fun_del_ref(fun); 690 } 691 692 link = list_next(link, &dev->functions); 693 } 694 695 fibril_rwlock_read_unlock(&tree->rwlock); 696 log_msg(LOG_DEFAULT, LVL_DEBUG, 697 "Finished waiting for children."); 698 } 699 700 fibril_mutex_lock(&dev->state_lock); 666 701 667 702 switch (rc) { … … 677 712 } 678 713 714 fibril_mutex_unlock(&dev->state_lock); 715 fibril_condvar_broadcast(&dev->state_cv); 716 679 717 dev->passed_to_driver = true; 680 718 }
Note:
See TracChangeset
for help on using the changeset viewer.