Changeset d35ac1d in mainline for uspace/lib/drv/generic/driver.c
- Timestamp:
- 2011-01-09T19:52:08Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36f2b3e
- Parents:
- 8871dba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
r8871dba rd35ac1d 140 140 } 141 141 142 static device_t * 142 static device_t *driver_get_device(link_t *devices, devman_handle_t handle) 143 143 { 144 144 device_t *dev = NULL; … … 164 164 int res = EOK; 165 165 166 devman_handle_t dev_handle = 166 devman_handle_t dev_handle = IPC_GET_ARG1(*icall); 167 167 devman_handle_t parent_dev_handle = IPC_GET_ARG2(*icall); 168 168 169 169 device_t *dev = create_device(); 170 170 dev->handle = dev_handle; … … 177 177 178 178 res = driver->driver_ops->add_device(dev); 179 if ( 0 == res) {179 if (res == 0) { 180 180 printf("%s: new device with handle=%" PRIun " was added.\n", 181 181 driver->name, dev_handle); … … 246 246 ret = (*dev->ops->open)(dev); 247 247 248 ipc_answer_0(iid, ret); 248 ipc_answer_0(iid, ret); 249 249 if (EOK != ret) 250 250 return; … … 258 258 259 259 switch (method) { 260 case IPC_M_PHONE_HUNGUP: 260 case IPC_M_PHONE_HUNGUP: 261 261 /* close the device */ 262 262 if (NULL != dev->ops && NULL != dev->ops->close) … … 264 264 ipc_answer_0(callid, EOK); 265 265 return; 266 default: 266 default: 267 267 /* convert ipc interface id to interface index */ 268 268 … … 289 289 /* calling one of the device's interfaces */ 290 290 291 /* get the device interface structure*/292 void * iface = device_get_iface(dev, iface_idx);293 if ( NULL == iface) {291 /* Get the interface ops structure. */ 292 void *ops = device_get_ops(dev, iface_idx); 293 if (ops == NULL) { 294 294 printf("%s: driver_connection_gen error - ", 295 295 driver->name); … … 304 304 * handling ("remote interface"). 305 305 */ 306 remote_iface_t *rem_iface = get_remote_iface(iface_idx);306 remote_iface_t *rem_iface = get_remote_iface(iface_idx); 307 307 assert(NULL != rem_iface); 308 308 … … 325 325 * associated with the device by its driver. 326 326 */ 327 (*iface_method_ptr)(dev, iface, callid, &call);327 (*iface_method_ptr)(dev, ops, callid, &call); 328 328 break; 329 329 } … … 377 377 if (EOK == res) 378 378 return res; 379 remove_from_devices_list(child); 379 remove_from_devices_list(child); 380 380 return res; 381 381 }
Note:
See TracChangeset
for help on using the changeset viewer.