Changeset 8d3f198 in mainline for uspace/drv/uhci-rhd/port.c
- Timestamp:
- 2011-05-26T10:06:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c0940a85
- Parents:
- fa8d346 (diff), 5f9b81af (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-rhd/port.c
rfa8d346 r8d3f198 36 36 #include <errno.h> 37 37 #include <str_error.h> 38 #include <time.h>39 38 #include <async.h> 40 39 … … 82 81 * @param[in] number Port number. 83 82 * @param[in] usec Polling interval. 84 * @param[in] rh Pointer to ddf instance fothe root hub driver.83 * @param[in] rh Pointer to ddf instance of the root hub driver. 85 84 * @return Error code. 86 85 * … … 91 90 { 92 91 assert(port); 93 asprintf(&port->id_string, "Port (%p - %u)", port, number); 94 if (port->id_string == NULL) { 92 char *id_string; 93 asprintf(&id_string, "Port (%p - %u)", port, number); 94 if (id_string == NULL) { 95 95 return ENOMEM; 96 96 } 97 97 98 port->id_string = id_string; 98 99 port->address = address; 99 100 port->number = number; … … 105 106 usb_hc_connection_initialize_from_device(&port->hc_connection, rh); 106 107 if (ret != EOK) { 107 usb_log_error("Failed to initialize connection to HC."); 108 usb_log_error("%s: failed to initialize connection to HC.", 109 port->id_string); 110 free(id_string); 108 111 return ret; 109 112 } … … 113 116 usb_log_error("%s: failed to create polling fibril.", 114 117 port->id_string); 118 free(id_string); 115 119 return ENOMEM; 116 120 } … … 132 136 assert(port); 133 137 free(port->id_string); 134 / * TODO: Kill fibril here */138 // TODO: Kill fibril here 135 139 return; 136 140 } … … 150 154 151 155 /* Read register value */ 152 port_status_t port_status = uhci_port_read_status(instance); 156 const port_status_t port_status = 157 uhci_port_read_status(instance); 153 158 154 159 /* Print the value if it's interesting */ … … 161 166 usb_log_debug("%s: Connected change detected: %x.\n", 162 167 instance->id_string, port_status); 163 164 int rc =165 usb_hc_connection_open(&instance->hc_connection);166 if (rc != EOK) {167 usb_log_error("%s: Failed to connect to HC.",168 instance->id_string);169 continue;170 }171 168 172 169 /* Remove any old device */ … … 175 172 instance->id_string); 176 173 uhci_port_remove_device(instance); 174 } 175 176 int ret = 177 usb_hc_connection_open(&instance->hc_connection); 178 if (ret != EOK) { 179 usb_log_error("%s: Failed to connect to HC.", 180 instance->id_string); 181 continue; 177 182 } 178 183 … … 190 195 } 191 196 192 r c= usb_hc_connection_close(&instance->hc_connection);193 if (r c!= EOK) {197 ret = usb_hc_connection_close(&instance->hc_connection); 198 if (ret != EOK) { 194 199 usb_log_error("%s: Failed to disconnect.", 195 200 instance->id_string); … … 209 214 int uhci_port_reset_enable(int portno, void *arg) 210 215 { 211 uhci_port_t *port = (uhci_port_t *) arg; 216 uhci_port_t *port = arg; 217 assert(port); 212 218 213 219 usb_log_debug2("%s: new_device_enable_port.\n", port->id_string); … … 283 289 usb_log_error("%s: Don't know how to remove device %" PRIun ".\n", 284 290 port->id_string, port->attached_device); 291 port->attached_device = 0; 285 292 return ENOTSUP; 286 293 }
Note:
See TracChangeset
for help on using the changeset viewer.