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


Ignore:
Timestamp:
2010-02-26T14:22:33Z (15 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
67ba309
Parents:
92413de
Message:

backup (unstable)

File:
1 edited

Legend:

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

    r92413de rc16cf62  
    428428}
    429429
     430void set_driver_phone(driver_t *driver, ipcarg_t phone)
     431{               
     432        fibril_mutex_lock(&driver->driver_mutex);       
     433        assert(DRIVER_STARTING == driver->state);
     434        driver->phone = phone; 
     435        fibril_mutex_unlock(&driver->driver_mutex);     
     436}
     437
     438/**
     439 * Notify driver about the devices to which it was assigned.
     440 *
     441 * The driver's mutex must be locked.
     442 *
     443 * @param driver the driver to which the devices are passed.
     444 */
     445static void pass_devices_to_driver(driver_t *driver)
     446{       
     447        node_t *dev;
     448        link_t *link;
     449       
     450        link = driver->devices.next;
     451        while (link != &driver->devices) {
     452                dev = list_get_instance(link, node_t, driver_devices);
     453                add_device(driver, dev);
     454                link = link->next;
     455        }       
     456}
     457
     458/** Finish the initialization of a driver after it has succesfully started and registered itself by the device manager.
     459 *
     460 * Pass devices formerly matched to the driver to the driver and remember the driver is running and fully functional now.
     461 *
     462 * @param driver the driver which registered itself as running by the device manager.
     463 */
     464void initialize_running_driver(driver_t *driver)
     465{
     466        fibril_mutex_lock(&driver->driver_mutex);
     467       
     468        // pass devices which have been already assigned to the driver to the driver
     469        pass_devices_to_driver(driver);
     470       
     471        // change driver's state to running
     472        driver->state = DRIVER_RUNNING;
     473       
     474        fibril_mutex_unlock(&driver->driver_mutex);
     475}
     476
    430477/** Pass a device to running driver.
    431478 *
    432479 * @param drv the driver's structure.
    433480 * @param node the device's node in the device tree.
    434  *
    435  * @return true on success, false otherwise.
    436  */
    437 bool add_device(driver_t *drv, node_t *node)
     481 */
     482void add_device(driver_t *drv, node_t *node)
    438483{
    439484        printf(NAME ": add_device\n");
     
    506551}
    507552
     553/** @}
     554 */
Note: See TracChangeset for help on using the changeset viewer.