Changeset 3843ecb in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2010-04-09T13:54:06Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
892e4e1
Parents:
3a5909f
Message:

device classes as interface sets

File:
1 edited

Legend:

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

    r3a5909f r3843ecb  
    121121}
    122122
     123/**
     124 * Receive device match ID from the device's parent driver and add it to the list of devices match ids.
     125 *
     126 * @param match_ids the list of the device's match ids.
     127 *
     128 * @return 0 on success, negative error code otherwise.
     129 */
    123130static int devman_receive_match_id(match_id_list_t *match_ids) {
    124131       
     
    159166}
    160167
     168/**
     169 * Receive device match IDs from the device's parent driver
     170 * and add them to the list of devices match ids.
     171 *
     172 * @param match_count the number of device's match ids to be received.
     173 * @param match_ids the list of the device's match ids.
     174 *
     175 * @return 0 on success, negative error code otherwise.
     176 */
    161177static int devman_receive_match_ids(ipcarg_t match_count, match_id_list_t *match_ids)
    162178{       
     
    171187}
    172188
    173 static void devman_add_child(ipc_callid_t callid, ipc_call_t *call, driver_t *driver)
     189/** Handle child device registration.
     190 *
     191 * Child devices are registered by their parent's device driver.
     192 */
     193static void devman_add_child(ipc_callid_t callid, ipc_call_t *call)
    174194{
    175195        // printf(NAME ": devman_add_child\n");
     
    211231}
    212232
     233/**
     234 * Initialize driver which has registered itself as running and ready.
     235 *
     236 * The initialization is done in a separate fibril to avoid deadlocks
     237 * (if the driver needed to be served by devman during the driver's initialization).
     238 */
    213239static int init_running_drv(void *drv)
    214240{
     
    219245}
    220246
    221 /** Function for handling connections to device manager.
    222  *
     247/** Function for handling connections from a driver to the device manager.
    223248 */
    224249static void devman_connection_driver(ipc_callid_t iid, ipc_call_t *icall)
     
    231256                return;
    232257       
     258        // Initialize the driver as running (e.g. pass assigned devices to it) in a separate fibril;
     259        // the separate fibril is used to enable the driver
     260        // to use devman service during the driver's initialization.
    233261        fid_t fid = fibril_create(init_running_drv, driver);
    234262        if (fid == 0) {
    235263                printf(NAME ": Error creating fibril for the initialization of the newly registered running driver.\n");
    236                 exit(1);
     264                return;
    237265        }
    238266        fibril_add_ready(fid);
     
    254282                        continue;
    255283                case DEVMAN_ADD_CHILD_DEVICE:
    256                         devman_add_child(callid, &call, driver);
     284                        devman_add_child(callid, &call);
    257285                        break;
    258286                default:
     
    299327       
    300328        if (driver->phone <= 0) {
    301                 printf(NAME ": devman_forward: cound not forward to driver %s (the driver's phone is %x).\n", driver->name, driver->phone);
     329                printf(NAME ": devman_forward: cound not forward to driver %s ", driver->name);
     330                printf("the driver's phone is %x).\n", driver->phone);
    302331                return;
    303332        }
Note: See TracChangeset for help on using the changeset viewer.