Changeset b72efe8 in mainline for uspace/srv/devman/devman.c


Ignore:
Timestamp:
2011-06-19T14:38:59Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
74464e8
Parents:
1d1bb0f
Message:

Separate list_t typedef from link_t (user-space part).

  • list_t represents lists
  • Use list_first(), list_last(), list_empty() where appropriate
  • Use list_foreach() where possible
  • assert_link_not_used()
  • usb_hid_report_path_free() shall not unlink the path, caller must do it
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/devman.c

    r1d1bb0f rb72efe8  
    466466        fibril_mutex_lock(&drivers_list->drivers_mutex);
    467467       
    468         link_t *link = drivers_list->drivers.next;
    469         while (link != &drivers_list->drivers) {
     468        list_foreach(drivers_list->drivers, link) {
    470469                drv = list_get_instance(link, driver_t, drivers);
    471470                score = get_match_score(drv, node);
     
    474473                        best_drv = drv;
    475474                }
    476                 link = link->next;
    477475        }
    478476       
     
    536534        driver_t *res = NULL;
    537535        driver_t *drv = NULL;
    538         link_t *link;
    539536       
    540537        fibril_mutex_lock(&drv_list->drivers_mutex);
    541538       
    542         link = drv_list->drivers.next;
    543         while (link != &drv_list->drivers) {
     539        list_foreach(drv_list->drivers, link) {
    544540                drv = list_get_instance(link, driver_t, drivers);
    545541                if (str_cmp(drv->name, drv_name) == 0) {
     
    547543                        break;
    548544                }
    549 
    550                 link = link->next;
    551545        }
    552546       
     
    584578         * that has not been passed to the driver.
    585579         */
    586         link = driver->devices.next;
    587         while (link != &driver->devices) {
     580        link = driver->devices.head.next;
     581        while (link != &driver->devices.head) {
    588582                dev = list_get_instance(link, dev_node_t, driver_devices);
    589583                if (dev->passed_to_driver) {
     
    622616                 * Restart the cycle to go through all devices again.
    623617                 */
    624                 link = driver->devices.next;
     618                link = driver->devices.head.next;
    625619        }
    626620
     
    11871181
    11881182        fun_node_t *fun;
    1189         link_t *link;
    1190 
    1191         for (link = dev->functions.next;
    1192             link != &dev->functions;
    1193             link = link->next) {
     1183
     1184        list_foreach(dev->functions, link) {
    11941185                fun = list_get_instance(link, fun_node_t, dev_functions);
    11951186
     
    13851376{
    13861377        dev_class_t *cl;
    1387         link_t *link = class_list->classes.next;
    1388        
    1389         while (link != &class_list->classes) {
     1378       
     1379        list_foreach(class_list->classes, link) {
    13901380                cl = list_get_instance(link, dev_class_t, link);
    13911381                if (str_cmp(cl->name, class_name) == 0) {
    13921382                        return cl;
    13931383                }
    1394                 link = link->next;
    13951384        }
    13961385       
     
    14081397        assert(dev_name != NULL);
    14091398
    1410         link_t *link;
    1411         for (link = dev_class->devices.next;
    1412             link != &dev_class->devices;
    1413             link = link->next) {
     1399        list_foreach(dev_class->devices, link) {
    14141400                dev_class_info_t *dev = list_get_instance(link,
    14151401                    dev_class_info_t, link);
Note: See TracChangeset for help on using the changeset viewer.