Changeset a39cfb8 in mainline for uspace/srv/devman/main.c
- Timestamp:
- 2011-04-14T07:54:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e05d6c3
- Parents:
- 3f3afb9 (diff), 34e8bab (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r3f3afb9 ra39cfb8 95 95 /* Find driver structure. */ 96 96 driver = find_driver(&drivers_list, drv_name); 97 98 97 if (driver == NULL) { 99 98 log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name); … … 107 106 drv_name = NULL; 108 107 108 fibril_mutex_lock(&driver->driver_mutex); 109 110 if (driver->phone >= 0) { 111 /* We already have a connection to the driver. */ 112 log_msg(LVL_ERROR, "Driver '%s' already started.\n", 113 driver->name); 114 fibril_mutex_unlock(&driver->driver_mutex); 115 async_answer_0(iid, EEXISTS); 116 return NULL; 117 } 118 119 switch (driver->state) { 120 case DRIVER_NOT_STARTED: 121 /* Somebody started the driver manually. */ 122 log_msg(LVL_NOTE, "Driver '%s' started manually.\n", 123 driver->name); 124 driver->state = DRIVER_STARTING; 125 break; 126 case DRIVER_STARTING: 127 /* The expected case */ 128 break; 129 case DRIVER_RUNNING: 130 /* Should not happen since we do not have a connected phone */ 131 assert(false); 132 } 133 109 134 /* Create connection to the driver. */ 110 135 log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.", … … 113 138 ipc_callid_t callid = async_get_call(&call); 114 139 if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) { 140 fibril_mutex_unlock(&driver->driver_mutex); 115 141 async_answer_0(callid, ENOTSUP); 116 142 async_answer_0(iid, ENOTSUP); … … 119 145 120 146 /* Remember driver's phone. */ 121 set_driver_phone(driver, IPC_GET_ARG5(call)); 147 driver->phone = IPC_GET_ARG5(call); 148 149 fibril_mutex_unlock(&driver->driver_mutex); 122 150 123 151 log_msg(LVL_NOTE, … … 579 607 method = DRIVER_CLIENT; 580 608 581 if (driver->phone < =0) {609 if (driver->phone < 0) { 582 610 log_msg(LVL_ERROR, 583 611 "Could not forward to driver `%s' (phone is %d).", … … 619 647 dev = fun->dev; 620 648 621 if (dev->state != DEVICE_USABLE || dev->drv->phone < =0) {649 if (dev->state != DEVICE_USABLE || dev->drv->phone < 0) { 622 650 async_answer_0(iid, EINVAL); 623 651 return;
Note:
See TracChangeset
for help on using the changeset viewer.