Changes in uspace/drv/bus/usb/usbhub/port.c [b7fd2a0:58563585] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.c
rb7fd2a0 r58563585 54 54 }; 55 55 56 static errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub);56 static int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub); 57 57 static void usb_hub_port_reset_completed(usb_hub_port_t *port, 58 58 usb_hub_dev_t *hub, usb_port_status_t status); 59 static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status);60 static errno_t add_device_phase1_worker_fibril(void *arg);61 static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,59 static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status); 60 static int add_device_phase1_worker_fibril(void *arg); 61 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub, 62 62 usb_speed_t speed); 63 63 64 errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub)64 int usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub) 65 65 { 66 66 assert(port); … … 77 77 * @return Operation result 78 78 */ 79 errno_t usb_hub_port_clear_feature(79 int usb_hub_port_clear_feature( 80 80 usb_hub_port_t *port, usb_hub_class_feature_t feature) 81 81 { … … 99 99 * @return Operation result 100 100 */ 101 errno_t usb_hub_port_set_feature(101 int usb_hub_port_set_feature( 102 102 usb_hub_port_t *port, usb_hub_class_feature_t feature) 103 103 { … … 143 143 144 144 usb_port_status_t status = 0; 145 const errno_t opResult = get_port_status(port, &status);145 const int opResult = get_port_status(port, &status); 146 146 if (opResult != EOK) { 147 147 usb_log_error("(%p-%u): Failed to get port status: %s.\n", hub, … … 158 158 159 159 /* ACK the change */ 160 const errno_t opResult = usb_hub_port_clear_feature(port,160 const int opResult = usb_hub_port_clear_feature(port, 161 161 USB_HUB_FEATURE_C_PORT_CONNECTION); 162 162 if (opResult != EOK) { … … 167 167 168 168 if (connected) { 169 const errno_t opResult = create_add_device_fibril(port, hub,169 const int opResult = create_add_device_fibril(port, hub, 170 170 usb_port_speed(status)); 171 171 if (opResult != EOK) { … … 191 191 port->port_number); 192 192 usb_hub_port_device_gone(port, hub); 193 const errno_t rc = usb_hub_port_clear_feature(port,193 const int rc = usb_hub_port_clear_feature(port, 194 194 USB_HUB_FEATURE_C_PORT_ENABLE); 195 195 if (rc != EOK) { … … 206 206 " NOT happen as we do not support suspend state!", hub, 207 207 port->port_number); 208 const errno_t rc = usb_hub_port_clear_feature(port,208 const int rc = usb_hub_port_clear_feature(port, 209 209 USB_HUB_FEATURE_C_PORT_SUSPEND); 210 210 if (rc != EOK) { … … 224 224 * mode. USB system software is responsible for powering port 225 225 * back on when the over-current condition is gone */ 226 const errno_t rc = usb_hub_port_clear_feature(port,226 const int rc = usb_hub_port_clear_feature(port, 227 227 USB_HUB_FEATURE_C_PORT_OVER_CURRENT); 228 228 if (rc != EOK) { … … 232 232 } 233 233 if (!(status & ~USB_HUB_PORT_STATUS_OC)) { 234 const errno_t rc = usb_hub_port_set_feature(234 const int rc = usb_hub_port_set_feature( 235 235 port, USB_HUB_FEATURE_PORT_POWER); 236 236 if (rc != EOK) { … … 260 260 * @param hub hub representation 261 261 */ 262 errno_t usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub)262 int usb_hub_port_device_gone(usb_hub_port_t *port, usb_hub_dev_t *hub) 263 263 { 264 264 assert(port); … … 267 267 if (!exch) 268 268 return ENOMEM; 269 const errno_t rc = usb_device_remove(exch, port->port_number);269 const int rc = usb_device_remove(exch, port->port_number); 270 270 usb_device_bus_exchange_end(exch); 271 271 if (rc == EOK) … … 304 304 305 305 /* Clear the port reset change. */ 306 errno_t rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET);306 int rc = usb_hub_port_clear_feature(port, USB_HUB_FEATURE_C_PORT_RESET); 307 307 if (rc != EOK) { 308 308 usb_log_error("(%p-%u): Failed to clear port reset change: %s.", … … 317 317 * @return Error code. 318 318 */ 319 static errno_t get_port_status(usb_hub_port_t *port, usb_port_status_t *status)319 static int get_port_status(usb_hub_port_t *port, usb_port_status_t *status) 320 320 { 321 321 assert(port); … … 333 333 usb_port_status_t status_tmp; 334 334 335 const errno_t rc = usb_pipe_control_read(port->control_pipe,335 const int rc = usb_pipe_control_read(port->control_pipe, 336 336 &request, sizeof(usb_device_request_setup_packet_t), 337 337 &status_tmp, sizeof(status_tmp), &recv_size); … … 351 351 } 352 352 353 static errno_t port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable)353 static int port_enable(usb_hub_port_t *port, usb_hub_dev_t *hub, bool enable) 354 354 { 355 355 if (enable) { 356 errno_t rc =356 int rc = 357 357 usb_hub_port_set_feature(port, USB_HUB_FEATURE_PORT_RESET); 358 358 if (rc != EOK) { … … 383 383 * @return 0 Always. 384 384 */ 385 errno_t add_device_phase1_worker_fibril(void *arg)385 int add_device_phase1_worker_fibril(void *arg) 386 386 { 387 387 struct add_device_phase1 *params = arg; 388 388 assert(params); 389 389 390 errno_t ret = EOK;390 int ret = EOK; 391 391 usb_hub_dev_t *hub = params->hub; 392 392 usb_hub_port_t *port = params->port; … … 434 434 usb_log_error("(%p-%u): Failed to enumerate device: %s", hub, 435 435 port->port_number, str_error(ret)); 436 const errno_t ret = port_enable(port, hub, false);436 const int ret = port_enable(port, hub, false); 437 437 if (ret != EOK) { 438 438 usb_log_warning("(%p-%u)Failed to disable port (%s), " … … 440 440 port->port_number, str_error(ret)); 441 441 } else { 442 const errno_t ret = usb_release_default_address(exch);442 const int ret = usb_release_default_address(exch); 443 443 if (ret != EOK) 444 444 usb_log_warning("(%p-%u): Failed to release " … … 475 475 * @return Error code. 476 476 */ 477 static errno_t create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub,477 static int create_add_device_fibril(usb_hub_port_t *port, usb_hub_dev_t *hub, 478 478 usb_speed_t speed) 479 479 {
Note:
See TracChangeset
for help on using the changeset viewer.