Changes in uspace/lib/drv/generic/driver.c [8a637a4:8820544] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
r8a637a4 r8820544 53 53 #include <devman.h> 54 54 55 #include <ipc/driver.h> 56 55 57 #include "dev_iface.h" 56 58 #include "ddf/driver.h" … … 128 130 129 131 char *dev_name = NULL; 130 int rc = async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0); 131 if (rc != EOK) { 132 async_answer_0(iid, rc); 133 return; 134 } 135 132 async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0); 136 133 dev->name = dev_name; 137 134 … … 281 278 } 282 279 283 static void driver_connection_devman(ipc_callid_t iid, ipc_call_t *icall, 284 void *arg) 280 static void driver_connection_devman(ipc_callid_t iid, ipc_call_t *icall) 285 281 { 286 282 /* Accept connection */ … … 440 436 } 441 437 442 static void driver_connection_driver(ipc_callid_t iid, ipc_call_t *icall, 443 void *arg) 438 static void driver_connection_driver(ipc_callid_t iid, ipc_call_t *icall) 444 439 { 445 440 driver_connection_gen(iid, icall, true); 446 441 } 447 442 448 static void driver_connection_client(ipc_callid_t iid, ipc_call_t *icall, 449 void *arg) 443 static void driver_connection_client(ipc_callid_t iid, ipc_call_t *icall) 450 444 { 451 445 driver_connection_gen(iid, icall, false); 446 } 447 448 /** Function for handling connections to device driver. */ 449 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 450 { 451 sysarg_t conn_type; 452 453 if (iid == 0) { 454 /* Callback connection from devman */ 455 /* XXX Use separate handler for this type of connection */ 456 conn_type = DRIVER_DEVMAN; 457 } else { 458 conn_type = IPC_GET_ARG1(*icall); 459 } 460 461 /* Select interface */ 462 switch (conn_type) { 463 case DRIVER_DEVMAN: 464 /* Handle request from device manager */ 465 driver_connection_devman(iid, icall); 466 break; 467 case DRIVER_DRIVER: 468 /* Handle request from drivers of child devices */ 469 driver_connection_driver(iid, icall); 470 break; 471 case DRIVER_CLIENT: 472 /* Handle request from client applications */ 473 driver_connection_client(iid, icall); 474 break; 475 default: 476 /* No such interface */ 477 async_answer_0(iid, ENOENT); 478 } 452 479 } 453 480 … … 593 620 * The session will be automatically closed when @a dev is destroyed. 594 621 * 595 * @param dev Device 596 * 597 * @return New session or NULL if session could not be created 598 * 599 */ 600 async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *dev) 622 * @param dev Device 623 * @param mgmt Exchange management style 624 * @return New session or NULL if session could not be created 625 */ 626 async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *dev, exch_mgmt_t mgmt) 601 627 { 602 628 assert(dev->parent_sess == NULL); 603 dev->parent_sess = devman_parent_device_connect( dev->handle,629 dev->parent_sess = devman_parent_device_connect(mgmt, dev->handle, 604 630 IPC_FLAG_BLOCKING); 605 631 … … 890 916 * This allows handling connections the non-devman way. 891 917 */ 892 void ddf_fun_set_conn_handler(ddf_fun_t *fun, async_ port_handler_t conn)918 void ddf_fun_set_conn_handler(ddf_fun_t *fun, async_client_conn_t conn) 893 919 { 894 920 assert(fun->ops == NULL); … … 929 955 * incoming connections. 930 956 */ 931 port_id_t port; 932 int rc = async_create_port(INTERFACE_DDF_DRIVER, driver_connection_driver, 933 NULL, &port); 934 if (rc != EOK) 935 return rc; 936 937 rc = async_create_port(INTERFACE_DDF_DEVMAN, driver_connection_devman, 938 NULL, &port); 939 if (rc != EOK) 940 return rc; 941 942 async_set_fallback_port_handler(driver_connection_client, NULL); 943 944 rc = devman_driver_register(driver->name); 957 async_set_client_connection(driver_connection); 958 int rc = devman_driver_register(driver->name); 945 959 if (rc != EOK) { 946 960 printf("Error: Failed to register driver with device manager " 947 "(%s).\n", (rc == EEXIST ) ? "driver already started" :961 "(%s).\n", (rc == EEXISTS) ? "driver already started" : 948 962 str_error(rc)); 949 963
Note:
See TracChangeset
for help on using the changeset viewer.