Changeset 38b3baf in mainline for uspace/srv/devman/match.c


Ignore:
Timestamp:
2010-10-23T07:16:14Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7e66a5ec
Parents:
032e0bb
Message:

Cstyle fixes of devman.

File:
1 edited

Legend:

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

    r032e0bb r38b3baf  
    3030 * @{
    3131 */
    32  
    33  
     32
    3433#include <str.h>
    3534
    3635#include "devman.h"
    3736
    38 
    3937int get_match_score(driver_t *drv, node_t *dev)
    40 {       
    41         link_t* drv_head = &drv->match_ids.ids;
    42         link_t* dev_head = &dev->match_ids.ids;
     38{
     39        link_t *drv_head = &drv->match_ids.ids;
     40        link_t *dev_head = &dev->match_ids.ids;
    4341       
    44         if (list_empty(drv_head) || list_empty(dev_head)) {
     42        if (list_empty(drv_head) || list_empty(dev_head))
    4543                return 0;
    46         }
    4744       
    48         link_t* drv_link = drv->match_ids.ids.next;
    49         link_t* dev_link = dev->match_ids.ids.next;
     45        link_t *drv_link = drv->match_ids.ids.next;
     46        link_t *dev_link = dev->match_ids.ids.next;
    5047       
    5148        match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link);
     
    5653       
    5754        do {
    58                 if (0 == str_cmp(drv_id->id, dev_id->id)) {     // we found a match     
    59                         // return the score of the match
     55                match_id_t *tmp_ma_id;
     56       
     57                if (0 == str_cmp(drv_id->id, dev_id->id)) {
     58                        /*
     59                         * We found a match.
     60                         * Return the score of the match.
     61                         */
    6062                        return drv_id->score * dev_id->score;
    6163                }
    6264               
    63                 // compute the next score we get, if we advance in the driver's list of match ids
     65                /*
     66                 * Compute the next score we get, if we advance in the driver's
     67                 * list of match ids.
     68                 */
    6469                if (drv_head != drv_link->next) {
    65                         score_next_drv = dev_id->score * list_get_instance(drv_link->next, match_id_t, link)->score;                   
     70                        tmp_ma_id = list_get_instance(drv_link->next,
     71                            match_id_t, link);
     72                        score_next_drv = dev_id->score * tmp_ma_id->score;
    6673                } else {
    6774                        score_next_drv = 0;
    6875                }
    6976               
    70                 // compute the next score we get, if we advance in the device's list of match ids
     77                /*
     78                 * Compute the next score we get, if we advance in the device's
     79                 * list of match ids.
     80                 */
    7181                if (dev_head != dev_link->next) {
    72                         score_next_dev = drv_id->score * list_get_instance(dev_link->next, match_id_t, link)->score;                   
     82                        tmp_ma_id = list_get_instance(dev_link->next,
     83                            match_id_t, link);
     84                        score_next_dev = drv_id->score * tmp_ma_id->score;
    7385                } else {
    7486                        score_next_dev = 0;
    7587                }
    7688               
    77                 // advance in one of the two lists, so we get the next highest score
     89                /*
     90                 * Advance in one of the two lists, so we get the next highest
     91                 * score.
     92                 */
    7893                if (score_next_drv > score_next_dev) {
    7994                        drv_link = drv_link->next;
     
    89104}
    90105
    91 
    92 
     106/** @}
     107 */
Note: See TracChangeset for help on using the changeset viewer.