Changeset 66babbd in mainline for uspace/srv
- Timestamp:
- 2010-03-25T09:55:09Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a087f2e
- Parents:
- d347b53
- Location:
- uspace/srv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rd347b53 r66babbd 120 120 } 121 121 122 static int devman_receive_match_id(match_id_list_t *match_ids) { 123 124 match_id_t *match_id = create_match_id(); 125 ipc_callid_t callid; 126 ipc_call_t call; 127 int rc = 0; 128 129 callid = async_get_call(&call); 130 if (DEVMAN_ADD_MATCH_ID != IPC_GET_METHOD(call)) { 131 printf(NAME ": ERROR: devman_receive_match_id - invalid protocol.\n"); 132 ipc_answer_0(callid, EINVAL); 133 delete_match_id(match_id); 134 return EINVAL; 135 } 136 137 if (NULL == match_id) { 138 printf(NAME ": ERROR: devman_receive_match_id - failed to allocate match id.\n"); 139 ipc_answer_0(callid, ENOMEM); 140 return ENOMEM; 141 } 142 143 match_id->score = IPC_GET_ARG1(call); 144 145 rc = async_string_receive(&match_id->id, DEVMAN_NAME_MAXLEN, NULL); 146 if (EOK != rc) { 147 delete_match_id(match_id); 148 return rc; 149 } 150 151 list_append(&match_id->link, &match_ids->ids); 152 return rc; 153 } 154 155 static int devman_receive_match_ids(ipcarg_t match_count, match_id_list_t *match_ids) 156 { 157 int ret = EOK; 158 int i; 159 for (i = 0; i < match_count; i++) { 160 if (EOK != (ret = devman_receive_match_id(match_ids))) { 161 return ret; 162 } 163 } 164 return ret; 165 } 166 122 167 static void devman_add_child(ipc_callid_t callid, ipc_call_t *call, driver_t *driver) 123 168 { 124 169 printf(NAME ": devman_add_child\n"); 125 170 126 171 device_handle_t parent_handle = IPC_GET_ARG1(*call); 172 ipcarg_t match_count = IPC_GET_ARG2(*call); 173 127 174 node_t *parent = find_dev_node(&device_tree, parent_handle); 128 175 … … 130 177 ipc_answer_0(callid, ENOENT); 131 178 return; 132 } 179 } 133 180 134 181 char *dev_name = NULL; 135 182 int rc = async_string_receive(&dev_name, DEVMAN_NAME_MAXLEN, NULL); 136 if ( rc != EOK) {183 if (EOK != rc) { 137 184 ipc_answer_0(callid, rc); 138 185 return; … … 147 194 } 148 195 149 // TODO match ids196 devman_receive_match_ids(match_count, &node->match_ids); 150 197 151 198 // return device handle to parent's driver -
uspace/srv/drivers/root/root.c
rd347b53 r66babbd 55 55 static bool root_init(); 56 56 57 /** The root device driver's standard operations. 58 */ 57 59 static driver_ops_t root_ops = { 58 60 .add_device = &root_add_device 59 61 }; 60 62 63 /** The root device driver structure. 64 */ 61 65 static driver_t root_driver = { 62 66 .name = NAME, … … 64 68 }; 65 69 70 /** Create the device which represents the root of HW device tree. 71 * @param parent parent of the newly created device. 72 */ 66 73 static bool add_platform_child(device_t *parent) { 67 74 printf(NAME ": adding new child for platform device.\n"); … … 107 114 } 108 115 116 /** Get the root device. 117 * @param dev the device which is root of the whole device tree (both of HW and pseudo devices). 118 */ 109 119 static bool root_add_device(device_t *dev) 110 120 {
Note:
See TracChangeset
for help on using the changeset viewer.