Changeset e1e4192 in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2012-06-03T20:45:58Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
90478727
Parents:
f7e69f5 (diff), 3123d2a (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.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    rf7e69f5 re1e4192  
    245245       
    246246        fibril_rwlock_write_lock(&device_tree.rwlock);
    247 
     247       
    248248        if (fun->state == FUN_ON_LINE) {
    249249                fibril_rwlock_write_unlock(&device_tree.rwlock);
     
    259259                        return ENOMEM;
    260260                }
    261 
     261               
    262262                insert_dev_node(&device_tree, dev, fun);
    263263                dev_add_ref(dev);
     
    272272                /* Give one reference over to assign_driver_fibril(). */
    273273                dev_add_ref(dev);
     274               
    274275                /*
    275276                 * Try to find a suitable driver and assign it to the device.  We do
     
    288289                }
    289290                fibril_add_ready(assign_fibril);
    290         } else {
     291        } else
    291292                loc_register_tree_function(fun, &device_tree);
    292         }
    293293       
    294294        fibril_rwlock_write_unlock(&device_tree.rwlock);
     
    11491149                if (dev->pfun->dev != NULL)
    11501150                        driver = dev->pfun->dev->drv;
     1151               
    11511152                fwd_h = dev->pfun->handle;
    11521153        } else if (dev->state == DEVICE_USABLE) {
     
    11541155                driver = dev->drv;
    11551156                assert(driver != NULL);
    1156 
     1157               
    11571158                fwd_h = handle;
    11581159        }
     
    11811182
    11821183        if (fun != NULL) {
    1183                 log_msg(LVL_DEBUG, 
     1184                log_msg(LVL_DEBUG,
    11841185                    "Forwarding request for `%s' function to driver `%s'.",
    11851186                    fun->pathname, driver->name);
    11861187        } else {
    1187                 log_msg(LVL_DEBUG, 
     1188                log_msg(LVL_DEBUG,
    11881189                    "Forwarding request for `%s' device to driver `%s'.",
    11891190                    dev->pfun->pathname, driver->name);
     
    11931194        async_forward_fast(iid, exch, method, fwd_h, 0, IPC_FF_NONE);
    11941195        async_exchange_end(exch);
    1195 
     1196       
    11961197cleanup:
    11971198        if (dev != NULL)
    11981199                dev_del_ref(dev);
     1200       
    11991201        if (fun != NULL)
    12001202                fun_del_ref(fun);
     
    12991301                return false;
    13001302        }
    1301 
     1303       
    13021304        log_msg(LVL_DEBUG, "devman_init - list of drivers has been initialized.");
    1303 
     1305       
    13041306        /* Create root device node. */
    13051307        if (!init_device_tree(&device_tree, &drivers_list)) {
     
    13071309                return false;
    13081310        }
    1309 
     1311       
    13101312        /*
    13111313         * Caution: As the device manager is not a real loc
     
    13221324int main(int argc, char *argv[])
    13231325{
    1324         printf(NAME ": HelenOS Device Manager\n");
    1325 
    1326         if (log_init(NAME, LVL_WARN) != EOK) {
    1327                 printf(NAME ": Error initializing logging subsystem.\n");
    1328                 return -1;
     1326        printf("%s: HelenOS Device Manager\n", NAME);
     1327       
     1328        int rc = log_init(NAME, LVL_WARN);
     1329        if (rc != EOK) {
     1330                printf("%s: Error initializing logging subsystem.\n", NAME);
     1331                return rc;
    13291332        }
    13301333       
     
    13331336        async_set_client_data_destructor(devman_client_data_destroy);
    13341337        async_set_client_connection(devman_connection);
    1335 
     1338       
    13361339        if (!devman_init()) {
    13371340                log_msg(LVL_ERROR, "Error while initializing service.");
    13381341                return -1;
    13391342        }
    1340 
     1343       
    13411344        /* Register device manager at naming service. */
    1342         if (service_register(SERVICE_DEVMAN) != EOK) {
     1345        rc = service_register(SERVICE_DEVMAN);
     1346        if (rc != EOK) {
    13431347                log_msg(LVL_ERROR, "Failed registering as a service.");
    1344                 return -1;
    1345         }
    1346 
    1347         printf(NAME ": Accepting connections.\n");
     1348                return rc;
     1349        }
     1350       
     1351        printf("%s: Accepting connections.\n", NAME);
    13481352        task_retval(0);
    13491353        async_manager();
    1350 
     1354       
    13511355        /* Never reached. */
    13521356        return 0;
Note: See TracChangeset for help on using the changeset viewer.