Changeset b12d3cc in mainline
- Timestamp:
- 2010-11-26T14:56:09Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- da55d5b
- Parents:
- bbe7848 (diff), 0d6915f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
rbbe7848 rb12d3cc 165 165 166 166 devman_handle_t dev_handle = IPC_GET_ARG1(*icall); 167 devman_handle_t parent_dev_handle = IPC_GET_ARG2(*icall); 168 167 169 device_t *dev = create_device(); 168 170 dev->handle = dev_handle; … … 172 174 173 175 add_to_devices_list(dev); 176 dev->parent = driver_get_device(&devices, parent_dev_handle); 177 174 178 res = driver->driver_ops->add_device(dev); 175 179 if (0 == res) { -
uspace/srv/devman/devman.c
rbbe7848 rb12d3cc 651 651 652 652 /* Send the device to the driver. */ 653 aid_t req = async_send_1(phone, DRIVER_ADD_DEVICE, node->handle, 654 &answer); 653 devman_handle_t parent_handle; 654 if (node->parent) { 655 parent_handle = node->parent->handle; 656 } else { 657 parent_handle = 0; 658 } 659 aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, node->handle, 660 parent_handle, &answer); 655 661 656 662 /* Send the device's name to the driver. */ -
uspace/srv/devman/match.c
rbbe7848 rb12d3cc 35 35 #include "devman.h" 36 36 37 /** Compute compound score of driver and device. 38 * 39 * @param driver Match id of the driver. 40 * @param device Match id of the device. 41 * @return Compound score. 42 * @retval 0 No match at all. 43 */ 44 static int compute_match_score(match_id_t *driver, match_id_t *device) 45 { 46 if (str_cmp(driver->id, device->id) == 0) { 47 /* 48 * The strings matches, return their score multiplied. 49 */ 50 return driver->score * device->score; 51 } else { 52 /* 53 * Different strings, return zero. 54 */ 55 return 0; 56 } 57 } 58 37 59 int get_match_score(driver_t *drv, node_t *dev) 38 60 { … … 44 66 45 67 /* 46 * Find first matching pair.68 * Go through all pairs, return the highest score obtainetd. 47 69 */ 70 int highest_score = 0; 71 48 72 link_t *drv_link = drv->match_ids.ids.next; 49 73 while (drv_link != drv_head) { 50 link_t *dev_link = dev ->match_ids.ids.next;74 link_t *dev_link = dev_head->next; 51 75 while (dev_link != dev_head) { 52 76 match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link); 53 77 match_id_t *dev_id = list_get_instance(dev_link, match_id_t, link); 54 55 if (str_cmp(drv_id->id, dev_id->id) == 0) { 56 /* 57 * We found a match. 58 * Return the score of the match. 59 */ 60 return drv_id->score * dev_id->score; 78 79 int score = compute_match_score(drv_id, dev_id); 80 if (score > highest_score) { 81 highest_score = score; 61 82 } 62 83 63 84 dev_link = dev_link->next; 64 85 } 86 65 87 drv_link = drv_link->next; 66 88 } 67 89 68 return 0;90 return highest_score; 69 91 } 70 92
Note:
See TracChangeset
for help on using the changeset viewer.