Changes in uspace/lib/drv/generic/driver.c [0b5a4131:228e490] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
r0b5a4131 r228e490 48 48 #include <ctype.h> 49 49 #include <errno.h> 50 #include <inttypes.h> 50 51 51 52 #include <ipc/driver.h> … … 80 81 static void driver_irq_handler(ipc_callid_t iid, ipc_call_t *icall) 81 82 { 82 int id = (int)IPC_GET_ METHOD(*icall);83 int id = (int)IPC_GET_IMETHOD(*icall); 83 84 interrupt_context_t *ctx; 84 85 … … 164 165 165 166 devman_handle_t dev_handle = IPC_GET_ARG1(*icall); 167 devman_handle_t parent_dev_handle = IPC_GET_ARG2(*icall); 168 166 169 device_t *dev = create_device(); 167 170 dev->handle = dev_handle; … … 171 174 172 175 add_to_devices_list(dev); 176 dev->parent = driver_get_device(&devices, parent_dev_handle); 177 173 178 res = driver->driver_ops->add_device(dev); 174 179 if (0 == res) { 175 printf("%s: new device with handle = %xwas added.\n",180 printf("%s: new device with handle=%" PRIun " was added.\n", 176 181 driver->name, dev_handle); 177 182 } else { 178 printf("%s: failed to add a new device with handle = % d.\n",183 printf("%s: failed to add a new device with handle = %" PRIun ".\n", 179 184 driver->name, dev_handle); 180 185 remove_from_devices_list(dev); … … 195 200 ipc_callid_t callid = async_get_call(&call); 196 201 197 switch (IPC_GET_ METHOD(call)) {202 switch (IPC_GET_IMETHOD(call)) { 198 203 case IPC_M_PHONE_HUNGUP: 199 204 cont = false; … … 203 208 break; 204 209 default: 205 if (!(callid & IPC_CALLID_NOTIFICATION)) 206 ipc_answer_0(callid, ENOENT); 210 ipc_answer_0(callid, ENOENT); 207 211 } 208 212 } … … 226 230 if (dev == NULL) { 227 231 printf("%s: driver_connection_gen error - no device with handle" 228 " % xwas found.\n", driver->name, handle);232 " %" PRIun " was found.\n", driver->name, handle); 229 233 ipc_answer_0(iid, ENOENT); 230 234 return; … … 250 254 ipc_call_t call; 251 255 callid = async_get_call(&call); 252 ipcarg_t method = IPC_GET_METHOD(call);256 sysarg_t method = IPC_GET_IMETHOD(call); 253 257 int iface_idx; 254 258 … … 290 294 printf("%s: driver_connection_gen error - ", 291 295 driver->name); 292 printf("device with handle % dhas no interface "296 printf("device with handle %" PRIun " has no interface " 293 297 "with id %d.\n", handle, iface_idx); 294 298 ipc_answer_0(callid, ENOTSUP); … … 304 308 305 309 /* get the method of the remote interface */ 306 ipcarg_t iface_method_idx = IPC_GET_ARG1(call);310 sysarg_t iface_method_idx = IPC_GET_ARG1(call); 307 311 remote_iface_func_ptr_t iface_method_ptr = 308 312 get_remote_method(rem_iface, iface_method_idx); … … 342 346 { 343 347 /* Select interface */ 344 switch (( ipcarg_t) (IPC_GET_ARG1(*icall))) {348 switch ((sysarg_t) (IPC_GET_ARG1(*icall))) { 345 349 case DRIVER_DEVMAN: 346 350 /* handle PnP events from device manager */ … … 377 381 } 378 382 383 /** Wrapper for child_device_register for devices with single match id. 384 * 385 * @param parent Parent device. 386 * @param child_name Child device name. 387 * @param child_match_id Child device match id. 388 * @param child_match_score Child device match score. 389 * @return Error code. 390 */ 391 int child_device_register_wrapper(device_t *parent, const char *child_name, 392 const char *child_match_id, int child_match_score) 393 { 394 device_t *child = NULL; 395 match_id_t *match_id = NULL; 396 int rc; 397 398 child = create_device(); 399 if (child == NULL) { 400 rc = ENOMEM; 401 goto failure; 402 } 403 404 child->name = child_name; 405 406 match_id = create_match_id(); 407 if (match_id == NULL) { 408 rc = ENOMEM; 409 goto failure; 410 } 411 412 match_id->id = child_match_id; 413 match_id->score = child_match_score; 414 add_match_id(&child->match_ids, match_id); 415 416 rc = child_device_register(child, parent); 417 if (EOK != rc) 418 goto failure; 419 420 return EOK; 421 422 failure: 423 if (match_id != NULL) { 424 match_id->id = NULL; 425 delete_match_id(match_id); 426 } 427 428 if (child != NULL) { 429 child->name = NULL; 430 delete_device(child); 431 } 432 433 return rc; 434 } 435 379 436 int driver_main(driver_t *drv) 380 437 {
Note:
See TracChangeset
for help on using the changeset viewer.