Changes in uspace/srv/devman/main.c [3ad7b1c:ebcb05a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
r3ad7b1c rebcb05a 95 95 /* Find driver structure. */ 96 96 driver = find_driver(&drivers_list, drv_name); 97 97 98 if (driver == NULL) { 98 99 log_msg(LVL_ERROR, "No driver named `%s' was found.", drv_name); … … 106 107 drv_name = NULL; 107 108 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 134 109 /* Create connection to the driver. */ 135 110 log_msg(LVL_DEBUG, "Creating connection to the `%s' driver.", … … 138 113 ipc_callid_t callid = async_get_call(&call); 139 114 if (IPC_GET_IMETHOD(call) != IPC_M_CONNECT_TO_ME) { 140 fibril_mutex_unlock(&driver->driver_mutex);141 115 async_answer_0(callid, ENOTSUP); 142 116 async_answer_0(iid, ENOTSUP); … … 145 119 146 120 /* Remember driver's phone. */ 147 driver->phone = IPC_GET_ARG5(call); 148 149 fibril_mutex_unlock(&driver->driver_mutex); 121 set_driver_phone(driver, IPC_GET_ARG5(call)); 150 122 151 123 log_msg(LVL_NOTE, … … 606 578 method = DRIVER_CLIENT; 607 579 608 if (driver->phone < 0) {580 if (driver->phone <= 0) { 609 581 log_msg(LVL_ERROR, 610 582 "Could not forward to driver `%s' (phone is %d).", … … 646 618 dev = fun->dev; 647 619 648 if (dev->state != DEVICE_USABLE || dev->drv->phone < 0) {620 if (dev->state != DEVICE_USABLE || dev->drv->phone <= 0) { 649 621 async_answer_0(iid, EINVAL); 650 622 return;
Note:
See TracChangeset
for help on using the changeset viewer.